static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) { return; } var propNode = (PropertyTreeNode)nodes[0]; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } var data = new PropertyOptionsVM(new PropertyDefOptions(propNode.PropertyDefinition), module, MainWindow.Instance.CurrentLanguage, propNode.PropertyDefinition.DeclaringType); var win = new PropertyOptionsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } UndoCommandManager.Instance.Add(new PropertyDefSettingsCommand(propNode, data.CreatePropertyDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) { return; } var ownerNode = nodes[0]; if (!(ownerNode is TypeTreeNode)) { ownerNode = (ILSpyTreeNode)ownerNode.Parent; } var typeNode = ownerNode as TypeTreeNode; Debug.Assert(typeNode != null); if (typeNode == null) { throw new InvalidOperationException(); } var module = ILSpyTreeNode.GetModule(typeNode); Debug.Assert(module != null); if (module == null) { throw new InvalidOperationException(); } bool isInstance = !(typeNode.TypeDefinition.IsAbstract && typeNode.TypeDefinition.IsSealed); var options = PropertyDefOptions.Create(module, "MyProperty", isInstance); var data = new PropertyOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, typeNode.TypeDefinition); var win = new PropertyOptionsDlg(); win.Title = "Create Property"; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) { return; } UndoCommandManager.Instance.Add(new CreatePropertyDefCommand(typeNode, data.CreatePropertyDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) return; var propNode = (PropertyTreeNode)nodes[0]; var module = ILSpyTreeNode.GetModule(nodes[0]); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); var data = new PropertyOptionsVM(new PropertyDefOptions(propNode.PropertyDefinition), module, MainWindow.Instance.CurrentLanguage, propNode.PropertyDefinition.DeclaringType); var win = new PropertyOptionsDlg(); win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; UndoCommandManager.Instance.Add(new PropertyDefSettingsCommand(propNode, data.CreatePropertyDefOptions())); }
static void Execute(ILSpyTreeNode[] nodes) { if (!CanExecute(nodes)) return; var ownerNode = nodes[0]; if (!(ownerNode is TypeTreeNode)) ownerNode = (ILSpyTreeNode)ownerNode.Parent; var typeNode = ownerNode as TypeTreeNode; Debug.Assert(typeNode != null); if (typeNode == null) throw new InvalidOperationException(); var module = ILSpyTreeNode.GetModule(typeNode); Debug.Assert(module != null); if (module == null) throw new InvalidOperationException(); bool isInstance = !(typeNode.TypeDefinition.IsAbstract && typeNode.TypeDefinition.IsSealed); var options = PropertyDefOptions.Create(module, "MyProperty", isInstance); var data = new PropertyOptionsVM(options, module, MainWindow.Instance.CurrentLanguage, typeNode.TypeDefinition); var win = new PropertyOptionsDlg(); win.Title = "Create Property"; win.DataContext = data; win.Owner = MainWindow.Instance; if (win.ShowDialog() != true) return; UndoCommandManager.Instance.Add(new CreatePropertyDefCommand(typeNode, data.CreatePropertyDefOptions())); }