コード例 #1
0
        protected virtual void CloseFile()
        {
            //Prepare
            bool remove = true;

            //Check
            if (IsDirty)
            {
                //Get result
                MessageBoxResult result = MessageBox.Show($"Save changes to {DisplayName}?",
                                                          "Unsaved Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);

                //Handle
                switch (result)
                {
                case MessageBoxResult.Cancel:
                    remove = false;
                    break;

                case MessageBoxResult.Yes:
                    SaveToFile();
                    break;
                }
            }

            //Check and remove
            if (remove)
            {
                CloseCallback?.Invoke(this);
            }
        }
コード例 #2
0
 public virtual void Close()
 {
     CloseCallback?.Invoke();
 }
コード例 #3
0
 public override void Close(bool shouldCloseImmediately = false)
 {
     _shouldCloseImmediately = shouldCloseImmediately;
     CloseCallback?.Invoke();
 }
コード例 #4
0
 private void OnCloseButtonClick(object sender, RoutedEventArgs e)
 {
     CloseCallback.Invoke();
 }
コード例 #5
0
 public override void OnPointerClick(PointerEventData eventData)
 {
     CloseCallback?.Invoke();
 }