ContextMenu CreateMenu() { MenuItem extMethodsItem = new MenuItem(); extMethodsItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowExternalMethods"); extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods; extMethodsItem.Click += delegate { extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods = !DebuggingOptions.Instance.ShowExternalMethods; WindowsDebugger.RefreshPads(); }; MenuItem moduleItem = new MenuItem(); moduleItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowModuleNames"); moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames; moduleItem.Click += delegate { moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames = !DebuggingOptions.Instance.ShowModuleNames; WindowsDebugger.RefreshPads(); }; MenuItem argNamesItem = new MenuItem(); argNamesItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentNames"); argNamesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentNames; argNamesItem.Click += delegate { argNamesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentNames = !DebuggingOptions.Instance.ShowArgumentNames; WindowsDebugger.RefreshPads(); }; MenuItem argValuesItem = new MenuItem(); argValuesItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentValues"); argValuesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentValues; argValuesItem.Click += delegate { argValuesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentValues = !DebuggingOptions.Instance.ShowArgumentValues; WindowsDebugger.RefreshPads(); }; MenuItem lineItem = new MenuItem(); lineItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowLineNumber"); lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers; lineItem.Click += delegate { lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers = !DebuggingOptions.Instance.ShowLineNumbers; WindowsDebugger.RefreshPads(); }; return(new ContextMenu() { Items = { extMethodsItem, new Separator(), moduleItem, argNamesItem, argValuesItem, lineItem } }); }
SharpTreeNodeAdapter MakeNode(string name) { LoggingService.Info("Evaluating watch: " + name); TreeNode node = null; try { node = new ValueNode(null, name, () => { if (string.IsNullOrWhiteSpace(name)) { return(null); } return(WindowsDebugger.Evaluate(name)); }); } catch (GetValueException e) { node = new TreeNode(null, name, e.Message, string.Empty, null); } node.CanDelete = true; node.CanSetName = true; node.PropertyChanged += (s, e) => { if (e.PropertyName == "Name") { WindowsDebugger.RefreshPads(); } }; return(node.ToSharpTreeNode()); }
void FillContextMenuStrip(object sender, RoutedEventArgs e) { var items = listView.SelectedItems.OfType <ThreadItem>(); // Suspended property is safe to access at any point bool suspended = items.All(t => t.Thread.Suspended); ContextMenu menu = sender as ContextMenu; menu.Items.Clear(); MenuItem freezeItem; freezeItem = new MenuItem(); freezeItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.Threads.Freeze"); freezeItem.IsChecked = suspended; freezeItem.Click += delegate { if (WindowsDebugger.CurrentProcess == null || WindowsDebugger.CurrentProcess.IsRunning) { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotFreezeWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.Freeze}"); return; } foreach (ThreadItem item in items.OfType <ThreadItem>()) { item.Thread.Suspended = !suspended; } WindowsDebugger.RefreshPads(); }; menu.Items.Add(freezeItem); }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; pad.Items.Remove(pad.Tree.SelectedItem as SharpTreeNodeAdapter); WindowsDebugger.RefreshPads(); } }
void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ThreadItem item = listView.SelectedItem as ThreadItem; if (WindowsDebugger.CurrentProcess != null) { if (WindowsDebugger.CurrentProcess.IsPaused) { WindowsDebugger.CurrentThread = item.Thread; WindowsDebugger.Instance.JumpToCurrentLine(); WindowsDebugger.RefreshPads(); } else { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}"); } } }
void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { CallStackItem item = listView.SelectedItem as CallStackItem; if ((item == null) || (item.Frame == null)) { return; } if (item.Frame.Process.IsPaused) { if (item.Frame != null) { WindowsDebugger.CurrentStackFrame = item.Frame; WindowsDebugger.Instance.JumpToCurrentLine(); WindowsDebugger.RefreshPads(); } } else { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.CallStack.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.CallStack.FunctionSwitch}"); } }