예제 #1
0
        /// <summary>
        /// Removes the after status information after the specified duration.
        /// </summary>
        /// <param name="duration">The duration.</param>
        /// <returns>
        /// A task that represents the asynchronous operation. The result of the task indicates
        /// whether the screen was deactivated/closed successfully.
        /// </returns>
        public async Task <bool> CloseAfterAsync(TimeSpan duration)
        {
            CheckAccess();
            await Task.Delay(duration);

            return(await Conductor.DeactivateItemAsync(this, true));
        }
예제 #2
0
        /// <inheritdoc/>
        public void Exit(int exitCode = (int)Editor.ExitCode.ERROR_SUCCESS)
        {
            if (!_exitCode.HasValue)
            {
                _exitCode = exitCode;
            }

            // Exit can be called by command line parsing. In this case we are not yet conducted.
            Conductor?.DeactivateItemAsync(this, true);
        }
예제 #3
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="AboutViewModel"/> class.
        /// </summary>
        /// <param name="aboutService">The <see cref="IAboutService"/>.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="aboutService"/> is <see langword="null"/>.
        /// </exception>
        public AboutViewModel(IAboutService aboutService)
        {
            if (aboutService == null)
            {
                throw new ArgumentNullException(nameof(aboutService));
            }

            AboutService            = aboutService;
            DisplayName             = Invariant($"About {AboutService.ApplicationName}");
            CloseAboutDialogCommand = new DelegateCommand(() => Conductor.DeactivateItemAsync(this, true));
            CopyToClipboardCommand  = new DelegateCommand(() => AboutService.CopyInformationToClipboard());
        }
예제 #4
0
 private void Close()
 {
     // Close this screen. Do not await because we are in the Close event handler.
     Conductor.DeactivateItemAsync(this, true);
 }
예제 #5
0
 /// <summary>
 /// Removes the status information immediately.
 /// </summary>
 /// <returns>
 /// A task that represents the asynchronous operation. The result of the task indicates
 /// whether the screen was deactivated/closed successfully.
 /// </returns>
 public Task <bool> CloseAsync()
 {
     return(Conductor.DeactivateItemAsync(this, true));
 }
예제 #6
0
 private void Cancel()
 {
     Logger.Debug("Closing Options dialog. (\"Cancel\" selected.)");
     Conductor.DeactivateItemAsync(this, true).Forget();
 }
예제 #7
0
 private void Ok()
 {
     Logger.Debug("Applying changes and closing Options dialog. (\"OK\" selected.)");
     ApplyChanges();
     Conductor.DeactivateItemAsync(this, true).Forget();
 }