示例#1
0
 void OnCloseCommand()
 {
     // ダサいけど、IsClosingAcceptedがtrueなら~の分岐がView側にあるので仕方ない
     if (IsClosingAccepted)
     {
         ForceCloseCommand.Execute(null);
     }
     else
     {
         QueryClosingCommand.Execute(null);
     }
 }
示例#2
0
        private void AssociatedObject_Closing(object sender, CancelEventArgs e)
        {
            if (QueryClosingCommand == null || !QueryClosingCommand.CanExecute(null))
            {
                return;
            }

            if (!IsClosingAccepted)
            {
                e.Cancel = true;

                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    // 出直してきて
                    QueryClosingCommand.Execute(null);
                }));
            }
        }