private void WindowLoaded(object sender, RoutedEventArgs e) { // Attach hotkeys _hotKeyCaptureColor = new HotKey(Key.C, KeyModifier.Ctrl | KeyModifier.Alt, OnHotKeyCaptureColorHandler); _hotKeyCaptureColorTimeLapse = new HotKey(Key.T, KeyModifier.Ctrl | KeyModifier.Alt, OnHotKeyCaptureColorTimelapseHandler); // Check for updates #if PORTABLE manager.CheckForUpdates("https://colora.sourceforge.io/update_portable.xml"); #else manager.CheckForUpdates("https://colora.sourceforge.io/update.xml"); #endif }
private void RulerForm_Load(object sender, EventArgs e) { // Set some items of the context menu foreach (Enum item in Enum.GetValues(typeof(MeasuringUnit))) { comUnits.Items.Add(item.GetDescription()); } // Reset the currently selected theme to avoid inconsistencies // caused by manual edits in the settings file. Settings.SelectedTheme = Settings.SelectedTheme; switch (this.Opacity * 100) { case 100: conHigh.Checked = true; break; case 80: conDefault.Checked = true; break; case 60: conLow.Checked = true; break; case 40: conVeryLow.Checked = true; break; } // Check for updates Task.Run(() => { manager.CheckForUpdates("https://screenruler.sourceforge.io/update.xml"); }); }
public MainWindow() { // Create a new instance of MiniAppManager for WPF. // The second parameter specifies if the manager should be run in portable mode. man = new MiniAppManager(this, false); // (Optional) Fill some data used in the 'About' box. var baseUri = BaseUriHelper.GetBaseUri(this); BitmapSource img = new BitmapImage(new Uri(baseUri, @"/bluelogo.png")); man.ProductColor = Color.FromRgb(51, 85, 119); man.ProductImage = img; man.ProductWebsite = new Link("http://example.org", "Example.org"); man.ProductLicense = new Link("https://opensource.org/licenses/BSD-3-Clause", "BSD-3-Clause License"); // (Optional) If set to true (false by default), the manager checks for '/portable' or // '--portable' options given at startup. If it finds one of these it runs in portable mode. man.PortableModeArgEnabled = true; man.MakePortable(Properties.Settings.Default); // Add any public property of your window with this method to let its state // be saved when the application is closed and loaded when it starts. man.AddManagedProperty(nameof(this.OpenCount)); // (Optional) Specifiy a list of cultures your application supports to fill a combo box // that allows switching between these. If this property is not specified, // the combo box won't be visible on the 'About' box. man.SupportedCultures = new CultureInfo[] { new CultureInfo("en"), new CultureInfo("de") }; // Initialize the manager. Please make sure this method is called BEFORE you initialize your window. man.Initialize(); // (Optional) Tells the manager to check for updates at the given URL. An XML file // containing a serialized AppUpdate object is expected at that location. // This method should also be called before the initialization of the window. man.CheckForUpdates("http://example.org/updates/TestWpfApp.xml"); // (Together with update checking) Set this property to true to show an update notification every time // the application is started. On default, a notification is shown only every time a newer version is detected. man.UpdateNotifyEveryStartup = true; //Initialize the window. InitializeComponent(); // The saved settings of the manager can be accessed. this.DataContext = man.Settings; }