private void ODIN_Loaded(object sender, RoutedEventArgs e) { //Set the Desktop wallpaper. Wallpaper.Set("wallpaper.bmp", Wallpaper.Style.Stretched); //Update Check string url = "https://gnuplusadam.com/OSIRiS/ODIN/version"; string versionstring; using (var wc = new WebClient()) try { versionstring = wc.DownloadString(url); Version latestVersion = new Version(versionstring); //Get current binary version. Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); Version currentVersion = new Version(fvi.FileVersion); //Compare. if (latestVersion > currentVersion) { updater updatewindow = new updater(); updatewindow.Show(); this.Hide(); } else { return; } } catch (WebException) { return; } }
// Handle key combos. public void ODIN_KeyUp(object sender, KeyEventArgs e) { // Reconfiguration Utility. // Ctrl + Shift + R if ((Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) && (e.Key == Key.R)) { try { Process reconfigure_ODIN = new Process(); reconfigure_ODIN.StartInfo.FileName = @"C:\profiles\Reconfigure_ODIN.exe"; reconfigure_ODIN.Start(); reconfigure_ODIN.WaitForExit(); return; } catch (Exception ex) { MessageBox.Show("The ODIN reconfiguration utility is missing." + Environment.NewLine + "Either ODIN is running without OSIRiS or the utility has been deleted." + Environment.NewLine + "Please contact support via [email protected] and include this error message:" + Environment.NewLine + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } // Force update. // Ctrl + Shift + U if ((Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) && (e.Key == Key.U)) { string url = "https://gnuplusadam.com/OSIRiS/ODIN/version"; string versionstring; using (var wc = new System.Net.WebClient()) try { versionstring = wc.DownloadString(url); Version latestVersion = new Version(versionstring); MessageBoxResult updateconfirm = MessageBox.Show(String.Format("Would you like to update to version {0}?", latestVersion), "Forced Update?", MessageBoxButton.YesNo, MessageBoxImage.Information); if (updateconfirm == MessageBoxResult.Yes) { var form = new updater(); this.Hide(); form.Show(); } else { return; } } catch (WebException) { return; } } // Force quit. // Ctrl + Shift + Q if ((Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) && (e.Key == Key.Q)) { Application.Current.Shutdown(); return; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.updater1 = ((OSIRiS_DESKTOP_INFO.updater)(target)); return; case 2: this.image = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }