Example #1
0
        public UpdateForm(RegistryConfiguration registryConfiguration, NotifyIcon notifyIcon, Updater updater)
        {
            _notifyIcon = notifyIcon;
            _updater    = updater;

            InitializeComponent();

            if (registryConfiguration.StartMinimized)
            {
                WindowState   = FormWindowState.Minimized;
                ShowInTaskbar = false;

                Shown += OnShown;
            }

            RegistryConfigurationBindingSource.DataSource = registryConfiguration;

            Text = _updater.Deployment.Configuration.Company + @" - " + string.Format(Properties.Resources.AppUpdate, _updater.Deployment.Configuration.Name);
            UpdatingAppLabel.Text          = string.Format(Properties.Resources.AppUpdate, _updater.Deployment.Configuration.Name) + @" (" + _updater.Deployment.Version + @")";
            UpdatingMessageLabel.Text      = Properties.Resources.UpdateMessage;
            DownloadingLabel.Text          = string.Format(Properties.Resources.DownloadFileProgress, "");
            TotalProgressLabel.Text        = Properties.Resources.TotalProgress;
            StartMinimizedCheckBox.Text    = Properties.Resources.MenuItemStartMinimized;
            StartMinimizedCheckBox.Checked = registryConfiguration.StartMinimized;

            _updater.StartUpdate      += OnUpdaterStart;
            _updater.StartDownload    += OnUpdaterStartDownload;
            _updater.DownloadProgress += OnUpdaterDownloadProgress;
            _updater.UpdateFile       += OnUpdateFile;

            _totalDownload = _updater.TotalDownload;
        }
Example #2
0
        public override void Run(
            NotifyIcon notifyIcon,
            RegistryConfiguration registryConfiguration)
        {
            if (!Deployment.ShouldDownload())
            {
                Update();
            }

            var tempDeployment = Deployment.FromTemp(Configuration);

            if (tempDeployment.IsValid())
            {
                ExecuteApplication();

                base.Run(notifyIcon, registryConfiguration);
            }

            else
            {
                base.Run(notifyIcon, registryConfiguration);

                ExecuteApplication();
            }
        }
Example #3
0
        public override void Run(
            NotifyIcon notifyIcon,
            RegistryConfiguration registryConfiguration)
        {
            base.Run(notifyIcon, registryConfiguration);

            ExecuteApplication();
        }
Example #4
0
        public virtual void Run(
            NotifyIcon notifyIcon,
            RegistryConfiguration registryConfiguration)
        {
            if (Deployment.ShouldDownload())
            {
                _updateForm = new UpdateForm(registryConfiguration, notifyIcon, this);

                Application.Run(_updateForm);
            }

            else if (Deployment.ShouldUpdate())
            {
                Update();
            }
        }
Example #5
0
        public void Run()
        {
            var registryConfiguration = new RegistryConfiguration();

            _registryConfigurationBindingSource = new BindingSource
            {
                DataSource = registryConfiguration
            };

            var notifyIcon = new NotifyIcon
            {
                Visible          = true,
                Icon             = Properties.Resources.Icon_ico,
                ContextMenuStrip = NotifyIconContextMenuStrip(),
            };

            notifyIcon.DoubleClick += NotifyIconOnDoubleClick;

            try
            {
                if (!Configuration.HasTempDeploymentPath)
                {
                    Deployment.SaveTemp();
                }

                Run(notifyIcon, registryConfiguration);
            }

            catch (Exception ex)
            {
                ExecuteApplication();

                notifyIcon.ShowBalloonTip(ex);
            }

            finally
            {
                notifyIcon.Visible = false;

                registryConfiguration.Dispose();
            }
        }