Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerInfoBase"/> class.
        /// </summary>
        /// <param name="type">The type of file uploader to use.</param>
        /// <param name="host">The host address.</param>
        /// <param name="user">The user.</param>
        /// <param name="password">The password.</param>
        /// <param name="downloadType">The type of file downloader to use.</param>
        /// <param name="downloadHost">The download host.</param>
        protected ServerInfoBase(FileUploaderType type, string host, string user, string password, DownloadSourceType downloadType,
                                 string downloadHost)
        {
            _fileUploaderType   = type;
            _host               = host;
            _user               = user;
            _password           = password;
            _fileDownloaderType = downloadType;
            _downloadHost       = downloadHost;

            _updateJobCountTimer = new Timer(InvokeProgressChanged, null, 1000, 1000);

            // Listen for when any versions change
            _settings.LiveVersionChanged += _settings_LiveVersionChanged;
            _settings.NextVersionCreated += _settings_NextVersionCreated;

            // Enqueue the live version and, if it exists, the next version, to ensure they are synchronized
            EnqueueSyncVersion(_settings.LiveVersion);
            if (_settings.DoesNextVersionExist())
            {
                EnqueueSyncVersion(_settings.LiveVersion + 1);
            }

            // Create the initial file uploader
            RecreateFileUploader();

            // Create the worker thread and start it
            _workerThread = new Thread(WorkerThreadLoop)
            {
                IsBackground = true
            };

            try
            {
                _workerThread.Name = "MasterServerInfo [" + GetHashCode() + "] worker thread.";
            }
            catch (InvalidOperationException)
            {
            }

            _workerThread.Start();
        }
Esempio n. 2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode)
            {
                return;
            }

            _settings.LiveVersionChanged      += _settings_LiveVersionChanged;
            _settings.NextVersionCreated      += _settings_NextVersionCreated;
            _settings.FileServerListChanged   += _settings_FileServerListChanged;
            _settings.MasterServerListChanged += _settings_MasterServerListChanged;

            btnChangeLiveVersion.Enabled = _settings.DoesNextVersionExist();
            lblLiveVersion.Text          = _settings.LiveVersion.ToString();

            UpdateServerListBox(lstFS, _settings.FileServers.Cast <ServerInfoBase>(), FileServerInfo_ServerChanged);
            UpdateServerListBox(lstMS, _settings.MasterServers.Cast <ServerInfoBase>(), MasterServerInfo_ServerChanged);
        }
Esempio n. 3
0
 /// <summary>
 /// Handles the NextVersionCreated event of the <see cref="_settings"/>.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 void _settings_NextVersionCreated(ManagerSettings sender)
 {
     try
     {
         btnChangeLiveVersion.Enabled = sender.DoesNextVersionExist();
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Handles the NextVersionCreated event of the <see cref="_settings"/>.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 void _settings_NextVersionCreated(ManagerSettings sender)
 {
     try
     {
         btnChangeLiveVersion.Enabled = sender.DoesNextVersionExist();
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
     }
 }