public bool RefreshApplicationListPS() { try { var applicationList = SFPowerShell.GetApplicationList(connection); if (applicationList != null) { AppGridEnable = false; ServiceGridEnable = false; var itemsToRemove = Applications.ToList(); foreach (var itemToRemove in itemsToRemove) { Applications.Remove(itemToRemove); } foreach (var appl in applicationList) { Applications.Add(appl); } } else { ResponseStatus = "Unable to get Applications"; return(false); } return(true); } catch (Exception exp) { ResponseStatus = exp.Message; return(false); } }
public ViewModelBase() { connection = new Connection(); connectCommand = new ConnectCommand(this); removeServiceCommand = new RemoveServiceCommand(this); restartServiceCommand = new RestartServiceCommand(this); updateServiceCommand = new UpdateServiceCommand(this); upgradeApplicationCommand = new UpgradeApplicationCommand(this); deleteApplicationCommand = new DeleteApplicationCommand(this); refreshCommand = new RefreshCommand(this); Applications = new ObservableCollection <ApplicationType>(); AppGridEnable = false; ServiceGridEnable = false; SFPowerShell.Initialize(); //ApplicationType ap = new ApplicationType("Id", "name", "TypeName", "version", "1"); //Service s = new Service("SId", "SName", "SType", "SVersion", "1", "1"); //ap.Services.Add(s); //Parameter p = new Parameter("keykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykey", "valuevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevaluevalue"); //ap.ApplicationParameters.Add(p); //Parameter p2 = new Parameter("key2", "value2"); //ap.ApplicationParameters.Add(p2); //Applications.Add(ap); //ApplicationType ap2 = new ApplicationType("Id2", "name2", "TypeName2", "version2", "1"); //Service s2 = new Service("SId2", "SName2", "SType2", "SVersion2", "1", "1"); //ap2.Services.Add(s2); //Parameter p3 = new Parameter("key2", "value2"); //ap2.ApplicationParameters.Add(p3); //Applications.Add(ap2); }
public void RestartService(Service service) { string response = SFPowerShell.RestartService(service, connection); if (string.IsNullOrWhiteSpace(response)) { ResponseStatus = "Service restarted"; } else { ResponseStatus = response; } }
public void RemoveService(Service service) { string response = SFPowerShell.RemoveService(service, connection); if (string.IsNullOrWhiteSpace(response)) { ServiceGridEnable = false; string appname = service.ServiceName.Remove(service.ServiceName.LastIndexOf('/')); ApplicationType apl = Applications.Where(x => x.ApplicationName == appname).First(); apl.Services.Remove(service); } else { ResponseStatus = response; } }
public void UpdateService(Service service) { if (service.InstanceCount == 0) { ResponseStatus = "Enter instance count "; } else { string response = SFPowerShell.UpdateService(service, connection); if (string.IsNullOrWhiteSpace(response)) { ResponseStatus = "Service Updated"; } else { ResponseStatus = response; } } }
public void DeleteApplication(ApplicationType appl) { try { string response = SFPowerShell.DeleteApplication(appl.ApplicationName, connection); if (string.IsNullOrWhiteSpace(response)) { ResponseStatus = "application deleted"; RefreshApplicationList(); } else { ResponseStatus = response; } } catch (Exception ex) { ResponseStatus = ex.Message; if (ex.InnerException != null) { ResponseStatus = ex.InnerException.Message; } } }