/// <summary> /// This method is used to add a new client application to MDS while MDS is running. /// Used by MDSController to allow user to add a new application from MDSManager GUI. /// It does all necessary tasks to add new application (Updates XML file, adds application to needed /// collections of system...). /// </summary> /// <param name="name">Name of the new application</param> public MDSClientApplication AddApplication(string name) { if (_settings.Applications.Exists(a => a.Name == name)) { throw new ArgumentException(String.Format("Application '{0}' already exists ", name)); } //Add to settings lock (_settings.Applications) { _settings.Applications.Add( new ApplicationInfoItem { Name = name }); _settings.SaveToXml(); } //Add to applications list lock (_clientApplicationList.Applications) { var newApplication = new MDSClientApplication(name); newApplication.Settings = _settings; newApplication.StorageManager = _storageManager; newApplication.MessageReceived += RemoteApplication_MessageReceived; _clientApplicationList.Applications.Add(name, newApplication); _communicationLayer.AddRemoteApplication(newApplication); newApplication.Start(); return(newApplication); } }
/// <summary> /// This method is used to add a new client application to MDS while MDS is running. /// Used by MDSController to allow user to add a new application from MDSManager GUI. /// It does all necessary tasks to add new application (Updates XML file, adds application to needed /// collections of system...). /// </summary> /// <param name="name">Name of the new application</param> public MDSClientApplication AddApplication(string name) { //Add to settings lock (_settings.Applications) { _settings.Applications.Add( new ApplicationInfoItem { Name = name }); _settings.SaveToXml(); } //Add to applications list lock (_clientApplicationList.Applications) { var newApplication = new MDSClientApplication(name); newApplication.Settings = _settings; newApplication.StorageManager = _storageManager; newApplication.MessageReceived += RemoteApplication_MessageReceived; _clientApplicationList.Applications.Add(name, newApplication); _communicationLayer.AddRemoteApplication(newApplication); newApplication.Start(); return(newApplication); } }
/// <summary> /// This method is used to add a new client application to MDS while MDS is running. /// Used by MDSController to allow user to add a new application from MDSManager GUI. /// It does all necessary tasks to add new application (Updates XML file, adds application to needed /// collections of system...). /// </summary> /// <param name="name">Name of the new application</param> public MDSClientApplication AddApplication(string name) { //Add to settings lock (_settings.Applications) { _settings.Applications.Add( new ApplicationInfoItem { Name = name }); _settings.SaveToXml(); } //Add to applications list lock (_clientApplicationList.Applications) { var newApplication = new MDSClientApplication(name); newApplication.Settings = _settings; newApplication.StorageManager = _storageManager; newApplication.MessageReceived += RemoteApplication_MessageReceived; _clientApplicationList.Applications.Add(name, newApplication); _communicationLayer.AddRemoteApplication(newApplication); newApplication.Start(); return newApplication; } }
/// <summary> /// This method is used to add a new client application to MDS while MDS is running. /// Used by MDSController to allow user to add a new application from MDSManager GUI. /// It does all necessary tasks to add new application (Updates XML file, adds application to needed /// collections of system...). /// </summary> /// <param name="name">Name of the new application</param> public MDSClientApplication AddApplication(string name) { if (_settings.Applications.Exists(a => a.Name == name)) throw new ArgumentException(String.Format("Application '{0}' already exists ", name)); //Add to settings lock (_settings.Applications) { _settings.Applications.Add( new ApplicationInfoItem { Name = name }); _settings.SaveToXml(); } //Add to applications list lock (_clientApplicationList.Applications) { var newApplication = new MDSClientApplication(name); newApplication.Settings = _settings; newApplication.StorageManager = _storageManager; newApplication.MessageReceived += RemoteApplication_MessageReceived; _clientApplicationList.Applications.Add(name, newApplication); _communicationLayer.AddRemoteApplication(newApplication); newApplication.Start(); return newApplication; } }