Пример #1
0
        private void EditApplication()
        {
            ApplicationWithOverrideVariableGroup selectedAppWithGroup = GetSelectedAppWithGroupWhereOnlyOneIsSelected();

            if (selectedAppWithGroup == null)
            {
                return;
            }

            // If the user changes the enabled property, we need to log that.
            bool originalEnabledValue = selectedAppWithGroup.Enabled;

            TaskAppViewModel viewModel = new TaskAppViewModel(selectedAppWithGroup);

            MainWindowViewModel.ViewLoader.ShowDialog(viewModel);

            if (viewModel.UserCanceled)
            {
                return;
            }

            if (originalEnabledValue != selectedAppWithGroup.Enabled)
            {
                string message = string.Format(CultureInfo.CurrentCulture,
                                               "For {0}, the enabled property was changed from {1} to {2} on {3}",
                                               selectedAppWithGroup.ToString(), originalEnabledValue, selectedAppWithGroup.Enabled, this.SelectedApplicationServer.Name);

                using (var prestoWcf = new PrestoWcf <IBaseService>())
                {
                    prestoWcf.Service.SaveLogMessage(message);
                }
            }

            SaveServer();
        }
Пример #2
0
        private void AddApplication()
        {
            TaskAppViewModel viewModel = new TaskAppViewModel();

            MainWindowViewModel.ViewLoader.ShowDialog(viewModel);

            if (viewModel.UserCanceled)
            {
                return;
            }

            if (CommonUtility.GetAppWithGroup(this.SelectedApplicationServer.ApplicationsWithOverrideGroup, viewModel.ApplicationWithGroup) != null)
            {
                // Uh oh. This app with group already exists in the server list. DENIED.
                string ohNoYouDont = string.Format(CultureInfo.CurrentCulture,
                                                   "{0} cannot be added to {1} because {1} already contains {0}.",
                                                   viewModel.ApplicationWithGroup.ToString(), this.SelectedApplicationServer.Name);
                ShowUserMessage(ohNoYouDont, ViewModelResources.ItemNotSavedCaption);
                return;
            }

            this.SelectedApplicationServer.ApplicationsWithOverrideGroup.Add(viewModel.ApplicationWithGroup);

            string message = string.Format(CultureInfo.CurrentCulture,
                                           "{0} was just added with the enabled property set to {1} on {2}.",
                                           viewModel.ApplicationWithGroup.ToString(), viewModel.ApplicationWithGroup.Enabled, this.SelectedApplicationServer.Name);

            using (var prestoWcf = new PrestoWcf <IBaseService>())
            {
                prestoWcf.Service.SaveLogMessage(message);
            }

            SaveServer();
        }