private void Calculator_Mode_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Calculator_Mode_Option_Command>(); Calculator_Mode New_Calculator_Mode = (Calculator_Mode)Calculator_Mode_List_ComboBox.SelectedIndex; if (New_Calculator_Mode != Options_Provider.Calculator_Mode) { Option_Change_Command_List.Add(new Change_Calculator_Mode_Option_Command(New_Calculator_Mode)); } }
private void Calculation_Method_List_ComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Calculation_Method_Option_Command>(); Calculation_Method New_Calculation_Method = (Calculation_Method)Calculation_Method_List_ComboBox.SelectedIndex; if (New_Calculation_Method != Options_Provider.Calculation_Method) { Option_Change_Command_List.Add(new Change_Calculation_Method_Option_Command(New_Calculation_Method)); } }
private void Language_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Language_Option_Command>(); Languages New_Language = (Languages)Language_List_ComboBox.SelectedIndex; if (New_Language != Options_Provider.Current_Language) { Option_Change_Command_List.Add(new Change_Language_Option_Command(New_Language)); } }
private void Number_Notation_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Number_Notation_Option_Command>(); Number_Notation New_Number_Notation = (Number_Notation)Number_Notation_List_ComboBox.SelectedIndex; if (New_Number_Notation != Options_Provider.Number_Notation) { Option_Change_Command_List.Add(new Change_Number_Notation_Option_Command(New_Number_Notation)); } }
private void Font_Size_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Font_Size_Option_Command>(); Font_Size_Type New_Font = (Font_Size_Type)Font_Size_List_ComboBox.SelectedIndex; if (New_Font != Options_Provider.Font_Size_Type) { Option_Change_Command_List.Add(new Change_Font_Size_Option_Command(New_Font)); } }
private void Numeral_System_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Remove_Obsolete_Command <Change_Numeral_System_Option_Command>(); if (Numeral_System_List_ComboBox.SelectedItem is IItem_Numeral_System_List List_Item) { sbyte New_Numeral_System = List_Item.Numeral_System_Code; if (New_Numeral_System != Options_Provider.Numeral_System_Code) { Option_Change_Command_List.Add(new Change_Numeral_System_Option_Command(New_Numeral_System)); } } }
/// <summary> /// Removes from command list command in given type. /// </summary> /// <typeparam name="T">Only "IChange_Option_Command" Type</typeparam> private void Remove_Obsolete_Command <T>() where T : IChange_Option_Command { List <T> Obsolete_Commands_List = new List <T>(); foreach (IChange_Option_Command Command in Option_Change_Command_List ?? Enumerable.Empty <IChange_Option_Command>()) { if (Command is T obsolete_Command) { Obsolete_Commands_List.Add(obsolete_Command); } } foreach (T obsolete_Command in Obsolete_Commands_List) { Option_Change_Command_List.Remove(obsolete_Command); } }
private void Comma_Type_List_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Comma_Type_List_ComboBox.SelectedItem is IComma_Type_List_Item selected_Item) { if (selected_Item.Is_Selectable == false) { Comma_Type_List_ComboBox.SelectedItem = _Bindable_Resources.Comma_Type_List_Context.Return_Current_Comma_Type_Item(); } else { Remove_Obsolete_Command <Change_Font_Size_Option_Command>(); string new_Comma_Type = selected_Item.Content_Text; Option_Change_Command_List.Add(new Change_Comma_Type_Option_Command(new_Comma_Type)); } } }
public void Add_New_Comma_Type_Option_Command(string[] Comma_Types) { Remove_Obsolete_Command <Add_New_Comma_Type_Option_Command>(); Option_Change_Command_List.Add(new Add_New_Comma_Type_Option_Command(Comma_Types)); }