void TakeScreenshot(object sender, MenuItemEventArgs e) { try { var now = DateTime.Now; if (Notebooks.ActiveNotebook != null) { var f = Notebooks.ActiveNotebook.Folder; if (Directory.Exists(f)) { var filename = Path.Combine(f, string.Format(CultureInfo.InvariantCulture, "{0:yyyy-MM-dd HH_mm_ss} Screenshot.png", now)); // f + @"\Screenshot-" + DateTime.Now.Ticks + ".jpg"; Screenshots.SaveImageOfControl(Application.Current.MainWindow, filename); AppState.TriggerNotification( "Screenshot has been stored", "Screenshot", image: cameraImage); } Notebooks.ActiveNotebook.LoadItems(); } else { AppState.TriggerNotification( "No screenshots have been stored - no Notebook active.", "Screenshot", image: cameraImage); } //foreach (var folder in ScreenshotFolder) { // if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); // var filename = Path.Combine(folder, // string.Format(CultureInfo.InvariantCulture, "{0:yyyy-MM-dd HH_mm_ss} Screenshot.png", now)); // // f + @"\Screenshot-" + DateTime.Now.Ticks + ".jpg"; // Screenshots.SaveImageOfControl(Application.Current.MainWindow, filename); //} //if (Notebooks.ActiveNotebook!=null) // Notebooks.ActiveNotebook.LoadItems(); } catch (SystemException ex) { Logger.Log("ScreenshotPlugin", "Error saving screenshot", ex.Message, Logger.Level.Error, true, true); } }
private void circularMenuItem_Selected(object sender, MenuItemEventArgs e) { if (!circularMenuItem.IsEnabled || selectedPoi == null) return; if (isEditorVisible) HideEditor(); else ShowEditor(); ZoomAndPoint(); }
private void CreateCustomStepMenu(MenuItemEventArgs fe, bool error = false) { var inp = new InputPopupViewModel { Title = error ? "Supply correct format: dd:hh:mm:ss" : "Interval: dd:hh:mm:ss", RelativeElement = fe.Menu.Main, RelativePosition = new Point(10, 10), DefaultValue = DefaultCustomStep.ToString() }; inp.Saved += (o, r) => { var stepMenu = GetMenuItemById("Step"); var custom = stepMenu.Items.FirstOrDefault(k => k.Id == "Size_Custom"); if (custom == null) return; try { var timespan = TimeSpan.Parse(r.Result); PlayStepSize = timespan; custom.Title = "Custom: " + timespan; SetStepSize("Size_Custom"); fe.Menu.Update(); } catch (Exception) { CreateCustomStepMenu(fe, true); } }; AppStateSettings.Popups.Add(inp); }
private void circularMenuItem_Selected(object sender, MenuItemEventArgs e) { }
/// <summary> /// Handle a click on a player menu item. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Menu_ItemSelected(object sender, MenuItemEventArgs e) { switch (e.SelectedItem.Id) { case "Play": e.SelectedItem.Background = Brushes.Red; if (isPlaying) PausePlaying(); else StartPlaying(); break; case "Stop": StopPlaying(); break; case "SetPlayEndTime": SetPlayEndTime(); break; case "SetPlayStartTime": SetPlayStartTime(); break; case "Size_Sec": SetStepSize(e.SelectedItem.Id); break; case "Size_Min": SetStepSize(e.SelectedItem.Id); break; case "Size_Hr": SetStepSize(e.SelectedItem.Id); break; case "Size_Day": SetStepSize(e.SelectedItem.Id); break; case "Size_Mnth": SetStepSize(e.SelectedItem.Id); break; case "Size_Yr": SetStepSize(e.SelectedItem.Id); break; case "Size_Custom": CreateCustomStepMenu(e); //SetStepSize(e.SelectedItem.Id); break; default: int spd; if (int.TryParse(e.SelectedItem.Id.Replace("Speed_", ""), out spd)) SetPlaySpeed(spd); break; } }