#region Add private void CanExecuteAdd(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; e.Handled = true; } private void AddExecuted(object sender, ExecutedRoutedEventArgs e) { this.ClearControls(); } #endregion #region Close private void CanExecuteClose(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; e.Handled = true; } private void CloseExecuted(object sender, ExecutedRoutedEventArgs e) { try { if (this.IsChanged()) { string ST = "هل ترغب فى حفظ التعديلات ؟"; MessageBoxResult R = MessageBox.Show(ST, "حفظ", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes); if (R == MessageBoxResult.Yes) { this.Maintain_CloseForm_Med(); } else { this.Close(); } } else { this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } #endregion private void IntializeRoutedCommand() { //==========OpenRoutedCommand Of ToolBar================ RoutedUICommand NewRoutedCommand = new RoutedUICommand(); CommandBinding NewCommandBinding = new CommandBinding(NewRoutedCommand, AddExecuted, CanExecuteAdd); NewRoutedCommand.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control)); this.CommandBindings.Add(NewCommandBinding); this.Btn_New.Command = NewRoutedCommand; //======================================================= RoutedUICommand ClearRoutedCommand = new RoutedUICommand(); CommandBinding ClearCommandBinding = new CommandBinding(ClearRoutedCommand, ClearExecuted, CanExecuteAdd); ClearRoutedCommand.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control)); this.CommandBindings.Add(ClearCommandBinding); this.Btn_Clear.Command = ClearRoutedCommand; //=======================================================}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)