public DeleteAllDataCommand(AppDataService appDataService, RestartService restartService) { Ensure.NotNull(appDataService, "appDataService"); Ensure.NotNull(restartService, "restartService"); this.appDataService = appDataService; this.restartService = restartService; }
public SwitchDatabaseCommand(IDevelopmentService developmentTools, RestartService restartService, bool isEnabled) { Ensure.NotNull(developmentTools, "developmentTools"); Ensure.NotNull(restartService, "restartService"); this.developmentTools = developmentTools; this.restartService = restartService; this.isEnabled = isEnabled; }
private void SchedulerCallback(object e) { LogService.CreateLog("Begin Backup Session"); var servicesController = new ServicesController(); servicesController.RunBackup(); RestartService restartService = new RestartService(); restartService.RestartScheduler(); }
public SPSDConfigurationActions SaveEnv(SPSDConfigurationActions node) { if (node == null) { node = new SPSDConfigurationActions(); } node.RecycleAppPools = ((IFileHandler <SPSDConfigurationActionsRecycleAppPools>)ActionRecycleAppPools).SaveEnv(null); node.ResetIIS = ((IFileHandler <SPSDConfigurationActionsResetIIS>)ActionResetIIS).SaveEnv(null); node.WarmUpUrls = ((IFileHandler <SPSDConfigurationActionsWarmUpUrls>)ActionWarmUpUrls).SaveEnv(null); // cannot just overwrite as there might be some custom services which may not have been shown in the editor // and need to be preserved List <SPSDConfigurationActionsRestartService> services = null; if (node.RestartService != null) { // get all valid custom services which were not shown in the editor services = node.RestartService.Where(s => !string.IsNullOrEmpty(s.Name) && RestartService.GetServiceActionType(s.Name) == RestartService.RestartServiceActionType.Custom && !s.Name.Equals(ActionCustom.ServiceName, StringComparison.InvariantCultureIgnoreCase)) .ToList(); } else { services = new List <SPSDConfigurationActionsRestartService>(); } services.Add(((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPAdminV4).SaveEnv(null)); services.Add(((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPTimerV4).SaveEnv(null)); services.Add(((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPUserCodeV4).SaveEnv(null)); services.Add(((IFileHandler <SPSDConfigurationActionsRestartService>)ActionCustom).SaveEnv(null)); // purge also null services node.RestartService = services.Where(s => s != null).ToArray(); return(node); }
public void RestartService() { string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "RestartService.xml")); var request = new RestartService { SessionId = "sid", Service = TServiceType.POP3 }; var xml = request.ToXml().InnerXmlFormatted(); Assert.AreEqual(expected, xml); XmlDocument doc = new XmlDocument(); doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "RestartService.xml"))); var response = request.FromHttpRequestResult(new HttpRequestResult { Response = doc.InnerXml }); Assert.AreEqual("result", response.Type); Assert.True(response.Success); }
public void LoadEnv(SPSDConfigurationActions node) { if (node == null) { node = new SPSDConfigurationActions(); } InheritActionTargetsFromParentNode(node, node.RecycleAppPools); InheritActionTargetsFromParentNode(node, node.ResetIIS); InheritActionTargetsFromParentNode(node, node.WarmUpUrls); ((IFileHandler <SPSDConfigurationActionsRecycleAppPools>)ActionRecycleAppPools).LoadEnv( node.RecycleAppPools); ((IFileHandler <SPSDConfigurationActionsResetIIS>)ActionResetIIS).LoadEnv(node.ResetIIS); ((IFileHandler <SPSDConfigurationActionsWarmUpUrls>)ActionWarmUpUrls).LoadEnv(node.WarmUpUrls); if (node.RestartService != null) { bool customServiceIsSet = false; foreach (SPSDConfigurationActionsRestartService service in node.RestartService) { if (service == null || string.IsNullOrEmpty(service.Name)) { continue; } InheritActionTargetsFromParentNode(node, service); switch (RestartService.GetServiceActionType(service.Name)) { case RestartService.RestartServiceActionType.SPAdminV4: ((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPAdminV4).LoadEnv(service); break; case RestartService.RestartServiceActionType.SPTimerV4: ((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPTimerV4).LoadEnv(service); break; case RestartService.RestartServiceActionType.SPUserCodeV4: ((IFileHandler <SPSDConfigurationActionsRestartService>)ActionSPUserCodeV4).LoadEnv( service); break; default: if (!customServiceIsSet) { ((IFileHandler <SPSDConfigurationActionsRestartService>)ActionCustom).LoadEnv( service); customServiceIsSet = true; } else { MessageBox.Show( string.Format( "Your environment file contains more than one custom RestartService action which is unsupported by the editor. You will not be able to configure the action of the service \"{0}\" but your current settings will be retained even after modifiying this file.", service.Name), "Restart service action cannot be loaded", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } } } }
public Service(string name, RestartService restart, StatusService status, bool needRestart) => (Name, Status, Restart, NeedRestart) = (name, status, restart, needRestart);
public RestartCommand(RestartService restartService) { Ensure.NotNull(restartService, "restartService"); this.restartService = restartService; }
void OnSetCurrentProvider(object obj) { CurrentProvider = logic.CurrentProvider = SelectedProvider; RestartService.Execute(null); ((DelegateCommand)ShowConfiguration).RaiseCanExecuteChanged(); }
public RestartModule(RestartService service, IDbLanguage language, LocalizationService localization) { _service = service; _language = language; _localization = localization; }