private void SetListResult(string baseName, List <string> choosen) { ListClassfy list = new ListClassfy(choosen, baseName); listResult = list.Classify(); listDescriptionResult = FileAdapter.GetDescripionToResult(listResult, baseName); string result = listResult + "\n" + listDescriptionResult; ListClassfyLabel.Text = result; }
private void AddDianoseCategory() { if (!FileAdapter.isEmpty(baseName)) { MessageBox.Show("Diagnoza już istnieje", "Error"); } else { FileAdapter.AddNewDiagnoseFile(baseName, CategoryTextBox.Text, Description.Text); } }
public Request(string baseName, List <string> choosen) { InitializeComponent(); this.indegrades = FileAdapter.GetIngredients("data\\" + baseName + ".boi"); Header.Content = indegrades[index][0]; indegrades[index].RemoveAt(0); OptionsComboBox.ItemsSource = indegrades[index]; Descriptions.Text = FileAdapter.GetDescripionToCategory(baseName, index); isFirst = false; this.choosen = choosen; this.baseName = baseName; }
public DelRule(string baseName) { InitializeComponent(); this.baseName = baseName; List <string[]> Rules = FileAdapter.GetAllRuleForDisplay(baseName); GoodRules = new List <string>(); foreach (string[] rule in Rules) { GoodRules.Add(rule[0] + " = " + rule[1]); } RuleComboBox.ItemsSource = GoodRules; }
public AddIngredence(string baseName) { InitializeComponent(); this.baseName = baseName; ListOfCategory = FileAdapter.GetAllCategory(baseName); try { ListOfCategory.Add(FileAdapter.GetDiagnoseName(baseName)); } catch { } Category.ItemsSource = ListOfCategory; }
private void Add_Click(object sender, RoutedEventArgs e) { string diagnose = ListOfCategory[ListOfCategory.Count - 1]; if (Category.Text == diagnose) { FileAdapter.SaveNewDiagnoseIngredient(baseName, Category.Text, Ingedence.Text, Description.Text); } else { FileAdapter.SaveNewIngredient(baseName, Category.Text, Ingedence.Text, Description.Text); } this.Close(); }
private void AddCategoryButton_Click(object sender, RoutedEventArgs e) { if (isDecisionClass.IsChecked == true) { AddDianoseCategory(); } else { FileAdapter.AddNewCategoryToFile(baseName, CategoryTextBox.Text, Description.Text /*, CopyPhoto(filePath)*/); FileAdapter.UpdateRules(baseName, CategoryTextBox.Text); } BaseEditor baseEditor = new BaseEditor(baseName); baseEditor.Show(); this.Close(); }
private void SetVoteResult(string baseName, List <string> choosen) { VoteClassfy vote = new VoteClassfy(choosen); voteResult = vote.Vote(baseName); string result = voteResult; try { voteDescriptionResult = FileAdapter.GetDescripionToResult(result.Split("\n")[1], baseName); result += voteDescriptionResult; } catch { } VoteClassfyLabel.Text = result; }
public AddRule(string baseName, List <string> listOfChoosen) { InitializeComponent(); this.baseName = baseName; this.listOfChoosen = listOfChoosen; try { ListOfIngredients = FileAdapter.GetIngredients("data\\" + baseName + ".boi"); ListOfDiagnose = FileAdapter.GetIngredients("data\\" + baseName + ".bod"); } catch { return; } SetCategoryInWindow(); }
public string Vote(string baseName) { List <List <string> > ind = FileAdapter.GetIngredients("data\\" + baseName + ".bod"); List <string> diagnose = ind[0]; int[] score = new int[diagnose.Count - 1]; int goodRule = 0; List <string> ListOfRules = FileAdapter.GetAllNotEditedRule(baseName); foreach (string rule in ListOfRules) { if (CheckRule(rule)) { goodRule++; string res = GetRuleResult(rule); try { score[diagnose.IndexOf(res)]++; } catch (Exception e) { MessageBox.Show(e.Message); } } } string message = "Błąd klasyfikacji"; if (goodRule == 0) { message = "nie znana reguła odpowiadająca podanym przesłankom"; } else { message = "Największą ilość głosów otrzymały diagnozy:\n"; string[] maxVoted = GetMaxVotedItems(score, diagnose); foreach (string item in maxVoted) { message += item + '\n'; } } return(message); }
private void RegisterButton_Click(object sender, RoutedEventArgs e) { string hashPassword = FileAdapter.ComputeSha256Hash(PasswordBox.Password); Admin newAdmin = new Admin(LoginTextBox.Text, hashPassword, BaseNameTextBox.Text, PasswordHintTextBox.Text, BaseDescriptionTextBox.Text); if (!File.Exists("data\\" + newAdmin.baseName + ".bok")) { bool isUniqLogin = true; foreach (Admin adm in admins) { if (adm.name == newAdmin.name) { MessageBox.Show("Taki login jest już zajęty"); isUniqLogin = false; break; } } if (isUniqLogin && PassCheck()) { admins.Add(newAdmin); List <string> ListOfAdminsString = new List <string>(); foreach (Admin admin in admins) { ListOfAdminsString.Add(admin.ToCodedString()); } File.WriteAllLines("data\\admin.ame", ListOfAdminsString); CreateFiles(newAdmin); BaseEditor baseEditor = new BaseEditor(newAdmin.baseName); baseEditor.Show(); this.Close(); } else { MessageBox.Show("Hasła nie są poprawne"); } } else { MessageBox.Show("Baza już istnieje!"); } }
private void DelBase_Click(object sender, RoutedEventArgs e) { string message = "Czy napewno chcesz usunąć całą baze? \n operacja jest nie odwracalna, wszystkie pliki zostaną usunięte a konto administratora zniknie"; if (MessageBox.Show(message, "Usuwanie", MessageBoxButton.YesNo, MessageBoxImage.Stop, MessageBoxResult.No) == MessageBoxResult.Yes) { if (MessageBox.Show("Ale na pewno?", "Usuwanie", MessageBoxButton.YesNo, MessageBoxImage.Stop, MessageBoxResult.No) == MessageBoxResult.Yes) { if (FileAdapter.DeletingBase(baseName)) { MessageBox.Show("Udało się", "Usunięto", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Something went not yes", "Usunięto", MessageBoxButton.OK, MessageBoxImage.Warning); } new MainWindow().Show(); this.Close(); } } }
private void DeleteRule() { string choosenRule = RuleComboBox.Text; if (choosenRule == "") { return; } if (MessageBox.Show("Czy napewno chcesz usunąć tą regułę ?? \n" + RuleComboBox.Text, "Usuwanie", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No, MessageBoxOptions.None) == MessageBoxResult.Yes) { int index = IndexOfRule(choosenRule); if (index != -1) { FileAdapter.DeletingRule(baseName, index); } else { MessageBox.Show("Błąd usuwania", "Error", MessageBoxButton.OK, MessageBoxImage.Hand); } } }
private void GetHintButton_Click(object sender, RoutedEventArgs e) { List <Admin> admins = FileAdapter.GetAllAdmins(); string loginStr = login.Text; bool isLoginCorrect = false; string hint = ""; foreach (Admin admin in admins) { if (admin.name == loginStr) { isLoginCorrect = true; hint = admin.hint; MessageBox.Show("Podpowiedź brzmi: " + hint, "Podpowiedź", MessageBoxButton.OK, MessageBoxImage.Information); break; } } if (!isLoginCorrect) { MessageBox.Show("Zły login", "Błąd Loginu", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Confirm_Click(object sender, RoutedEventArgs e) { if (OptionsComboBox.Text == "" && isFirst) { MessageBox.Show("Nie wybrałeś bazy"); return; } if (isFirst) { new Request(OptionsComboBox.Text, new List <string>()).Show(); this.Close(); } else { choosen.Add(OptionsComboBox.Text); this.Visibility = Visibility.Hidden; index++; try { Header.Content = indegrades[index][0]; indegrades[index].RemoveAt(0); OptionsComboBox.ItemsSource = indegrades[index]; OptionsComboBox.SelectedIndex = indegrades.Count - 1; Descriptions.Text = FileAdapter.GetDescripionToCategory(baseName, index); } catch { } this.Visibility = Visibility.Visible; //// if (index == indegrades.Count) { this.Hide(); new Sumup(baseName, choosen).Show(); this.Close(); } } }
public RegisterScreen() { InitializeComponent(); this.admins = FileAdapter.GetAllAdmins(); }