Beispiel #1
0
        /// <summary>
        /// Shows the service app details.
        /// </summary>
        /// <param name="serviceApp">The service app.</param>
        /// <param name="isReadOnly">If set to <c>true</c> show the details as read only.</param>
        private void ShowServiceAppDetails(ServiceApp serviceApp, bool isReadOnly)
        {
            if (serviceApp == null)
            {
                serviceApp = new Models.ServiceApp
                {
                    StartupTypeEnum = Enums.StartupType.NotSet,
                    Schedule        = string.Empty
                };
            }

            this.ServiceAppNameLabel.Content = this.ServiceAppNameTextBox.Text = serviceApp.Name;
            this.MessageLabel.Text           = serviceApp.LastMessage;

            this.StartServiceAppButton.IsEnabled = serviceApp.CanStart && isReadOnly;
            this.StopServiceAppButton.IsEnabled  = serviceApp.CanStop && isReadOnly;
            this.RunButton.IsEnabled             = serviceApp.CanRun && isReadOnly;

            this.StartupTypeLabel.Text             = serviceApp.StartupTypeEnum.GetName();
            this.StartupTypeComboBox.SelectedValue = serviceApp.StartupTypeEnum;
            this.ServiceAppDescriptionLabel.Text   = this.DescriptionTextBox.Text = serviceApp.Description;
            this.ServiceAppEnvironmentLabel.Text   = this.ServiceAppEnvironmentTextBox.Text = serviceApp.Environment;
            this.ServiceAppParameterLabel.Text     = this.ParameterTextBox.Text = serviceApp.Parameters;
            this.AppFilePathLabel.Text             = this.AppFilePathTextBox.Text = serviceApp.AppFilePath;
            this.AppFilePathViewButton.IsEnabled   = !string.IsNullOrWhiteSpace(serviceApp.AppFilePath);
            this.SendSuccessCheckBox.IsChecked     = serviceApp.SendSuccessNotification;
            this.IdentityLabel.Text       = this.IdentityLabel.Text = serviceApp.Username;
            this.PasswordHiddenLabel.Text = serviceApp.Password;
            this.ScheduleLabel.Text       = ScheduleUtility.GetFullDescription(serviceApp.Schedule);
            this.ScheduleHiddenLabel.Text = serviceApp.Schedule;

            this.EditServiceAppButton.IsEnabled = !serviceApp.CanRun;
            this.EditMessageTextBlock.Text      = serviceApp.CanRun ? "Stop the app before making changes" : null;
        }
Beispiel #2
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            ServiceApp comp = obj as ServiceApp;

            if (comp == null)
            {
                return(false);
            }

            return((this.Name ?? string.Empty).Equals(comp.Name, StringComparison.OrdinalIgnoreCase) &&
                   (this.Description ?? string.Empty).Equals(comp.Description, StringComparison.OrdinalIgnoreCase) &&
                   (this.Environment ?? string.Empty).Equals(comp.Environment, StringComparison.OrdinalIgnoreCase) &&
                   (this.AppFilePath ?? string.Empty).Equals(comp.AppFilePath, StringComparison.OrdinalIgnoreCase) &&
                   (this.Parameters ?? string.Empty).Equals(comp.Parameters, StringComparison.OrdinalIgnoreCase) &&
                   this.SendSuccessNotification == comp.SendSuccessNotification &&
                   this.StartupType == comp.StartupType &&
                   (this.Schedule ?? string.Empty).Equals(comp.Schedule) &&
                   (this.Username ?? string.Empty).Equals(comp.Username, StringComparison.OrdinalIgnoreCase) &&
                   (this.Password ?? string.Empty).Equals(comp.Password, StringComparison.OrdinalIgnoreCase));
        }