コード例 #1
0
        /// <summary>
        /// This method is used to add a new client application to NGRID while NGRID is running.
        /// Used by NGRIDController to allow user to add a new application from NGRIDManager 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 NGRIDClientApplication 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 NGRIDClientApplication(name);
                newApplication.Settings         = _settings;
                newApplication.StorageManager   = _storageManager;
                newApplication.MessageReceived += RemoteApplication_MessageReceived;

                _clientApplicationList.Applications.Add(name, newApplication);
                _communicationLayer.AddRemoteApplication(newApplication);

                newApplication.Start();

                return(newApplication);
            }
        }
コード例 #2
0
ファイル: OrganizationLayer.cs プロジェクト: ashwinrath/NGRID
        /// <summary>
        /// This method is used to add a new client application to NGRID while NGRID is running.
        /// Used by NGRIDController to allow user to add a new application from NGRIDManager 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 NGRIDClientApplication 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 NGRIDClientApplication(name);
                newApplication.Settings = _settings;
                newApplication.StorageManager = _storageManager;
                newApplication.MessageReceived += RemoteApplication_MessageReceived;

                _clientApplicationList.Applications.Add(name, newApplication);
                _communicationLayer.AddRemoteApplication(newApplication);

                newApplication.Start();

                return newApplication;
            }
        }