Ejemplo n.º 1
0
        /// <inheritdoc />
        protected override bool OnClosing(ClosingReason reason)
        {
            // Block closing only on user events
            if (reason == ClosingReason.User)
            {
                // Check if asset has been edited and not saved (and still has linked item)
                if (IsEdited && _item != null)
                {
                    // Ask user for further action
                    var result = MessageBox.Show(
                        string.Format("Asset \'{0}\' has been edited. Save before closing?", _item.Path),
                        "Save before closing?",
                        MessageBox.Buttons.YesNoCancel
                        );
                    if (result == DialogResult.OK || result == DialogResult.Yes)
                    {
                        // Save and close
                        Save();
                    }
                    else if (result == DialogResult.Cancel || result == DialogResult.Abort)
                    {
                        // Cancel closing
                        return(true);
                    }
                }
            }

            return(base.OnClosing(reason));
        }
Ejemplo n.º 2
0
 // Called when the client disconnects from the server (or times out)
 private void OnClientDisconnected(ClosingReason reason)
 {
     if (ClientDisconnected != null)
     {
         ClientDisconnected(this, reason);
     }
 }
Ejemplo n.º 3
0
        private void OnClosing(ClosingReason reason, ref bool cancel)
        {
            // Check if can close window
            if (CanCloseWindow(reason))
            {
                if (reason == ClosingReason.User)
                {
                    _result = DialogResult.Cancel;
                }

                // Clean up
                _window = null;

                // Check if any thread is blocked during ShowDialog, then wait for it
                bool wait = true;
                while (wait)
                {
                    wait = Interlocked.Read(ref _isWaitingForDialog) > 0;
                    Thread.Sleep(1);
                }

                // Close window
                return;
            }

            // Suppress closing
            cancel = true;
        }
Ejemplo n.º 4
0
        /// <inheritdoc />
        protected override bool CanCloseWindow(ClosingReason reason)
        {
            if (_isWorking && reason == ClosingReason.User)
            {
                return(false);
            }

            return(base.CanCloseWindow(reason));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Closes all the windows.
        /// </summary>
        /// <param name="reason">Window closing reason.</param>
        /// <returns>True if action has been cancelled (due to window internal logic).</returns>
        public bool CloseAll(ClosingReason reason = ClosingReason.CloseEvent)
        {
            while (_tabs.Count > 0)
            {
                if (_tabs[0].Close(reason))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        public bool Quit(ClosingReason reason)
        {
            //the return value defines if the quiting should get canceled or not
            if (reason != ClosingReason.Error)
            {
                WindowResponse res;

                if (ProjectManager.CurrentProject.IsWorking)
                {
                    res = MsgBox.ShowMessage(MessageContent.BusyClose);
                    if (res == WindowResponse.No)
                    {
                        return(true);
                    }
                    else if (res == WindowResponse.Yes)
                    {
                        ProjectManager.Cancel();
                    }
                }

                res = AskForSaving();
                if (res == WindowResponse.Cancel)
                {
                    return(true);
                }
            }
            else
            {
                ProjectManager.Cancel();
            }

            LSSettings.Save();

            ProjectManager.BrightnessCalculated -= CurrentProject_BrightnessCalculated;
            ProjectManager.FramesLoaded         -= CurrentProject_FramesLoaded;
            ProjectManager.ProgressChanged      -= CurrentProject_ProgressChanged;
            ProjectManager.WorkDone             -= CurrentProject_WorkDone;

            if (ProjectManager.CurrentProject.IsWorking)
            {
                ProjectManager.CurrentProject.IsWorkingWaitHandler.WaitOne(10000);
            }

            UIHandler.ReleaseUIData();
            ProjectManager.Close();

            UIHandler.QuitApplication();
            return(false);
        }
Ejemplo n.º 7
0
        private void MainWindow_OnClosing(ClosingReason reason, ref bool cancel)
        {
            Editor.Log("Main window is closing, reason: " + reason);

            if (Editor.StateMachine.IsPlayMode)
            {
                // Cancel closing buut leave the play mode
                cancel = true;
                Editor.Log("Skip closing ediotr and leave the play mode");
                Editor.Simulation.RequestStopPlay();
                return;
            }

            SaveCurrentLayout();

            // Block closing only on user events
            if (reason == ClosingReason.User)
            {
                // Check if cancel action or save scene before exit
                if (Editor.Scene.CheckSaveBeforeClose())
                {
                    // Cancel
                    cancel = true;
                    return;
                }

                // Close all asset editor windows
                for (int i = 0; i < Windows.Count; i++)
                {
                    if (Windows[i] is AssetEditorWindow assetEditorWindow)
                    {
                        if (assetEditorWindow.Close(ClosingReason.User))
                        {
                            // Cancel
                            cancel = true;
                            return;
                        }

                        // Remove it
                        Windows.Remove(assetEditorWindow);
                        i--;
                    }
                }
            }

            OnMainWindowClosing?.Invoke();
        }
Ejemplo n.º 8
0
        private void OnClosing(ClosingReason reason, ref bool cancel)
        {
            // Close all docked windows
            while (Tabs.Count > 0)
            {
                if (Tabs[0].Close(reason))
                {
                    // Cancel
                    cancel = true;
                    return;
                }
            }

            // Unlink
            _window.Window.Closing      -= OnClosing;
            _window.Window.LeftButtonHit = null;
            _window = null;

            // Remove object
            FlaxEngine.Assertions.Assert.IsTrue(TabsCount == 0 && ChildPanelsCount == 0);
            Dispose();
        }
Ejemplo n.º 9
0
    private bool Quit(ClosingReason reason)
    {
        //the return value defines if the quiting should get cancelled or not
        if (reason != ClosingReason.Error)
        {
            ResponseType res = ResponseType.None;
            if (IsBusy())
            {
                res = UpdateInfo(InfoType.IsBusy, 0);
                if (res == ResponseType.No) { return true; }
                else if (res == ResponseType.Yes) { KillRunningProcess(); }
            }
            res = AskForSaving();
            if (res == ResponseType.Cancel) { return true; }
        }
        else { KillRunningProcess(); }

        if (PreviewImg.Pixbuf != null) { PreviewImg.Pixbuf.Dispose(); }
        deletePPFiles(MySettings.KeepPP);

        ((IDisposable)Graph.Target).Dispose();
        ((IDisposable)Graph).Dispose();
        ((IDisposable)CurveGraph).Dispose();
        ((IDisposable)ScaleGraph).Dispose();

        System.GC.Collect();
        
        deleteThumbs();

        Application.Quit();
        return false;
    }
Ejemplo n.º 10
0
 internal void Internal_OnClosing(ClosingReason reason, ref bool cancel)
 {
     Closing?.Invoke(reason, ref cancel);
 }
Ejemplo n.º 11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (id_ != null)
            {
                hash ^= Id.GetHashCode();
            }
            if (readOnly_ != null)
            {
                hash ^= ReadOnly.GetHashCode();
            }
            if (name_ != null)
            {
                hash ^= Name.GetHashCode();
            }
            if (description_ != null)
            {
                hash ^= Description.GetHashCode();
            }
            if (MembershipStatus != 0)
            {
                hash ^= MembershipStatus.GetHashCode();
            }
            if (integrationCode_ != null)
            {
                hash ^= IntegrationCode.GetHashCode();
            }
            if (membershipLifeSpan_ != null)
            {
                hash ^= MembershipLifeSpan.GetHashCode();
            }
            if (sizeForDisplay_ != null)
            {
                hash ^= SizeForDisplay.GetHashCode();
            }
            if (SizeRangeForDisplay != 0)
            {
                hash ^= SizeRangeForDisplay.GetHashCode();
            }
            if (sizeForSearch_ != null)
            {
                hash ^= SizeForSearch.GetHashCode();
            }
            if (SizeRangeForSearch != 0)
            {
                hash ^= SizeRangeForSearch.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (ClosingReason != 0)
            {
                hash ^= ClosingReason.GetHashCode();
            }
            if (AccessReason != 0)
            {
                hash ^= AccessReason.GetHashCode();
            }
            if (AccountUserListStatus != 0)
            {
                hash ^= AccountUserListStatus.GetHashCode();
            }
            if (eligibleForSearch_ != null)
            {
                hash ^= EligibleForSearch.GetHashCode();
            }
            if (eligibleForDisplay_ != null)
            {
                hash ^= EligibleForDisplay.GetHashCode();
            }
            if (userListCase_ == UserListOneofCase.CrmBasedUserList)
            {
                hash ^= CrmBasedUserList.GetHashCode();
            }
            if (userListCase_ == UserListOneofCase.SimilarUserList)
            {
                hash ^= SimilarUserList.GetHashCode();
            }
            hash ^= (int)userListCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Determines whether this dialog can be closed.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <returns><c>true</c> if this dialog can be closed; otherwise, <c>false</c>.</returns>
 protected virtual bool CanCloseWindow(ClosingReason reason)
 {
     return(true);
 }
Ejemplo n.º 13
0
 public CloseRequestArgs(ClosingReason closeState) : base()
 {
     this.ClosingState = closeState;
 }
Ejemplo n.º 14
0
 internal static extern void Internal_Close(IntPtr obj, ClosingReason reason);
Ejemplo n.º 15
0
 /// <summary>
 /// Closes the window.
 /// </summary>
 /// <param name="reason">The closing reason.</param>
 public void Close(ClosingReason reason = ClosingReason.CloseEvent)
 {
     Internal_Close(unmanagedPtr, reason);
 }
Ejemplo n.º 16
0
        public bool Quit(ClosingReason reason)
        {
            //the return value defines if the quiting should get canceled or not
            if (reason != ClosingReason.Error)
            {
                WindowResponse res;

                if (ProjectManager.CurrentProject.IsWorking)
                {
                    res = MsgBox.ShowMessage(MessageContent.BusyClose);
                    if (res == WindowResponse.No) { return true; }
                    else if (res == WindowResponse.Yes) { ProjectManager.Cancel(); }
                }

                res = AskForSaving();
                if (res == WindowResponse.Cancel) { return true; }
            }
            else { ProjectManager.Cancel(); }

            LSSettings.Save();

            ProjectManager.BrightnessCalculated -= CurrentProject_BrightnessCalculated;
            ProjectManager.FramesLoaded -= CurrentProject_FramesLoaded;
            ProjectManager.ProgressChanged -= CurrentProject_ProgressChanged;
            ProjectManager.WorkDone -= CurrentProject_WorkDone;

            if (ProjectManager.CurrentProject.IsWorking) { ProjectManager.CurrentProject.IsWorkingWaitHandler.WaitOne(10000); }

            UIHandler.ReleaseUIData();
            ProjectManager.Close();

            UIHandler.QuitApplication();
            return false;
        }