Beispiel #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);
            }
        }
Beispiel #2
0
 public virtual void Close()
 {
     CloseCallback?.Invoke();
 }
Beispiel #3
0
 public override void Close(bool shouldCloseImmediately = false)
 {
     _shouldCloseImmediately = shouldCloseImmediately;
     CloseCallback?.Invoke();
 }
Beispiel #4
0
 private void OnCloseButtonClick(object sender, RoutedEventArgs e)
 {
     CloseCallback.Invoke();
 }
 public override void OnPointerClick(PointerEventData eventData)
 {
     CloseCallback?.Invoke();
 }