Ejemplo n.º 1
0
        AutomaticUpdaterBackend updater;                             //this is what we are adding

        public MainWindow()                                          // remember to change this to UpdateWindow if above changed
        {
            System.Threading.Thread.Sleep(3000);                     //We are telling program to pause here

            InitializeComponent();                                   // now lets start

            updater = new AutomaticUpdaterBackend()                  // we still have to properly define AutoUpBackend
            {
                GUID       = "06AF8C3C-BA10-4938-9D4C-5CAC43A006A7", // have to define this thing as well :/
                UpdateType = UpdateType.CheckAndDownload,            // What type of update is you doing?
            };                                                       // f*****g semicolon

            // we define the updater things

            updater.CheckingFailed += Updater_CheckingFailed;

            updater.UpdateAvailable   += OnUpdateAvailable;
            updater.DownloadingFailed += OnDownloadingFailed;
            updater.ExtractingFailed  += OnExtractingFailed;
            //alot of things fail
            updater.ReadyToBeInstalled += OnReadyToBeInstalled;
            updater.UpdateSuccessful   += OnUpdateSuccessful;
            updater.UpdateFailed       += OnFailed;
            updater.UpToDate           += OnUpToDate;

            // telling the updater we are good to go
            updater.Initialize();
            updater.AppLoaded();

            updater.ForceCheckForUpdate(); // the most controversial command

            // Console.WriteLine("legggo b0$$");
        }
Ejemplo n.º 2
0
        static void CheckEvery10Days()
        {
            // Only ForceCheckForUpdate() every N days!
            // You don't want to recheck for updates on every app start.

            if ((DateTime.Now - auBackend.LastCheckDate).TotalDays > 10 &&
                auBackend.UpdateStepOn == UpdateStepOn.Nothing)
            {
                auBackend.ForceCheckForUpdate();
            }
        }
Ejemplo n.º 3
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;
            }
        }
Ejemplo n.º 4
0
 public void CheckForUpdate()
 {
     m_automaticUpdater.ForceCheckForUpdate(false);
 }
Ejemplo n.º 5
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();
        }