示例#1
0
        /// <summary>
        /// Create an instance of the default 'Check for Updates' form.
        /// </summary>
        public UpdateCheckForm()
        {
            InitializeComponent();

            _profile        = ApplicationManager.GetInstance().ClientProfile;
            _updateCheckUrl = new Uri(_profile.UpdateCheckURL);

            _webClient = new WebClient();

            Text = Resources.UpdateTitle;
            _checkButton.Text  = Resources.UpdateButtonCheck;
            _cancelButton.Text = Resources.UpdateButtonCancel;
            _closeButton.Text  = Resources.UpdateButtonClose;

            _latestVersionLabel.Text  = Resources.UpdateMessageCheckNow;
            _currentVersionLabel.Text = String.Empty;
            _checkButton.Enabled      = true;
            _cancelButton.Enabled     = false;

            _linkLabel.Visible = false;

            if (_profile.UpdateHomeURL != null &&
                _profile.UpdateLinkText != null)
            {
                _linkLabel.Visible      = true;
                _linkLabel.Text         = _profile.UpdateLinkText;
                _linkLabel.LinkClicked += new
                                          LinkLabelLinkClickedEventHandler(LinkLabel_LinkClicked);
            }

            // Allow client applications to modify the form.
            UpdateCheckFormProxy.GetInstance().UpdateFormControls(Controls);

            Refresh();
        }
        /// <summary>
        /// Get a reference to the form proxy singleton.
        /// </summary>
        /// <returns>A reference to the form proxy.</returns>
        public static UpdateCheckFormProxy GetInstance()
        {
            if (_singleton == null)
            {
                _singleton = new UpdateCheckFormProxy();
            }

            return(_singleton);
        }