static void Main(string[] args) { auBackend = new AutomaticUpdaterBackend { //TODO: set a unique string. For instance, "appname-companyname" GUID = "a-string-that-uniquely-IDs-your-app", // With UpdateType set to Automatic, you're still in charge of // checking for updates, but the AutomaticUpdaterBackend // continues with the downloading and extracting automatically. UpdateType = UpdateType.Automatic }; auBackend.ReadyToBeInstalled += auBackend_ReadyToBeInstalled; auBackend.UpdateSuccessful += auBackend_UpdateSuccessful; //TODO: use the failed events for logging & error reporting: // CheckingFailed, DownloadingFailed, ExtractingFailed, UpdateFailed // the functions to be called after all events have been set. auBackend.Initialize(); auBackend.AppLoaded(); // sees if you checked in the last 10 days, if not it rechecks CheckEvery10Days(); // Blocks until "resetEvent.Set()" on another thread resetEvent.WaitOne(); }
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$$"); }
void ISupportInitialize.EndInit() { if (DesignMode) { return; } auBackend.Initialize(); if (auBackend.ClosingForInstall) { // hide self if there's an update pending ownerForm.ShowInTaskbar = false; ownerForm.WindowState = FormWindowState.Minimized; } }
public UpdaterViewModel(IWindowManager windowManager, Func<UpdaterChangesViewModel> changesCreator) { this.windowManager = windowManager; this.changesCreator = changesCreator; au = new AutomaticUpdaterBackend { GUID = "code52-markpad", UpdateType = UpdateType.CheckAndDownload }; au.ProgressChanged += AuProgressChanged; au.ReadyToBeInstalled += AuReadyToBeInstalled; au.UpToDate += AuUpToDate; au.UpdateAvailable += AuUpdateAvailable; au.UpdateSuccessful += AuUpdateSuccessful; au.Initialize(); au.AppLoaded(); SetUpdateFlag(); }
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(); }
/// <summary> /// OnStart: Put startup code here /// - Start threads, get inital data, etc. /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { WriteToLog(".NET Windows Service v1", false); auBackend = new AutomaticUpdaterBackend { //TODO: set a unique string. // For instance, "appname-companyname" GUID = "a-string-that-uniquely-IDs-your-service", // With UpdateType set to Automatic, you're still in // charge of checking for updates, but the // AutomaticUpdaterBackend continues with the // downloading and extracting automatically. UpdateType = UpdateType.Automatic, // We set the service name that will be used by wyUpdate // to restart this service on update success or failure. ServiceName = this.ServiceName }; auBackend.ReadyToBeInstalled += auBackend_ReadyToBeInstalled; auBackend.UpdateSuccessful += auBackend_UpdateSuccessful; auBackend.UpToDate += auBackend_UpToDate; auBackend.UpdateFailed += auBackend_UpdateFailed; //TODO: use the failed events for logging & error reporting: // CheckingFailed, DownloadingFailed, ExtractingFailed, UpdateFailed // the functions to be called after all events have been set. auBackend.Initialize(); auBackend.AppLoaded(); if (!auBackend.ClosingForInstall) { // sees if you checked in the last 10 days, if not it rechecks CheckEvery10Days(); //Note: Also, since this will be a service you should call // CheckEvery10Days() from an another thread (rather // than just at startup) //TODO: do your normal service work } }