public void EditConnection(int selectedIndex, Action <int> openWizard) { if (selectedIndex != -1 && selectedIndex <= Servers.Count) { var selectedServer = Servers[selectedIndex]; var environmentModel = selectedServer.EnvironmentModel; if (environmentModel != null && environmentModel.Connection != null) { var serverUri = environmentModel.Connection.AppServerUri; var auth = environmentModel.Connection.AuthenticationType; openWizard(selectedIndex); var updatedServer = _environmentRepository.All().FirstOrDefault(e => e.ID == environmentModel.ID); if (updatedServer != null && (!serverUri.Equals(updatedServer.Connection.AppServerUri) || auth != updatedServer.Connection.AuthenticationType)) { if (ConnectedStatusChanged != null) { ConnectedStatusChanged(this, new ConnectionStatusChangedEventArg(ConnectionEnumerations.ConnectedState.Busy, environmentModel.ID, false)); } if (selectedServer.IsConnected) { _studioResourceRepository.Disconnect(environmentModel.ID); } selectedServer.EnvironmentModel = updatedServer; _studioResourceRepository.Load(environmentModel.ID, _asyncWorker, ResourcesLoadedHandler); } } } }
protected override void Initialize(IDebugState content) { _inputs.Clear(); _outputs.Clear(); if (content == null) { return; } // Multiple when creating - so that we show the path of the execution when debugging SelectionType = ActivitySelectionType.Add; IsSelected = content.ActivityType != ActivityType.Workflow; // check for remote server ID ;) Guid serverID; var isRemote = Guid.TryParse(content.Server, out serverID); if (isRemote || String.IsNullOrEmpty(content.Server)) //todo:Technical debt. this must be removed on a major upgrade { var envID = content.EnvironmentID; var env = _environmentRepository.All().FirstOrDefault(e => e.ID == envID); if (env == null) { var environmentModels = _environmentRepository.LookupEnvironments(_environmentRepository.ActiveEnvironment); if (environmentModels != null) { env = environmentModels.FirstOrDefault(e => e.ID == envID) ?? _environmentRepository.ActiveEnvironment; } else { env = _environmentRepository.Source; } } if (Equals(env, _environmentRepository.Source)) { // We have an unknown remote server ;) content.Server = "Unknown Remote Server"; } else { if (env != null) { content.Server = env.Name; } } } BuildBindableListFromDebugItems(content.Inputs, _inputs); BuildBindableListFromDebugItems(content.Outputs, _outputs); if (content.HasError) { HasError = true; } }
public List <IEnvironmentModel> Load(IEnvironmentRepository environmentRepository) { // PBI 6597 : TWR // BUG 9276 : TWR : 2013.04.19 - refactored so that we share environments if (environmentRepository == null) { throw new ArgumentNullException("environmentRepository"); } var environments = environmentRepository.All(); return(environments.ToList()); }
public List<IEnvironmentModel> Load(IEnvironmentRepository environmentRepository) { // PBI 6597 : TWR // BUG 9276 : TWR : 2013.04.19 - refactored so that we share environments if(environmentRepository == null) { throw new ArgumentNullException("environmentRepository"); } var environments = environmentRepository.All(); return environments.ToList(); }
bool GetNewlyAddedServer(out IEnvironmentModel environment) { var existingEnvironments = _environmentRepository.All(); if (existingEnvironments == null) { environment = null; return(false); } var newEnvironments = existingEnvironments.Except(Servers.Select(c => c.EnvironmentModel)); IEnumerable <IEnvironmentModel> environmentModels = newEnvironments as IEnvironmentModel[] ?? newEnvironments.ToArray(); if (!environmentModels.Any()) { environment = null; return(false); } environment = environmentModels.ToList().Last(); return(true); }