Exemplo n.º 1
0
 public bool SaveChanesAsk() //false - отменить закрытие
 {
     if (SaveChanesFunction != null)
     {
         if (Changed)
         {
             if (WndConfirmCloseModel.ShowWndConfirmCloseModel(SaveChanesQuestion, SaveChanesFunction))
             {
                 return(false);
                 //CloseAction?.Invoke();
             }
             else
             {
             }
         }
         else
         {
             //return true;
             //CloseAction?.Invoke();
         }
     }
     else
     {
         //CloseAction?.Invoke();
     }
     //return true;
     return(true);
 }
        public static bool ShowWndConfirmCloseModel(string ask, Func <bool> okCommand) //true отменить закрытие
        {
            var wndConfirmCloseModel = new WndConfirmCloseModel(ask, okCommand);
            var wnd = new UI.WndConfirmClose()
            {
                DataContext = wndConfirmCloseModel,
                Owner       = Application.Current.MainWindow
            };

            wnd.ShowDialog();
            return(wndConfirmCloseModel.Cancel);
        }