From c307e423f5e1a7ef5836da0acf280d7b0d728317 Mon Sep 17 00:00:00 2001 From: uczen <jajo@gmail.com> Date: Thu, 9 Jan 2025 12:22:06 +0100 Subject: [PATCH 1/9] mordo --- UpDate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UpDate.cs b/UpDate.cs index f3ceae6..eb69b30 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -50,7 +50,7 @@ namespace blacharze list[i, j] = lineList[j]; } } - + //df return list; } -- GitLab From f7f55af7b2317477eb627ba9778040af61ac0f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20St=C4=99pie=C5=84?= <krystian.stepen@gmail.com> Date: Sun, 12 Jan 2025 15:47:06 +0100 Subject: [PATCH 2/9] =?UTF-8?q?Program=20jest=20raczej=20w=20pe=C5=82ni=20?= =?UTF-8?q?do=20u=C5=BCytku,=20wszystkie=20znalezione=20b=C5=82=C4=99dy=20?= =?UTF-8?q?usuni=C4=99te.=20Dodanie=20modyfikowania=20i=20wiele=20wi=C4=99?= =?UTF-8?q?cej?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BACKUP LISTA.txt | 22 +++++++++++++ MainWindow.xaml.cs | 40 ++++++----------------- ModifyWin.xaml | 38 +++++++++++----------- ModifyWin.xaml.cs | 63 ++++++++++++++++++++++++++++++++++-- SecWin.xaml | 2 +- SecWin.xaml.cs | 2 +- UpDate.cs | 32 ++++++++++++++++++ mWinUpDate.cs | 81 ++++++++++++++++++++++++++++++++++++++++++++++ wtf.csproj | 1 + 9 files changed, 229 insertions(+), 52 deletions(-) create mode 100644 BACKUP LISTA.txt create mode 100644 mWinUpDate.cs diff --git a/BACKUP LISTA.txt b/BACKUP LISTA.txt new file mode 100644 index 0000000..d4d880d --- /dev/null +++ b/BACKUP LISTA.txt @@ -0,0 +1,22 @@ +Maciej,SzymaĹski,26-400,Gdynia,Spokojna,m,0,0,1,1 +Agnieszka,KrĂłl,27-450,Koszalin,Wodna,f,1,0,1,2 +Grzegorz,Adamski,28-500,CzÄstochowa,Zachodnia,m,1,1,1,3 +Karolina,WesoĹowska,29-550,Bydgoszcz,PoĹudniowa,f,0,0,0,4 +Ĺukasz,Pawlak,30-600,BiaĹystok,Jasna,m,0,1,0,5 +Ewa,WiĹniewska,20-400,GdaĹsk,Jasna,f,1,1,0,6 +MichaĹ,Morawiecki,11-500,WrocĹaw,SĹoneczna,m,1,0,0,7 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,8 +Krzysztof,Kowalski,13-300,Lubin,Pogodna,m,0,1,0,9 +Ewa,WiĹniewska,20-400,GdaĹsk,Morska,f,1,1,0,10 +MichaĹ,ZieliĹski,11-500,WrocĹaw,SĹoneczna,m,0,0,1,11 +Katarzyna,KamiĹska,12-600,Warszawa,LeĹna,f,1,1,1,12 +Tomasz,WĂłjcik,14-700,KrakĂłw,Zamkowa,m,0,1,0,13 +Alicja,Kowalczyk,16-800,PoznaĹ,Ogrodowa,f,1,0,1,14 +Piotr,Lewandowski,18-900,Lublin,Parkowa,m,0,0,1,15 +Maria,DÄ browska,19-100,Szczecin,Róşana,f,1,1,0,16 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,17 +Olga,Majewska,21-150,ĹĂłdĹş,KrĂłtka,f,0,1,0,18 +Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,19 +Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,20 +PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,21 +Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,22 diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 388b5b8..1b24554 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -63,36 +63,11 @@ namespace blacharze } private void ListaBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { + if (ListaBox.SelectedItem != null) { - string imienazwisko = ListaBox.SelectedItem?.ToString(); - string[] nl = imienazwisko.Split('.'); - imienazwisko = nl[1]; - if (imienazwisko != null) - { - string[,] list = UpDate.GetToListFile(); - int x = 0; - int i = 0; - - string[] s = imienazwisko.Split(' '); - while (i< list.GetLength(0) && x == 0) - { - if (s[0] == list[i, 0] && s[1] == list[i, 1]) - { - x++; - Imie.Text = list[i, 0]; - Nazwisko.Text = list[i, 1]; - string FullAdres = list[i, 2] + " " + list[i, 3] + " " + list[i, 4]; - Adres.Text = FullAdres; - id.Content = list[i, 9]; - if (list[i, 5] == "m") { Mezczyzna.IsChecked = true; } else { Kobieta.IsChecked = true; } - A.IsChecked = false; B.IsChecked = false; C.IsChecked = false; - if (list[i, 6] == "1") { A.IsChecked = true; }; if (list[i, 7] == "1") { B.IsChecked = true; } - if (list[i, 8] == "1") { C.IsChecked = true; } - } - i++; - } - } + ModifyWin.id = int.Parse(id.Content.ToString()); + UpDate.PrintInfo(ListaBox.SelectedIndex); } } @@ -125,7 +100,11 @@ namespace blacharze private void Modify(object sender, RoutedEventArgs e) { - + if(ListaBox.SelectedItem == null) + { + MessageBox.Show("Nie wybrano osoby do modyfikacji"); + return; + } if (Application.Current.Windows.OfType<ModifyWin>().Any()) { @@ -133,7 +112,8 @@ namespace blacharze } else { - ModifyWin modifyWin = new ModifyWin(); + ModifyWin.id = int.Parse(id.Content.ToString()); + ModifyWin modifyWin = new ModifyWin(); modifyWin.Show(); } diff --git a/ModifyWin.xaml b/ModifyWin.xaml index 9922aa7..7c146fd 100644 --- a/ModifyWin.xaml +++ b/ModifyWin.xaml @@ -45,10 +45,11 @@ <TextBlock Text="Modyfikuj KierowcÄ" Foreground="White" FontSize="20" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> - <Grid Margin="20,70,20,20"> + <Grid Margin="20,80,20,10"> <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="205*"/> + <ColumnDefinition Width="9*"/> + <ColumnDefinition Width="196*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> @@ -61,35 +62,36 @@ </Grid.RowDefinitions> - <Label Content="ImiÄ" Grid.Row="0" Grid.Column="0" Margin="5" VerticalAlignment="Center"/> - <TextBox x:Name="Imie" Grid.Row="0" Grid.Column="1" Style="{StaticResource CustomTextBox}"/> + <Label Content="ImiÄ" Grid.Column="0" Margin="5,0,5,0" VerticalAlignment="Center"/> + <TextBox x:Name="Imie" Grid.Row="0" Grid.Column="2" Style="{StaticResource CustomTextBox}" Margin="1,10,10,10"/> - <Label Content="Nazwisko" Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center"/> - <TextBox x:Name="Nazwisko" Grid.Row="1" Grid.Column="1" Style="{StaticResource CustomTextBox}"/> + <Label Content="Nazwisko" Grid.Row="1" Grid.Column="0" Margin="5,0,5,0" VerticalAlignment="Center"/> + <TextBox x:Name="Nazwisko" Grid.Row="1" Grid.Column="2" Style="{StaticResource CustomTextBox}" Margin="1,10,10,10"/> - <Label Content="Kod pocztowy" Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center"/> - <TextBox x:Name="Kod" Grid.Row="2" Grid.Column="1" Style="{StaticResource CustomTextBox}"/> + <Label Content="Kod pocztowy" Grid.Row="2" Grid.Column="0" Margin="5,0,5,0" VerticalAlignment="Center"/> + <TextBox x:Name="Kod" Grid.Row="2" Grid.Column="2" Style="{StaticResource CustomTextBox}" Margin="1,10,10,10"/> - <Label Content="Miasto" Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center"/> - <TextBox x:Name="Miasto" Grid.Row="3" Grid.Column="1" Style="{StaticResource CustomTextBox}"/> + <Label Content="Miasto" Grid.Row="3" Grid.Column="0" Margin="5,0,5,0" VerticalAlignment="Center"/> + <TextBox x:Name="Miasto" Grid.Row="3" Grid.Column="2" Style="{StaticResource CustomTextBox}" Margin="1,10,10,10"/> - <Label Content="Ulica" Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center"/> - <TextBox x:Name="Ulica" Grid.Row="4" Grid.Column="1" Style="{StaticResource CustomTextBox}"/> - <StackPanel Grid.Row="5" Grid.Column="0" Orientation="Vertical" Margin="5"> + <Label Content="Ulica" Grid.Row="4" Grid.Column="0" Margin="5,0,5,0" VerticalAlignment="Center"/> + <TextBox x:Name="Ulica" Grid.Row="4" Grid.Column="2" Style="{StaticResource CustomTextBox}" Margin="1,10,10,10"/> + <StackPanel Grid.Row="5" Grid.Column="0" Orientation="Vertical" Margin="5,5,5,5"> <Label Content="PĹeÄ"/> <RadioButton x:Name="Kobieta" Content="Kobieta" GroupName="Plec"/> <RadioButton x:Name="Mezczyzna" Content="MÄĹźczyzna" GroupName="Plec"/> </StackPanel> - <StackPanel Grid.Row="5" Grid.Column="1" Orientation="Vertical" Margin="5"> + <StackPanel Grid.Row="5" Grid.Column="1" Orientation="Vertical" Margin="5,5,5,5" Grid.ColumnSpan="2"> <Label Content="Kategorie"/> <CheckBox x:Name="A" Content="A"/> <CheckBox x:Name="B" Content="B"/> <CheckBox x:Name="C" Content="C"/> </StackPanel> - <Button Content="ZatwiedĹş" Grid.Row="6" Background="Orange" Style="{StaticResource CustomButton}" Width="154" Click="Accept" Grid.Column="1" Margin="0,11,0,11"/> - <Button Content="Anuluj" Grid.Row="6" Background="Red" Style="{StaticResource CustomButton}" Width="154" Click="Cancle" Margin="0,11,0,11"/> + <Button Content="ZatwiedĹş" Grid.Row="6" Background="Orange" Style="{StaticResource CustomButton}" Width="154" Click="Accept" Grid.Column="2" Margin="16,11,0,1" HorizontalAlignment="Left"/> + <Button Content="Anuluj" Grid.Row="6" Background="Red" Style="{StaticResource CustomButton}" Width="154" Click="Cancle" Margin="0,11,0,1"/> </Grid> + <Button Content="Reset" Style="{StaticResource CustomButton}" Click="Reset" Margin="0,55,0,0" VerticalAlignment="Top" Width="50"/> </Grid> -</Window> +</Window> \ No newline at end of file diff --git a/ModifyWin.xaml.cs b/ModifyWin.xaml.cs index 484bee7..7e33dc3 100644 --- a/ModifyWin.xaml.cs +++ b/ModifyWin.xaml.cs @@ -19,19 +19,78 @@ namespace wtf /// </summary> public partial class ModifyWin : Window { + public static int id; + + public ModifyWin() { InitializeComponent(); + mWinUpDate.TabP[0] = Imie; + mWinUpDate.TabP[1] = Nazwisko; + mWinUpDate.TabP[2] = Kod; + mWinUpDate.TabP[3] = Miasto; + mWinUpDate.TabP[4] = Ulica; + + + mWinUpDate.TabC[0] = A; + mWinUpDate.TabC[1] = B; + mWinUpDate.TabC[2] = C; + + mWinUpDate.TabR[0] = Mezczyzna; + mWinUpDate.TabR[1] = Kobieta; + + mWinUpDate.FillModifyWin(id); + } - private void Button_Click(object sender, RoutedEventArgs e) + + + private void Accept(object sender, RoutedEventArgs e) { + + + + if (Imie.Text != "" && Nazwisko.Text != "" && Kod.Text != "" && Miasto.Text != "" && Ulica.Text != "") + { + MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz zmodyfikowaÄ kierowcÄ?", "Potwierdzenie", MessageBoxButton.YesNo); + if (result == MessageBoxResult.Yes) + { + string ToFile = Imie.Text + "," + Nazwisko.Text + "," + Kod.Text + "," + Miasto.Text + "," + Ulica.Text + ","; + if (Kobieta.IsChecked == true) + { + ToFile = ToFile + "f,"; + } + else + { + ToFile = ToFile + "m,"; + } + + if (A.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; + if (B.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; + if (C.IsChecked == true) { ToFile = ToFile + "1"; } else { ToFile = ToFile + "0"; }; + ToFile = ToFile + "," + id; + // MessageBox.Show(ToFile); + mWinUpDate.EditLineInFile(id - 1, ToFile); + Close(); + } + } + else + { + MessageBox.Show("NiepeĹne dane"); + } + + } - private void Accept(object sender, RoutedEventArgs e) + private void Cancle(object sender, RoutedEventArgs e) { + Close(); + } + private void Reset(object sender, RoutedEventArgs e) + { + mWinUpDate.FillModifyWin(id); } } } diff --git a/SecWin.xaml b/SecWin.xaml index 9e8b04a..da13014 100644 --- a/SecWin.xaml +++ b/SecWin.xaml @@ -88,4 +88,4 @@ <Button Content="Dodaj KierowcÄ" Grid.Row="6" Grid.ColumnSpan="2" Style="{StaticResource CustomButton}" Width="200" Click="Button_Click"/> </Grid> </Grid> -</Window> +</Window> \ No newline at end of file diff --git a/SecWin.xaml.cs b/SecWin.xaml.cs index 5af4891..e9c3cbf 100644 --- a/SecWin.xaml.cs +++ b/SecWin.xaml.cs @@ -15,7 +15,7 @@ using System.IO; namespace blacharze { - + public partial class SecWin : Window { public SecWin() diff --git a/UpDate.cs b/UpDate.cs index 3b36cb8..f065b05 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Controls; using System.IO; +using wtf; namespace blacharze { internal class UpDate @@ -21,6 +22,12 @@ namespace blacharze FixIdAfterRemove(); RefreshGui(); } + public static void StartingPackAfterEdit(int id) + { + FixIdAfterRemove(); + PrintInfo(id); + } + public static void DeleteLines(int line) { string[] lines = File.ReadAllLines("ListaOs.txt"); @@ -29,6 +36,31 @@ namespace blacharze File.WriteAllLines("ListaOs.txt", linesList.ToArray()); } + public static void PrintInfo(int id) + { + + + + string[,] list = UpDate.GetToListFile(); + + + + + + TabP[0].Text = list[id, 0]; + TabP[1].Text = list[id, 1]; + string FullAdres = list[id, 2] + " " + list[id, 3] + " " + list[id, 4]; + TabP[2].Text = FullAdres; + Id.Content = list[id, 9]; + if (list[id, 5] == "m") { TabR[0].IsChecked = true; } else { TabR[1].IsChecked = true; } + + TabC[0].IsChecked = false; TabC[1].IsChecked = false; TabC[2].IsChecked = false; + + if (list[id, 6] == "1") { TabC[0].IsChecked = true; }; if (list[id, 7] == "1") { TabC[1].IsChecked = true; } + if (list[id, 8] == "1") { TabC[2].IsChecked = true; } + + + } public static void FixIdAfterRemove() diff --git a/mWinUpDate.cs b/mWinUpDate.cs new file mode 100644 index 0000000..ab42dee --- /dev/null +++ b/mWinUpDate.cs @@ -0,0 +1,81 @@ +ďťżusing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using blacharze; + +using System.IO; +namespace wtf +{ + internal class mWinUpDate + { + public static ListBox ListaBox = new ListBox(); + public static TextBox[] TabP = new TextBox[5]; + public static CheckBox[] TabC = new CheckBox[3]; + public static RadioButton[] TabR = new RadioButton[2]; + + + + public static void FillModifyWin(int id) { + string[,] list2 = UpDate.GetToListFile(); + id = id-1; + TabP[0].Text = list2[id, 0]; + TabP[1].Text = list2[id, 1]; + TabP[2].Text = list2[id, 2]; + TabP[3].Text = list2[id, 3]; + TabP[4].Text = list2[id, 4]; + // MessageBox.Show(list2[id, 0]+ list2[id, 1]+ list2[id, 2] + list2[id, 3] + list2[id, 4]+ list2[id, 5]+ list2[id, 6]+ list2[id, 7] + list2[id,8]); + if (list2[id, 6] == "1") + { + TabC[0].IsChecked = true; + } + else + { + TabC[0].IsChecked = false; + } + if (list2[id, 7] == "1") + { + TabC[1].IsChecked = true; + } + else + { + TabC[1].IsChecked = false; + } + + if (list2[id, 8] == "1") + { + TabC[2].IsChecked = true; + } + else + { + TabC[2].IsChecked = false; + } + + + if (list2[id, 5] == "m") + { + TabR[0].IsChecked = true; + } + else if (list2[id, 5] == "f") + { + TabR[1].IsChecked = true; + } + } + + public static void EditLineInFile(int line, string text) { + + string[] lines = File.ReadAllLines("ListaOs.txt"); + + List<string> linesList = new List<string>(lines); + linesList[line] = text; + File.WriteAllLines("ListaOs.txt", linesList.ToArray()); + + UpDate.StartingPackAfterEdit(line); + } + + + } +} diff --git a/wtf.csproj b/wtf.csproj index 67a516c..8a8833a 100644 --- a/wtf.csproj +++ b/wtf.csproj @@ -58,6 +58,7 @@ <Compile Include="ModifyWin.xaml.cs"> <DependentUpon>ModifyWin.xaml</DependentUpon> </Compile> + <Compile Include="mWinUpDate.cs" /> <Compile Include="SecWin.xaml.cs"> <DependentUpon>SecWin.xaml</DependentUpon> </Compile> -- GitLab From 91d1cd704d7bc7c96b007a882144ff425d160a13 Mon Sep 17 00:00:00 2001 From: uczen <jajo@gmail.com> Date: Tue, 14 Jan 2025 13:13:41 +0100 Subject: [PATCH 3/9] Prosze commit --- BACKUP LISTA.txt | 1 + MainWindow.xaml | 12 ++++--- MainWindow.xaml.cs | 21 ++++++++++-- ModifyWin.xaml | 4 +-- SearchWindow.xaml | 76 ++++++++++++++++++++++++++++++++++++++++++++ SearchWindow.xaml.cs | 54 +++++++++++++++++++++++++++++++ SecWin.xaml | 6 ++-- SecWin.xaml.cs | 2 +- UpDate.cs | 51 +++++++++++++++++++++++++---- wtf.csproj | 7 ++++ 10 files changed, 214 insertions(+), 20 deletions(-) create mode 100644 SearchWindow.xaml create mode 100644 SearchWindow.xaml.cs diff --git a/BACKUP LISTA.txt b/BACKUP LISTA.txt index d4d880d..ac9be02 100644 --- a/BACKUP LISTA.txt +++ b/BACKUP LISTA.txt @@ -20,3 +20,4 @@ Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,19 Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,20 PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,21 Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,22 +Adam,Kaban,12-12,Opole,Cicha,f,1,1,1,23 \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml index b031ad4..0df21c8 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -98,18 +98,20 @@ <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> - <ListBox Grid.Column="0" Margin="35,10,215,10" x:Name="ListaBox" BorderBrush="#CCC" BorderThickness="1" Grid.ColumnSpan="2" SelectionChanged="ListaBox_SelectionChanged"/> + <ListBox Grid.Column="0" Margin="21,0,229,20" x:Name="ListaBox" BorderBrush="#CCC" BorderThickness="1" Grid.ColumnSpan="2" SelectionChanged="ListaBox_SelectionChanged"/> - <StackPanel Grid.Column="2" Margin="0,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Top" Width="145"> + <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" Width="144"> <RadioButton IsEnabled="False" x:Name="Kobieta" Content="Kobieta" FontSize="16" Margin="5"/> <RadioButton IsEnabled="False" x:Name="Mezczyzna" Content="MÄĹźczyzna" FontSize="16" Margin="5"/> <CheckBox IsEnabled="False" x:Name="A" Content="A" FontSize="16" Margin="5"/> <CheckBox IsEnabled="False" x:Name="B" Content="B" FontSize="16" Margin="5"/> <CheckBox IsEnabled="False" x:Name="C" Content="C" FontSize="16" Margin="5"/> </StackPanel> - <Button Content="Dodaj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Button_Click" Grid.Column="1" HorizontalAlignment="Left" Margin="106,0,0,0" VerticalAlignment="Top"/> - <Button Content="UsuĹ KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Usun" Grid.Column="1" HorizontalAlignment="Left" Margin="106,46,0,0" VerticalAlignment="Top"/> - <Button Content="Modyfikuj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Modify" Grid.Column="1" HorizontalAlignment="Left" Margin="106,91,0,0" VerticalAlignment="Top"/> + <Button Content="Dodaj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Button_Click" Grid.Column="1" HorizontalAlignment="Left" Margin="269,-8,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> + <Button Content="UsuĹ KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Usun" Grid.Column="1" HorizontalAlignment="Left" Margin="269,82,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> + <Button Content="Modyfikuj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Modify" Grid.Column="1" HorizontalAlignment="Left" Margin="269,37,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> + <Button Content="Szukaj KierowcÄ" Click="Search" Grid.Column="1" Margin="73,156,35,97"/> + <ListBox Grid.Column="1" Margin="73,180,35,22" x:Name="SearchList" BorderBrush="#CCC" BorderThickness="1" SelectionChanged="ListaBox_SelectionChanged"/> </Grid> <Label x:Name="id" Content="Label" Visibility="Hidden" HorizontalAlignment="Left" Margin="507,51,0,0" VerticalAlignment="Top"/> </Grid> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 1b24554..278d1db 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -28,7 +28,8 @@ namespace blacharze public MainWindow() { InitializeComponent(); - UpDate.ListaBox = ListaBox; + UpDate.ListaBox[0] = ListaBox; + UpDate.ListaBox[1] = SearchList; UpDate.TabP[0] = Imie; UpDate.TabP[1] = Nazwisko; UpDate.TabP[2] = Adres; @@ -40,7 +41,7 @@ namespace blacharze UpDate.Id = id; UpDate.StartingPack(); - UpDate.ItemBoxUpDate(); + UpDate.ItemBoxUpDate(0); } @@ -86,7 +87,7 @@ namespace blacharze ListaBox.Items.RemoveAt(Index); UpDate.DeleteLines(Index); UpDate.FixIdAfterRemove(); - UpDate.ItemBoxUpDate(); + UpDate.ItemBoxUpDate(0); // UpDate.DeleteLines(int.Parse(id.Content)); } @@ -120,6 +121,20 @@ namespace blacharze + } + + private void Search(object sender, RoutedEventArgs e) + { + if (Application.Current.Windows.OfType<SearchWindow>().Any()) + { + + } + else + { + + SearchWindow searchWin = new SearchWindow(); + searchWin.Show(); + } } } } \ No newline at end of file diff --git a/ModifyWin.xaml b/ModifyWin.xaml index 7c146fd..c475d77 100644 --- a/ModifyWin.xaml +++ b/ModifyWin.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wtf" mc:Ignorable="d" - Title="ModifyWin" Height="500" Width="450" + Title="ModifyWin" Height="512" Width="450" Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> @@ -89,7 +89,7 @@ <CheckBox x:Name="C" Content="C"/> </StackPanel> - <Button Content="ZatwiedĹş" Grid.Row="6" Background="Orange" Style="{StaticResource CustomButton}" Width="154" Click="Accept" Grid.Column="2" Margin="16,11,0,1" HorizontalAlignment="Left"/> + <Button Content="ZatwiedĹş" Grid.Row="6" Height="30" Background="Orange" Style="{StaticResource CustomButton}" Width="154" Click="Accept" Grid.Column="2" Margin="16,11,0,1" HorizontalAlignment="Left"/> <Button Content="Anuluj" Grid.Row="6" Background="Red" Style="{StaticResource CustomButton}" Width="154" Click="Cancle" Margin="0,11,0,1"/> </Grid> <Button Content="Reset" Style="{StaticResource CustomButton}" Click="Reset" Margin="0,55,0,0" VerticalAlignment="Top" Width="50"/> diff --git a/SearchWindow.xaml b/SearchWindow.xaml new file mode 100644 index 0000000..73b5b78 --- /dev/null +++ b/SearchWindow.xaml @@ -0,0 +1,76 @@ +ďťż<Window x:Class="wtf.SearchWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:wtf" + mc:Ignorable="d" + Title="Search Window" Height="294" Width="450" +Background="#F3F6F9"> + <Window.Resources> + <Style x:Key="CustomTextBox" TargetType="TextBox"> + <Setter Property="Margin" Value="10"/> + <Setter Property="Padding" Value="5"/> + <Setter Property="FontSize" Value="14"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="BorderBrush" Value="#D1D1D1"/> + <Setter Property="BorderThickness" Value="1"/> + <Setter Property="Background" Value="White"/> + <Setter Property="Foreground" Value="Black"/> + </Style> + + <Style TargetType="Button" x:Key="CustomButton"> + <Setter Property="Background" Value="#4CAF50"/> + <Setter Property="Foreground" Value="White"/> + <Setter Property="FontSize" Value="16"/> + <Setter Property="Padding" Value="10,5"/> + <Setter Property="Margin" Value="10"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="HorizontalAlignment" Value="Center"/> + <Setter Property="Cursor" Value="Hand"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{TemplateBinding Background}" CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </Window.Resources> + + <Grid Margin="0,0,0,22"> + <Border Background="LightBlue" Height="50" VerticalAlignment="Top"> + <TextBlock Foreground="White" FontSize="20" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Wyszukaj Kierowce"/> + </Border> + + <Grid Margin="20,80,20,-29"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="205*"/> + <ColumnDefinition Width="9*"/> + <ColumnDefinition Width="196*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + <RowDefinition Height="Auto"/> + + </Grid.RowDefinitions> + <TextBox x:Name="Fraza" Grid.Row="0" Style="{StaticResource CustomTextBox}" Margin="26,10,10,10" Grid.ColumnSpan="3"/> + <StackPanel Grid.Row="5" Grid.Column="0" Orientation="Vertical" Margin="56,4,1,4"> + <Label Content="Szukaj po:" Width="148"/> + <RadioButton x:Name="Imie" Content="Imie" GroupName="ss" Width="148" RenderTransformOrigin="0.315,0.588" /> + <RadioButton x:Name="Miasto" Content="Miasto" GroupName="ss"/> + </StackPanel> + + <Button Content="Szukaj" Grid.Row="6" Background="CadetBlue" Style="{StaticResource CustomButton}" Height="30" Width="154" Click="Accept" Grid.Column="2" Margin="16,11,0,1" HorizontalAlignment="Left"/> + <Button Content="Anuluj" Grid.Row="6" Background="DarkBlue" Style="{StaticResource CustomButton}" Width="154" Click="Cancle" Margin="0,11,0,1"/> + </Grid> + <Label Content="WprowadĹş frazÄ do wyszukania" HorizontalAlignment="Center" Margin="0,62,0,0" VerticalAlignment="Top"/> + </Grid> +</Window> diff --git a/SearchWindow.xaml.cs b/SearchWindow.xaml.cs new file mode 100644 index 0000000..802aa6f --- /dev/null +++ b/SearchWindow.xaml.cs @@ -0,0 +1,54 @@ +ďťżusing blacharze; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace wtf +{ + /// <summary> + /// Logika interakcji dla klasy SearchWindow.xaml + /// </summary> + public partial class SearchWindow : Window + { + public SearchWindow() + { + InitializeComponent(); + Miasto.IsChecked = true; + } + + private void Accept(object sender, RoutedEventArgs e) + { + string fraza = Fraza.Text; + bool ifMiasto; + if (Miasto.IsChecked==true) + { + ifMiasto= true; + } + else + { + ifMiasto = false; + } + UpDate.ShowAfterSearch(fraza, ifMiasto); + Close(); + + } + + private void Cancle(object sender, RoutedEventArgs e) + { + Close(); + + } + + + } +} diff --git a/SecWin.xaml b/SecWin.xaml index da13014..88f4919 100644 --- a/SecWin.xaml +++ b/SecWin.xaml @@ -2,7 +2,7 @@ x:Class="blacharze.SecWin" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - Title="Dodaj KierowcÄ" Height="500" Width="450" + Title="Dodaj KierowcÄ" Height="512" Width="450" Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> @@ -37,7 +37,7 @@ </Style> </Window.Resources> - <Grid> + <Grid Margin="0,0,0,-6"> <Border Background="#4CAF50" Height="50" VerticalAlignment="Top"> <TextBlock Text="Dodaj KierowcÄ" Foreground="White" FontSize="20" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> @@ -85,7 +85,7 @@ <CheckBox x:Name="C" Content="C"/> </StackPanel> - <Button Content="Dodaj KierowcÄ" Grid.Row="6" Grid.ColumnSpan="2" Style="{StaticResource CustomButton}" Width="200" Click="Button_Click"/> + <Button Content="Dodaj KierowcÄ" Height="30" Grid.Row="6" Grid.ColumnSpan="2" Style="{StaticResource CustomButton}" Width="200" Click="Button_Click"/> </Grid> </Grid> </Window> \ No newline at end of file diff --git a/SecWin.xaml.cs b/SecWin.xaml.cs index e9c3cbf..d3e3750 100644 --- a/SecWin.xaml.cs +++ b/SecWin.xaml.cs @@ -52,7 +52,7 @@ namespace blacharze { writer.WriteLine(ToFile); } - UpDate.ItemBoxUpDate(); + UpDate.ItemBoxUpDate(0); Winn.Close(); } diff --git a/UpDate.cs b/UpDate.cs index 8c3a584..e80eb04 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -10,7 +10,8 @@ namespace blacharze { internal class UpDate { - public static ListBox ListaBox = new ListBox(); + public static ListBox[] ListaBox = new ListBox[2]; + public static int numberOfLines; public static TextBox[] TabP = new TextBox[3]; public static CheckBox[] TabC = new CheckBox[3]; @@ -92,7 +93,7 @@ namespace blacharze Id.Content = "-1"; - ItemBoxUpDate(); + ItemBoxUpDate(0); } public static string[,] GetToListFile() @@ -115,12 +116,50 @@ namespace blacharze return list; } - public static void ItemBoxUpDate() + public static void ShowAfterSearch(string fraza, bool ifMiasto) + { + string[,] list = GetToListFile(); + + ListaBox[1].Items.Clear(); + int ktr = 0; + if (ifMiasto) + { + ktr = 3; + } + + for (int i = 0; i < numberOfLines; i++) + { + string nameAndSec = ""; + if (list[i, ktr] == fraza) + { + for (int j = 0; j < 3; j++) + { + + if (j == 2) + { + nameAndSec = list[i, 9] + "." + nameAndSec; + } + else + { + nameAndSec = nameAndSec + list[i, j] + " "; + + } + + } + ListaBox[1].Items.Add(nameAndSec); + } + + + + } + } + + public static void ItemBoxUpDate(int wl) { string[,] list = GetToListFile(); - - ListaBox.Items.Clear(); + + ListaBox[wl].Items.Clear(); for (int i = 0; i < numberOfLines; i++) { @@ -139,7 +178,7 @@ namespace blacharze } - ListaBox.Items.Add(nameAndSec); + ListaBox[wl].Items.Add(nameAndSec); } diff --git a/wtf.csproj b/wtf.csproj index 8a8833a..dcecc53 100644 --- a/wtf.csproj +++ b/wtf.csproj @@ -59,6 +59,9 @@ <DependentUpon>ModifyWin.xaml</DependentUpon> </Compile> <Compile Include="mWinUpDate.cs" /> + <Compile Include="SearchWindow.xaml.cs"> + <DependentUpon>SearchWindow.xaml</DependentUpon> + </Compile> <Compile Include="SecWin.xaml.cs"> <DependentUpon>SecWin.xaml</DependentUpon> </Compile> @@ -79,6 +82,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="SearchWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="SecWin.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> -- GitLab From a1df055ccd17aa13f5fa79376c8997da8fc01f7e Mon Sep 17 00:00:00 2001 From: uczen <jajo@gmail.com> Date: Thu, 16 Jan 2025 12:23:43 +0100 Subject: [PATCH 4/9] jeszcze do konca nie dzial tworzenie pliku w przypadku jego braku ale bedzie guczi --- ListaOs.txt | 40 ++++++++++++++++++++++++++++++++++++++++ MainWindow.xaml | 6 +++--- MainWindow.xaml.cs | 16 +++++++++++++--- ModifyWin.xaml | 2 +- UpDate.cs | 17 +++++++++++++++-- 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 ListaOs.txt diff --git a/ListaOs.txt b/ListaOs.txt new file mode 100644 index 0000000..f81d9c4 --- /dev/null +++ b/ListaOs.txt @@ -0,0 +1,40 @@ +Maciej,SzymaĹski,26-400,Gdynia,Spokojna,m,0,0,1,1 +Agnieszka,KrĂłl,27-450,Koszalin,Wodna,f,1,0,1,2 +Grzegorz,Adamski,28-500,CzÄstochowa,Zachodnia,m,1,1,1,3 +Karolina,WesoĹowska,29-550,Bydgoszcz,PoĹudniowa,f,0,0,0,4 +Ĺukasz,Pawlak,30-600,BiaĹystok,Jasna,m,0,1,0,5 +Ewa,WiĹniewska,20-400,GdaĹsk,Jasna,f,1,1,0,6 +MichaĹ,Morawiecki,11-500,WrocĹaw,SĹonec,m,1,0,0,7 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,8 +Krzysztof,Kowalski,13-300,Lubin,Pogodna,m,0,1,0,9 +Ewa,WiĹniewska,20-400,GdaĹsk,Morska,f,1,1,0,10 +MichaĹ,ZieliĹski,11-500,WrocĹaw,SĹoneczna,m,0,0,1,11 +Katarzyna,KamiĹska,12-600,Warszawa,LeĹna,f,1,1,1,12 +Tomasz,WĂłjcik,14-700,KrakĂłw,Zamkowa,m,0,1,0,13 +Alicja,Kowalczyk,16-800,PoznaĹ,Ogrodowa,f,1,0,1,14 +Piotr,Lewandowski,18-900,Lublin,Parkowa,m,0,0,1,15 +Maria,DÄ browska,19-100,Szczecin,Róşana,f,1,1,0,16 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,17 +Olga,Majewska,21-150,ĹĂłdĹş,KrĂłtka,f,0,1,0,18 +Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,19 +Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,20 +PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,21 +Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,22 +Adam,Kaban,12-12,Opole,Cicha,f,1,1,1,23 +Mamma,Mia,1111111,Opole,WÄ ska,m,1,1,1,24 +asda,asd,dsa,das,dsa,k,0,1,0,25 +MichaĹ,Morawiecki,11-500,WrocĹaw,ZĹota,m,1,1,0,26 +Agnieszka,KrĂłl,27-450,Koszalin,LeĹna,f,0,0,1,27 +Grzegorz,Adamski,28-500,CzÄstochowa,Nowa,m,1,0,1,28 +Karolina,WesoĹowska,29-550,Bydgoszcz,Zimowa,f,0,1,0,29 +Ĺukasz,Pawlak,30-600,BiaĹystok,Ĺrodkowa,m,0,0,1,30 +Ewa,WiĹniewska,20-400,GdaĹsk,TÄczowa,f,1,1,1,31 +Jan,Piotrowski,17-101,Kielce,SĹoneczna,m,1,0,0,32 +Krzysztof,Kowalski,13-300,Lubin,ZĹota,m,0,1,1,33 +Alicja,Kowalczyk,16-800,PoznaĹ,Kwiatowa,f,0,0,1,34 +Piotr,Lewandowski,18-900,Lublin,PiÄkna,m,1,1,0,35 +Maria,DÄ browska,19-100,Szczecin,RozkwitĹa,f,1,0,1,36 +Zofia,Kaczmarek,23-250,ZamoĹÄ,GĹĂłwna,f,1,0,0,37 +PaweĹ,Malinowski,24-300,RzeszĂłw,Nowa,m,0,1,1,38 +Barbara,Kubiak,25-350,Opole,Wilgotna,f,1,1,0,39 +Adam,Kaban,12-12,Opole,Cicha,f,0,0,1,40 diff --git a/MainWindow.xaml b/MainWindow.xaml index 0df21c8..325f087 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -4,7 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Title="Dodaj KierowcÄ" Height="400" Width="600" + Title="Dodaj KierowcÄ" Height="400" Width="600" ResizeMode="NoResize" Background="#F3F4F6"> <Window.Resources> @@ -110,8 +110,8 @@ <Button Content="Dodaj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Button_Click" Grid.Column="1" HorizontalAlignment="Left" Margin="269,-8,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> <Button Content="UsuĹ KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Usun" Grid.Column="1" HorizontalAlignment="Left" Margin="269,82,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> <Button Content="Modyfikuj KierowcÄ" Style="{StaticResource RoundedButton}" Width="150" Height="40" Click="Modify" Grid.Column="1" HorizontalAlignment="Left" Margin="269,37,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/> - <Button Content="Szukaj KierowcÄ" Click="Search" Grid.Column="1" Margin="73,156,35,97"/> - <ListBox Grid.Column="1" Margin="73,180,35,22" x:Name="SearchList" BorderBrush="#CCC" BorderThickness="1" SelectionChanged="ListaBox_SelectionChanged"/> + <Button Content="Szukaj KierowcÄ" Style="{StaticResource RoundedButton}" Click="Search" Grid.Column="1" Margin="269,127,0,0" HorizontalAlignment="Left" Width="150" Height="40" VerticalAlignment="Top" Grid.ColumnSpan="2"/> + <ListBox Grid.Column="1" Margin="78,154,30,48" x:Name="SearchList" BorderBrush="#CCC" BorderThickness="1" SelectionChanged="ListaBox_SelectionChanged"/> </Grid> <Label x:Name="id" Content="Label" Visibility="Hidden" HorizontalAlignment="Left" Margin="507,51,0,0" VerticalAlignment="Top"/> </Grid> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 278d1db..4686418 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -64,12 +64,22 @@ namespace blacharze } private void ListaBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { - - if (ListaBox.SelectedItem != null) + + ListBox lll = sender as ListBox; + if (lll.SelectedIndex != -1) { + string imienazwisko = lll.SelectedItem?.ToString(); + int i = int.Parse(imienazwisko.Split('.')[0]); + + ModifyWin.id = int.Parse(id.Content.ToString()); - UpDate.PrintInfo(ListaBox.SelectedIndex); + + + UpDate.PrintInfo(i - 1); } + + + } private void Usun(object sender, RoutedEventArgs e) diff --git a/ModifyWin.xaml b/ModifyWin.xaml index c475d77..5a3f7f0 100644 --- a/ModifyWin.xaml +++ b/ModifyWin.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wtf" mc:Ignorable="d" - Title="ModifyWin" Height="512" Width="450" + Title="ModifyWin" Height="512" Width="450" ResizeMode="NoResize" Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> diff --git a/UpDate.cs b/UpDate.cs index e80eb04..58c2d57 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -20,6 +20,7 @@ namespace blacharze public static void StartingPack() { + FileCheck(); FixIdAfterRemove(); RefreshGui(); } @@ -42,8 +43,9 @@ namespace blacharze - string[,] list = UpDate.GetToListFile(); - + string[,] list = UpDate.GetToListFile(); + + @@ -77,6 +79,15 @@ namespace blacharze File.WriteAllLines("ListaOs.txt", linesList.ToArray()); RefreshGui(); } + public static void FileCheck() + { + if (!File.Exists("ListaOs.txt")) + { + + File.Create("ListaOs.txt"); + + } + } public static void RefreshGui() { TabP[0].Text = "ImiÄ"; @@ -98,6 +109,8 @@ namespace blacharze public static string[,] GetToListFile() { + + numberOfLines = File.ReadAllLines("ListaOs.txt").Length; string[,] list = new string[numberOfLines, 10]; -- GitLab From f5cf5db5a3bb6b7b8785fa4044828d5aa931aa68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20St=C4=99pie=C5=84?= <krystian.stepen@gmail.com> Date: Thu, 16 Jan 2025 16:37:44 +0100 Subject: [PATCH 5/9] =?UTF-8?q?Program=20dzia=C5=82a=20w=20pe=C5=82ni,=20b?= =?UTF-8?q?=C5=82=C4=99d=C3=B3w=20na=20razie=20nie=20znalaz=C5=82em=20to?= =?UTF-8?q?=20nie=20jest=20raczej=20ostatni=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaOs.txt | 55 +++++++++++++++----------------------------- MainWindow.xaml.cs | 2 +- SearchWindow.xaml.cs | 4 +++- SecWin.xaml.cs | 10 +++++--- UpDate.cs | 17 ++++++++++---- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/ListaOs.txt b/ListaOs.txt index f81d9c4..fd01072 100644 --- a/ListaOs.txt +++ b/ListaOs.txt @@ -1,40 +1,21 @@ Maciej,SzymaĹski,26-400,Gdynia,Spokojna,m,0,0,1,1 Agnieszka,KrĂłl,27-450,Koszalin,Wodna,f,1,0,1,2 Grzegorz,Adamski,28-500,CzÄstochowa,Zachodnia,m,1,1,1,3 -Karolina,WesoĹowska,29-550,Bydgoszcz,PoĹudniowa,f,0,0,0,4 -Ĺukasz,Pawlak,30-600,BiaĹystok,Jasna,m,0,1,0,5 -Ewa,WiĹniewska,20-400,GdaĹsk,Jasna,f,1,1,0,6 -MichaĹ,Morawiecki,11-500,WrocĹaw,SĹonec,m,1,0,0,7 -Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,8 -Krzysztof,Kowalski,13-300,Lubin,Pogodna,m,0,1,0,9 -Ewa,WiĹniewska,20-400,GdaĹsk,Morska,f,1,1,0,10 -MichaĹ,ZieliĹski,11-500,WrocĹaw,SĹoneczna,m,0,0,1,11 -Katarzyna,KamiĹska,12-600,Warszawa,LeĹna,f,1,1,1,12 -Tomasz,WĂłjcik,14-700,KrakĂłw,Zamkowa,m,0,1,0,13 -Alicja,Kowalczyk,16-800,PoznaĹ,Ogrodowa,f,1,0,1,14 -Piotr,Lewandowski,18-900,Lublin,Parkowa,m,0,0,1,15 -Maria,DÄ browska,19-100,Szczecin,Róşana,f,1,1,0,16 -Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,17 -Olga,Majewska,21-150,ĹĂłdĹş,KrĂłtka,f,0,1,0,18 -Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,19 -Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,20 -PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,21 -Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,22 -Adam,Kaban,12-12,Opole,Cicha,f,1,1,1,23 -Mamma,Mia,1111111,Opole,WÄ ska,m,1,1,1,24 -asda,asd,dsa,das,dsa,k,0,1,0,25 -MichaĹ,Morawiecki,11-500,WrocĹaw,ZĹota,m,1,1,0,26 -Agnieszka,KrĂłl,27-450,Koszalin,LeĹna,f,0,0,1,27 -Grzegorz,Adamski,28-500,CzÄstochowa,Nowa,m,1,0,1,28 -Karolina,WesoĹowska,29-550,Bydgoszcz,Zimowa,f,0,1,0,29 -Ĺukasz,Pawlak,30-600,BiaĹystok,Ĺrodkowa,m,0,0,1,30 -Ewa,WiĹniewska,20-400,GdaĹsk,TÄczowa,f,1,1,1,31 -Jan,Piotrowski,17-101,Kielce,SĹoneczna,m,1,0,0,32 -Krzysztof,Kowalski,13-300,Lubin,ZĹota,m,0,1,1,33 -Alicja,Kowalczyk,16-800,PoznaĹ,Kwiatowa,f,0,0,1,34 -Piotr,Lewandowski,18-900,Lublin,PiÄkna,m,1,1,0,35 -Maria,DÄ browska,19-100,Szczecin,RozkwitĹa,f,1,0,1,36 -Zofia,Kaczmarek,23-250,ZamoĹÄ,GĹĂłwna,f,1,0,0,37 -PaweĹ,Malinowski,24-300,RzeszĂłw,Nowa,m,0,1,1,38 -Barbara,Kubiak,25-350,Opole,Wilgotna,f,1,1,0,39 -Adam,Kaban,12-12,Opole,Cicha,f,0,0,1,40 +Ĺukasz,Pawlak,30-600,BiaĹystok,Jasna,m,0,1,0,4 +Ewa,WiĹniewska,20-400,GdaĹsk,Jasna,f,1,1,0,5 +MichaĹ,Morawiecki,11-500,WrocĹaw,SĹoneczna,m,1,0,0,6 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,7 +Krzysztof,Kowalski,13-300,Lubin,Pogodna,m,0,1,0,8 +Ewa,WiĹniewska,20-400,GdaĹsk,Morska,f,1,1,0,9 +MichaĹ,ZieliĹski,11-500,WrocĹaw,SĹoneczna,m,0,0,1,10 +Katarzyna,KamiĹska,12-600,Warszawa,LeĹna,f,1,1,1,11 +Tomasz,WĂłjcik,14-700,KrakĂłw,Zamkowa,m,0,1,0,12 +Alicja,Kowalczyk,16-800,PoznaĹ,Ogrodowa,f,1,0,1,13 +Piotr,Lewandowski,18-900,Lublin,Parkowa,m,0,0,1,14 +Maria,DÄ browska,19-100,Szczecin,Róşana,f,1,1,0,15 +Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,16 +Olga,Majewska,21-150,ĹĂłdĹş,KrĂłtka,f,0,1,0,17 +Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,18 +Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,19 +PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,20 +Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,21 diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 4686418..498bda9 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -39,9 +39,9 @@ namespace blacharze UpDate.TabR[0] = Mezczyzna; UpDate.TabR[1] = Kobieta; UpDate.Id = id; - UpDate.StartingPack(); UpDate.ItemBoxUpDate(0); + SearchList.Visibility = Visibility.Hidden; } diff --git a/SearchWindow.xaml.cs b/SearchWindow.xaml.cs index 802aa6f..d91db7e 100644 --- a/SearchWindow.xaml.cs +++ b/SearchWindow.xaml.cs @@ -38,8 +38,10 @@ namespace wtf { ifMiasto = false; } - UpDate.ShowAfterSearch(fraza, ifMiasto); Close(); + UpDate.ShowAfterSearch(fraza, ifMiasto); + + } diff --git a/SecWin.xaml.cs b/SecWin.xaml.cs index d3e3750..152e1d0 100644 --- a/SecWin.xaml.cs +++ b/SecWin.xaml.cs @@ -44,16 +44,20 @@ namespace blacharze if (A.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; if (B.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; if (C.IsChecked == true) { ToFile = ToFile + "1"; } else { ToFile = ToFile + "0"; }; - var lastLine = File.ReadLines("ListaOs.txt").Last(); + // var lastLine = File.ReadLines("ListaOs.txt").Last(); + // ToFile = ToFile + "," + (int.Parse(lastLine.Split(',')[9]) + 1).ToString(); + ToFile = ToFile + "," + "0"; - ToFile = ToFile +"," +(int.Parse(lastLine.Split(',')[9]) + 1).ToString(); + + using (StreamWriter writer = new StreamWriter("ListaOs.txt", true)) { writer.WriteLine(ToFile); } + UpDate.FixIdAfterRemove(); UpDate.ItemBoxUpDate(0); - + Winn.Close(); } else diff --git a/UpDate.cs b/UpDate.cs index 58c2d57..e19ed73 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Controls; using System.IO; using wtf; +using System.Windows; namespace blacharze { internal class UpDate @@ -17,7 +18,7 @@ namespace blacharze public static CheckBox[] TabC = new CheckBox[3]; public static RadioButton[] TabR = new RadioButton[2]; public static Label Id = new Label(); - + public static void StartingPack() { FileCheck(); @@ -83,8 +84,9 @@ namespace blacharze { if (!File.Exists("ListaOs.txt")) { + using (File.Create("ListaOs.txt")) { } - File.Create("ListaOs.txt"); + } } @@ -139,7 +141,7 @@ namespace blacharze { ktr = 3; } - + int x = 0; for (int i = 0; i < numberOfLines; i++) { string nameAndSec = ""; @@ -157,7 +159,7 @@ namespace blacharze nameAndSec = nameAndSec + list[i, j] + " "; } - + x++; } ListaBox[1].Items.Add(nameAndSec); } @@ -165,6 +167,13 @@ namespace blacharze } + if(x == 0) + { + MessageBox.Show("Brak wynikĂłw"); + ListaBox[1].Visibility = Visibility.Hidden; + } + else { ListaBox[1].Visibility = Visibility.Visible; } + } public static void ItemBoxUpDate(int wl) -- GitLab From 89d3b9efd6f5b84a9c08f6e3fd487e11ece0a82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20St=C4=99pie=C5=84?= <krystian.stepen@gmail.com> Date: Thu, 16 Jan 2025 17:25:08 +0100 Subject: [PATCH 6/9] =?UTF-8?q?commit=20bo=20sprawdzam=20czy=20dzia=C5=82a?= =?UTF-8?q?=20ikona=20pzdr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWindow.xaml | 6 ++++-- MainWindow.xaml.cs | 1 + myIcon.ico | Bin 0 -> 67646 bytes 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 myIcon.ico diff --git a/MainWindow.xaml b/MainWindow.xaml index 325f087..ba91adf 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -5,7 +5,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="Dodaj KierowcÄ" Height="400" Width="600" ResizeMode="NoResize" - Background="#F3F4F6"> + Background="#F3F4F6" + + > <Window.Resources> <Style x:Key="RoundedButton" TargetType="Button"> @@ -100,7 +102,7 @@ <ListBox Grid.Column="0" Margin="21,0,229,20" x:Name="ListaBox" BorderBrush="#CCC" BorderThickness="1" Grid.ColumnSpan="2" SelectionChanged="ListaBox_SelectionChanged"/> - <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" Width="144"> + <StackPanel Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="144" Margin="88,-2,0,0"> <RadioButton IsEnabled="False" x:Name="Kobieta" Content="Kobieta" FontSize="16" Margin="5"/> <RadioButton IsEnabled="False" x:Name="Mezczyzna" Content="MÄĹźczyzna" FontSize="16" Margin="5"/> <CheckBox IsEnabled="False" x:Name="A" Content="A" FontSize="16" Margin="5"/> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 498bda9..2d1d487 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -62,6 +62,7 @@ namespace blacharze } + private void ListaBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { diff --git a/myIcon.ico b/myIcon.ico new file mode 100644 index 0000000000000000000000000000000000000000..45827f9588cfd184f56aeae830b71ffba9939ef1 GIT binary patch literal 67646 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 literal 0 HcmV?d00001 -- GitLab From 00a915c64c87e3eb2e63640bb6cc6911fa5087d9 Mon Sep 17 00:00:00 2001 From: uczen <jajo@gmail.com> Date: Fri, 17 Jan 2025 13:12:32 +0100 Subject: [PATCH 7/9] =?UTF-8?q?Co=C5=9B=20tam=20dodane,=20da=20si=C4=99=20?= =?UTF-8?q?wybierac=20do=20usuniecia=20z=20searchlista.=20Jakie=C5=9B=20b?= =?UTF-8?q?=C5=82=C4=99dy=20naprawiane.=20Trzeba=20jeszcze=20modyfikacje?= =?UTF-8?q?=20z=20searchlisty=20i=20cos=20pewnie=20znajdzie=20sie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListaOs.txt | 21 --------------------- MainWindow.xaml | 4 ++-- MainWindow.xaml.cs | 42 ++++++++++++++++++++++++++++++++++-------- ModifyWin.xaml | 3 ++- SearchWindow.xaml | 3 ++- SearchWindow.xaml.cs | 2 +- SecWin.xaml | 3 ++- UpDate.cs | 19 +++++++++++-------- wtf.csproj | 3 +++ 9 files changed, 57 insertions(+), 43 deletions(-) delete mode 100644 ListaOs.txt diff --git a/ListaOs.txt b/ListaOs.txt deleted file mode 100644 index fd01072..0000000 --- a/ListaOs.txt +++ /dev/null @@ -1,21 +0,0 @@ -Maciej,SzymaĹski,26-400,Gdynia,Spokojna,m,0,0,1,1 -Agnieszka,KrĂłl,27-450,Koszalin,Wodna,f,1,0,1,2 -Grzegorz,Adamski,28-500,CzÄstochowa,Zachodnia,m,1,1,1,3 -Ĺukasz,Pawlak,30-600,BiaĹystok,Jasna,m,0,1,0,4 -Ewa,WiĹniewska,20-400,GdaĹsk,Jasna,f,1,1,0,5 -MichaĹ,Morawiecki,11-500,WrocĹaw,SĹoneczna,m,1,0,0,6 -Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,7 -Krzysztof,Kowalski,13-300,Lubin,Pogodna,m,0,1,0,8 -Ewa,WiĹniewska,20-400,GdaĹsk,Morska,f,1,1,0,9 -MichaĹ,ZieliĹski,11-500,WrocĹaw,SĹoneczna,m,0,0,1,10 -Katarzyna,KamiĹska,12-600,Warszawa,LeĹna,f,1,1,1,11 -Tomasz,WĂłjcik,14-700,KrakĂłw,Zamkowa,m,0,1,0,12 -Alicja,Kowalczyk,16-800,PoznaĹ,Ogrodowa,f,1,0,1,13 -Piotr,Lewandowski,18-900,Lublin,Parkowa,m,0,0,1,14 -Maria,DÄ browska,19-100,Szczecin,Róşana,f,1,1,0,15 -Jan,Piotrowski,17-101,Kielce,WspĂłlna,m,1,0,1,16 -Olga,Majewska,21-150,ĹĂłdĹş,KrĂłtka,f,0,1,0,17 -Andrzej,StÄpieĹ,22-200,ToruĹ,Szeroka,m,1,1,1,18 -Zofia,Kaczmarek,23-250,ZamoĹÄ,DĹuga,f,0,0,1,19 -PaweĹ,Malinowski,24-300,RzeszĂłw,Zielona,m,1,0,0,20 -Barbara,Kubiak,25-350,Opole,Cicha,f,1,1,0,21 diff --git a/MainWindow.xaml b/MainWindow.xaml index ba91adf..5056562 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -4,9 +4,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Title="Dodaj KierowcÄ" Height="400" Width="600" ResizeMode="NoResize" + Title="Kierowcy" Height="400" Width="600" ResizeMode="NoResize" Background="#F3F4F6" - + Icon="myIcon.ico" > <Window.Resources> diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 2d1d487..910a34b 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -85,20 +85,46 @@ namespace blacharze private void Usun(object sender, RoutedEventArgs e) { + int i = -1; + MessageBoxResult result = new MessageBoxResult(); if(ListaBox.SelectedItem == null) { - MessageBox.Show("Nie wybrano osoby do usuniÄcia"); - return; - } - MessageBoxResult result = MessageBox.Show("Czy na pewno chcesz usunÄ Ä?", "Potwierdzenie", MessageBoxButton.YesNo); + + + + if (SearchList.SelectedItem == null) + { + MessageBox.Show("Nie wybrano osoby do usuniÄcia"); + return; + } + else + { + result = MessageBox.Show("Czy na pewno chcesz usunÄ Ä?", "Potwierdzenie", MessageBoxButton.YesNo); + string imienazwisko = SearchList.SelectedItem?.ToString(); + i = int.Parse(imienazwisko.Split('.')[0]); + SearchList.Items.RemoveAt(SearchList.SelectedIndex); + } + + } + else + { + result = MessageBox.Show("Czy na pewno chcesz usunÄ Ä?", "Potwierdzenie", MessageBoxButton.YesNo); + string imienazwisko = ListaBox.SelectedItem?.ToString(); + i = int.Parse(imienazwisko.Split('.')[0]); + + } + + + if (result == MessageBoxResult.Yes) { + i = i - 1; // MessageBox.Show("Usuniete"); int Index = ListaBox.SelectedIndex; - ListaBox.Items.RemoveAt(Index); - UpDate.DeleteLines(Index); - UpDate.FixIdAfterRemove(); - UpDate.ItemBoxUpDate(0); + ListaBox.Items.RemoveAt(i); + + UpDate.DeleteLines(i); + UpDate.StartingPackAferRemove(); // UpDate.DeleteLines(int.Parse(id.Content)); } diff --git a/ModifyWin.xaml b/ModifyWin.xaml index 5a3f7f0..5eabc71 100644 --- a/ModifyWin.xaml +++ b/ModifyWin.xaml @@ -5,7 +5,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wtf" mc:Ignorable="d" - Title="ModifyWin" Height="512" Width="450" ResizeMode="NoResize" + Title="ModifyWin" Height="512" Width="450" ResizeMode="NoResize" Icon="myIcon.ico" + Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> diff --git a/SearchWindow.xaml b/SearchWindow.xaml index 73b5b78..9b724ba 100644 --- a/SearchWindow.xaml +++ b/SearchWindow.xaml @@ -4,7 +4,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wtf" - mc:Ignorable="d" + mc:Ignorable="d" Icon="myIcon.ico" + Title="Search Window" Height="294" Width="450" Background="#F3F6F9"> <Window.Resources> diff --git a/SearchWindow.xaml.cs b/SearchWindow.xaml.cs index d91db7e..31fe87a 100644 --- a/SearchWindow.xaml.cs +++ b/SearchWindow.xaml.cs @@ -23,7 +23,7 @@ namespace wtf public SearchWindow() { InitializeComponent(); - Miasto.IsChecked = true; + Imie.IsChecked = true; } private void Accept(object sender, RoutedEventArgs e) diff --git a/SecWin.xaml b/SecWin.xaml index 88f4919..9235143 100644 --- a/SecWin.xaml +++ b/SecWin.xaml @@ -2,7 +2,8 @@ x:Class="blacharze.SecWin" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - Title="Dodaj KierowcÄ" Height="512" Width="450" + Title="Dodaj KierowcÄ" Height="512" Width="450" Icon="myIcon.ico" + Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> diff --git a/UpDate.cs b/UpDate.cs index e19ed73..c9e78cc 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -20,7 +20,7 @@ namespace blacharze public static Label Id = new Label(); public static void StartingPack() - { + { FileCheck(); FixIdAfterRemove(); RefreshGui(); @@ -31,6 +31,13 @@ namespace blacharze PrintInfo(id); } + public static void StartingPackAferRemove() + { + UpDate.FixIdAfterRemove(); + UpDate.ItemBoxUpDate(0); + + } + public static void DeleteLines(int line) { string[] lines = File.ReadAllLines("ListaOs.txt"); @@ -41,16 +48,10 @@ namespace blacharze public static void PrintInfo(int id) { - - - string[,] list = UpDate.GetToListFile(); - - - TabP[0].Text = list[id, 0]; TabP[1].Text = list[id, 1]; string FullAdres = list[id, 2] + " " + list[id, 3] + " " + list[id, 4]; @@ -73,6 +74,7 @@ namespace blacharze List<string> linesList = new List<string>(lines); for (int i = 0; i < linesList.Count; i++) { + string[] line = linesList[i].Split(','); line[9] = (i+1).ToString(); linesList[i] = string.Join(",", line); @@ -84,7 +86,7 @@ namespace blacharze { if (!File.Exists("ListaOs.txt")) { - using (File.Create("ListaOs.txt")) { } + using (File.Create("ListaOs.txt")) { } @@ -136,6 +138,7 @@ namespace blacharze string[,] list = GetToListFile(); ListaBox[1].Items.Clear(); + ListaBox[0].UnselectAll(); int ktr = 0; if (ifMiasto) { diff --git a/wtf.csproj b/wtf.csproj index dcecc53..84f7f61 100644 --- a/wtf.csproj +++ b/wtf.csproj @@ -117,5 +117,8 @@ <ItemGroup> <None Include="App.config" /> </ItemGroup> + <ItemGroup> + <Resource Include="myIcon.ico" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file -- GitLab From a11fc0e284313062a1e2e24e18895aa465c0be35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20St=C4=99pie=C5=84?= <krystian.stepen@gmail.com> Date: Sun, 19 Jan 2025 21:18:19 +0100 Subject: [PATCH 8/9] =?UTF-8?q?Program=20dzia=C5=82a=20dobrze,=20da=20sie?= =?UTF-8?q?=20modyfikowac=20na=20search=20list.=20Na=20razie=20nie=20ma=20?= =?UTF-8?q?b=C5=82=C4=99d=C3=B3w.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWindow.xaml.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 910a34b..603f0c1 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -140,8 +140,13 @@ namespace blacharze if(ListaBox.SelectedItem == null) { - MessageBox.Show("Nie wybrano osoby do modyfikacji"); - return; + if (SearchList.SelectedItem == null) + { + + MessageBox.Show("Nie wybrano osoby do modyfikacji"); + return; + } + } if (Application.Current.Windows.OfType<ModifyWin>().Any()) @@ -154,9 +159,7 @@ namespace blacharze ModifyWin modifyWin = new ModifyWin(); modifyWin.Show(); } - - - + SearchList.Visibility = Visibility.Hidden; } -- GitLab From 44d8cd8608ad186a7273d8e1c394c640f4918384 Mon Sep 17 00:00:00 2001 From: uczen <jajo@gmail.com> Date: Mon, 20 Jan 2025 12:22:47 +0100 Subject: [PATCH 9/9] =?UTF-8?q?Usuni=C4=99cie=20niepotrzebnych=20linijek?= =?UTF-8?q?=20w=20kodzie.=20Wszystko=20dzia=C5=82a=20jak=20narazie.=20Mo?= =?UTF-8?q?=C5=BCliwe=20=C5=BCe,=20to=20ostatni=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MainWindow.xaml.cs | 19 +++++-------------- ModifyWin.xaml | 2 +- ModifyWin.xaml.cs | 6 ++---- SearchWindow.xaml | 2 +- SearchWindow.xaml.cs | 1 - SecWin.xaml.cs | 8 ++------ UpDate.cs | 1 - mWinUpDate.cs | 2 -- 8 files changed, 11 insertions(+), 30 deletions(-) diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 603f0c1..6986700 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -19,9 +19,7 @@ using static System.Collections.Specialized.BitVector32; namespace blacharze { - ///<summary> - /// Logika interakcji dla klasy MainWindow.xaml - ///</summary> + public partial class MainWindow : Window { @@ -49,7 +47,6 @@ namespace blacharze { - if (Application.Current.Windows.OfType<SecWin>().Any()) { @@ -78,9 +75,7 @@ namespace blacharze UpDate.PrintInfo(i - 1); } - - - + } private void Usun(object sender, RoutedEventArgs e) @@ -119,20 +114,16 @@ namespace blacharze if (result == MessageBoxResult.Yes) { i = i - 1; - // MessageBox.Show("Usuniete"); + int Index = ListaBox.SelectedIndex; ListaBox.Items.RemoveAt(i); UpDate.DeleteLines(i); UpDate.StartingPackAferRemove(); - // UpDate.DeleteLines(int.Parse(id.Content)); - - } - else - { - // MessageBox.Show("Nie usuniete"); + } + } private void Modify(object sender, RoutedEventArgs e) diff --git a/ModifyWin.xaml b/ModifyWin.xaml index 5eabc71..771c26d 100644 --- a/ModifyWin.xaml +++ b/ModifyWin.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wtf" mc:Ignorable="d" - Title="ModifyWin" Height="512" Width="450" ResizeMode="NoResize" Icon="myIcon.ico" + Title="Modyfikacja Kierowcy" Height="512" Width="450" ResizeMode="NoResize" Icon="myIcon.ico" Background="#F3F6F9"> <Window.Resources> diff --git a/ModifyWin.xaml.cs b/ModifyWin.xaml.cs index 7e33dc3..203713d 100644 --- a/ModifyWin.xaml.cs +++ b/ModifyWin.xaml.cs @@ -14,9 +14,7 @@ using System.Windows.Shapes; namespace wtf { - /// <summary> - /// Logika interakcji dla klasy ModifyWin.xaml - /// </summary> + public partial class ModifyWin : Window { public static int id; @@ -70,7 +68,7 @@ namespace wtf if (B.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; if (C.IsChecked == true) { ToFile = ToFile + "1"; } else { ToFile = ToFile + "0"; }; ToFile = ToFile + "," + id; - // MessageBox.Show(ToFile); + mWinUpDate.EditLineInFile(id - 1, ToFile); Close(); } diff --git a/SearchWindow.xaml b/SearchWindow.xaml index 9b724ba..80feb84 100644 --- a/SearchWindow.xaml +++ b/SearchWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:wtf" mc:Ignorable="d" Icon="myIcon.ico" - Title="Search Window" Height="294" Width="450" + Title="Szukaj Kierowce" Height="294" Width="450" Background="#F3F6F9"> <Window.Resources> <Style x:Key="CustomTextBox" TargetType="TextBox"> diff --git a/SearchWindow.xaml.cs b/SearchWindow.xaml.cs index 31fe87a..4282597 100644 --- a/SearchWindow.xaml.cs +++ b/SearchWindow.xaml.cs @@ -41,7 +41,6 @@ namespace wtf Close(); UpDate.ShowAfterSearch(fraza, ifMiasto); - } diff --git a/SecWin.xaml.cs b/SecWin.xaml.cs index 152e1d0..74b8897 100644 --- a/SecWin.xaml.cs +++ b/SecWin.xaml.cs @@ -21,11 +21,10 @@ namespace blacharze public SecWin() { InitializeComponent(); - + Kobieta.IsChecked = true; } - private void Button_Click(object sender, RoutedEventArgs e) { if (Imie.Text != "" && Nazwisko.Text != "" && Kod.Text != "" && Miasto.Text != "" && Ulica.Text != "") @@ -44,12 +43,9 @@ namespace blacharze if (A.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; if (B.IsChecked == true) { ToFile = ToFile + "1,"; } else { ToFile = ToFile + "0,"; }; if (C.IsChecked == true) { ToFile = ToFile + "1"; } else { ToFile = ToFile + "0"; }; - // var lastLine = File.ReadLines("ListaOs.txt").Last(); - // ToFile = ToFile + "," + (int.Parse(lastLine.Split(',')[9]) + 1).ToString(); + ToFile = ToFile + "," + "0"; - - using (StreamWriter writer = new StreamWriter("ListaOs.txt", true)) { diff --git a/UpDate.cs b/UpDate.cs index c9e78cc..1792c18 100644 --- a/UpDate.cs +++ b/UpDate.cs @@ -128,7 +128,6 @@ namespace blacharze list[i, j] = lineList[j]; } } - //df return list; } diff --git a/mWinUpDate.cs b/mWinUpDate.cs index ab42dee..47fcf57 100644 --- a/mWinUpDate.cs +++ b/mWinUpDate.cs @@ -17,7 +17,6 @@ namespace wtf public static CheckBox[] TabC = new CheckBox[3]; public static RadioButton[] TabR = new RadioButton[2]; - public static void FillModifyWin(int id) { string[,] list2 = UpDate.GetToListFile(); @@ -27,7 +26,6 @@ namespace wtf TabP[2].Text = list2[id, 2]; TabP[3].Text = list2[id, 3]; TabP[4].Text = list2[id, 4]; - // MessageBox.Show(list2[id, 0]+ list2[id, 1]+ list2[id, 2] + list2[id, 3] + list2[id, 4]+ list2[id, 5]+ list2[id, 6]+ list2[id, 7] + list2[id,8]); if (list2[id, 6] == "1") { TabC[0].IsChecked = true; -- GitLab