示例#1
0
        private void UninstallServiceCommand_Execute(object parameter)
        {
            if (!Helper.IsCurrentUserAdministrator())
            {
                UIUtilities.ShowWarning(Properties.Resources.AdministratorRequiredMessage);
                return;
            }
            if (ServiceHelper.IsServiceRunning())
            {
                UIUtilities.ShowWarning(Properties.Resources.ServiceUninstallErrorServiceIsRunningMessage);
                return;
            }

            if (!UIUtilities.ConfirmMessageBox(MessageBoxImage.Question, Properties.Resources.ServiceUninstallConfirmationMessage))
            {
                return;
            }

            try
            {
                ServiceHelper.UninstallService();

                MessageBox.Show(Properties.Resources.ServiceUninstallSuccessMessage);
            }
            catch (Exception ex)
            {
                Logger.Instance.LogException(this, ex);
                UIUtilities.ShowWarning(Properties.Resources.ServiceUninstallFailedMessage, ex.Message);
            }
        }
 private void RemoveDataItemCommand_Execute(object parameter)
 {
     if (!UIUtilities.ConfirmMessageBox(System.Windows.MessageBoxImage.Question, Properties.Resources.ConfirmDeleteEntry))
     {
         return;
     }
     this.Parent.DataItems.Remove(this);
 }
示例#3
0
        private void RemoveEntryCommand_Execute(object parameter)
        {
            if (!UIUtilities.ConfirmMessageBox(System.Windows.MessageBoxImage.Question, Properties.Resources.ConfirmDeleteEntry))
            {
                return;
            }

            Entries.Remove(this.SelectedEntry);
            this.SelectedEntry = null;
        }
示例#4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Window.Closing"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.ComponentModel.CancelEventArgs"/> that contains the event data.</param>
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            FullscreenUI(false);

            if (!UIUtilities.ConfirmMessageBox(MessageBoxImage.Warning, AlarmWorkflow.Windows.UI.Properties.Resources.UIServiceExitWarning))
            {
                e.Cancel = true;
                return;
            }

            SaveWindowPosition();

            base.OnClosing(e);
        }
示例#5
0
        private void RestartServiceCommand_Execute(object parameter)
        {
            if (!Helper.IsCurrentUserAdministrator())
            {
                UIUtilities.ShowWarning(Properties.Resources.AdministratorRequiredMessage);
                return;
            }
            if (!ServiceHelper.IsServiceInstalled())
            {
                UIUtilities.ShowWarning(Properties.Resources.ServiceIsNotInstalledError);
                return;
            }

            if (!UIUtilities.ConfirmMessageBox(MessageBoxImage.Warning, Properties.Resources.RestartServiceMessage))
            {
                return;
            }

            ServiceHelper.StopService(false);
            ServiceHelper.StartService(false);
        }