예제 #1
0
        public void CheckForUpdate()
        {
            switch (au.UpdateStepOn)
            {
            case UpdateStepOn.UpdateReadyToInstall:
                var vm = changesCreator();
                vm.Message = au.Changes;
                windowManager.ShowDialog(vm);
                if (!vm.WasCancelled)
                {
                    au.InstallNow();
                }
                break;

            case UpdateStepOn.Nothing:
                Background = true;
                au.ForceCheckForUpdate();
                break;
            }
        }
예제 #2
0
        static void auBackend_ReadyToBeInstalled(object sender, EventArgs e)
        {
            if (auBackend.UpdateStepOn == UpdateStepOn.UpdateReadyToInstall)
            {
                //TODO: Delay the installation of the update until it's appropriate for your app.

                //TODO: Do any "spin-down" operations. auBackend.InstallNow() will
                //      exit this process using Environment.Exit(0), so run
                //      cleanup functions now (close threads, close running programs, release locked files, etc.)

                // here we'll just close immediately to install the new version
                auBackend.InstallNow();
            }
        }
예제 #3
0
        public SettingsForm()
        {
            InitializeComponent();

            var backEnd = new AutomaticUpdaterBackend
            {
                GUID       = "Fireball AutoUpdater",
                UpdateType = UpdateType.Automatic
            };

            backEnd.Initialize();
            backEnd.AppLoaded();

            backEnd.ReadyToBeInstalled += (s, e) =>
            {
                if (backEnd.UpdateStepOn != UpdateStepOn.UpdateReadyToInstall)
                {
                    return;
                }

                backEnd.InstallNow();
                Application.Exit();
            };

            if (backEnd.ClosingForInstall)
            {
                return;
            }

            backEnd.ForceCheckForUpdate(true);

            Icon = tray.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            var builder = new StringBuilder();

            {
                builder.Append("Image Files (*.png;*.gif;*.jpg;*.jpeg;*.bmp)|*.png;*.gif;*.jpg;*.jpeg;*.bmp|");
                builder.Append("PNG|*.png|");
                builder.Append("GIF|*.gif|");
                builder.Append("JPG|*.jpg|");
                builder.Append("JPEG|*.jpeg|");
                builder.Append("BMP|*.bmp");
            }

            imageFilter = builder.ToString();

            PopulateCombos();
            Settings.Instance = SettingsManager.Load();
            settings          = Settings.Instance;
            PopulateSettings();

            PluginManager.Load();

            foreach (IPlugin plugin in PluginManager.Plugins)
            {
                PluginItem item = new PluginItem(plugin);
                cPlugins.Items.Add(item);

                if (settings.ActivePlugin.Equals(plugin.Name))
                {
                    cPlugins.SelectedItem = item;
                }
            }

            if (cPlugins.SelectedItem == null && cPlugins.Items.Count > 0)
            {
                cPlugins.SelectedIndex = 0;
            }

            #region :: Register Hotkeys ::

            /*StringBuilder hotkeyRegisterErrorBuilder = new StringBuilder();
             *
             * if (settings.CaptureScreenHotey.GetCanRegister(this))
             * {
             *  settings.CaptureScreenHotey.Register(this);
             *  settings.CaptureScreenHotey.Pressed += CaptureScreenHotkeyPressed;
             * }
             * else
             * {
             *  if (settings.CaptureScreenHotey.KeyCode != Keys.None)
             *      hotkeyRegisterErrorBuilder.AppendFormat(" - Can't register capture screen hotkey ({0})\n", settings.CaptureScreenHotey);
             * }
             *
             * if (settings.CaptureAreaHotkey.GetCanRegister(this))
             * {
             *  settings.CaptureAreaHotkey.Register(this);
             *  settings.CaptureAreaHotkey.Pressed += CaptureAreaHotkeyPressed;
             * }
             * else
             * {
             *  if (settings.CaptureScreenHotey.KeyCode != Keys.None)
             *      hotkeyRegisterErrorBuilder.AppendFormat(" - Can't register capture area hotkey ({0})\n", settings.CaptureAreaHotkey);
             * }
             *
             * if (hotkeyRegisterErrorBuilder.Length > 0)
             * {
             *  Helper.InfoBoxShow(String.Format("Failed to register hotkeys!\n{0}", hotkeyRegisterErrorBuilder));
             * }*/
            #endregion

            SaveSettings();

            Application.ApplicationExit += (s, e) => SettingsManager.Save();
        }