private void WebClientDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { MessageBox.Show(e.Error.Message, "Version check failed"); return; } if (Double.Parse(e.Result) > Constants.Version) { // new version found if (MessageBox.Show("A newer version was found, do you want to visit the releases page?\nhttps://github.com/AgmasGold/anno-designer/releases\n\n Clicking 'Yes' will open a new tab in your web browser.", "Update available", MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.OK) == MessageBoxResult.Yes) { System.Diagnostics.Process.Start("https://github.com/AgmasGold/anno-designer/releases"); } } else { StatusMessageChanged("Version is up to date."); if ((bool)e.UserState) { MessageBox.Show("This version is up to date.", "No updates found"); } } } catch (Exception ex) { MessageBox.Show("Error checking version. \n\nAdded error to error log.", "Version check failed"); App.WriteToErrorLog("Error Checking Version", ex.Message, ex.StackTrace); return; } }
private void WindowLoaded(object sender, RoutedEventArgs e) { // add icons to the combobox comboBoxIcon.Items.Clear(); _noIconItem = new IconImage("None"); comboBoxIcon.Items.Add(_noIconItem); foreach (var icon in annoCanvas.Icons) { comboBoxIcon.Items.Add(icon.Value); } comboBoxIcon.SelectedIndex = 0; // check for updates on startup MenuItemVersion.Header = "Version: " + Constants.Version; MenuItemFileVersion.Header = "File version: " + Constants.FileVersion; CheckForUpdates(false); // load color presets colorPicker.StandardColors.Clear(); try { var colorPresets = DataIO.LoadFromFile <ColorPresets>(Path.Combine(App.ApplicationPath, Constants.ColorPresetsFile)); foreach (var colorScheme in colorPresets.ColorSchemes) { foreach (var colorInfo in colorScheme.ColorInfos) { colorPicker.StandardColors.Add(new ColorItem(colorInfo.Color, string.Format("{0} ({1})", colorInfo.ColorTarget, colorScheme.Name))); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Loading of the color presets failed"); } // load presets treeViewPresets.Items.Clear(); // manually add a road tile preset treeViewPresets.Items.Add(new AnnoObject { Label = "road tile", Size = new Size(1, 1), Radius = 0, Road = true }); treeViewPresets.Items.Add(new AnnoObject { Label = "borderless road tile", Size = new Size(1, 1), Radius = 0, Borderless = true, Road = true }); var presets = annoCanvas.BuildingPresets; if (presets != null) { presets.AddToTree(treeViewPresets); GroupBoxPresets.Header = string.Format("Building presets - loaded v{0}", presets.Version); MenuItemPresetsVersion.Header = "Presets version: " + presets.Version; } else { GroupBoxPresets.Header = "Building presets - load failed"; } // load file given by argument if (!string.IsNullOrEmpty(App.FilenameArgument)) { annoCanvas.OpenFile(App.FilenameArgument); } }
private void ButtonPlaceBuildingClick(object sender, RoutedEventArgs e) { try { ApplyCurrentObject(); } catch (Exception) { MessageBox.Show("Error: Invalid building configuration."); } }
private void ApplyPreset() { try { var selectedItem = treeViewPresets.SelectedItem as AnnoObject; if (selectedItem != null) { UpdateUIFromObject(new AnnoObject(selectedItem) { Color = colorPicker.SelectedColor }); ApplyCurrentObject(); } } catch (Exception) { MessageBox.Show("Something went wrong while applying the preset."); } }
private void WebClientDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show(e.Error.Message, "Version check failed"); return; } if (int.Parse(e.Result) > Constants.Version) { // new version found if (MessageBox.Show("A newer version was found, do you want to visit the project page?\nhttp://anno-designer.googlecode.com/", "Update available", MessageBoxButton.YesNo, MessageBoxImage.Asterisk, MessageBoxResult.OK) == MessageBoxResult.Yes) { System.Diagnostics.Process.Start("http://code.google.com/p/anno-designer/downloads/list"); } } else { StatusMessageChanged("Version is up to date."); if ((bool)e.UserState) { MessageBox.Show("This version is up to date.", "No updates found"); } } }
private void ShowRegistrationMessageBox() { MessageBox.Show("You may need to reboot or relog for changes to take effect.", "Successful", MessageBoxButton.OK, MessageBoxImage.Information); }