public DataNodeTabViewModel(EditorEnvironment editorEnvironment) : base("DataNodes", editorEnvironment) { var nodeFactory = new DataNodeFactory(editorEnvironment); var comboBoxValues = new List <string> { "Test", "A", "42" }; nodeFactory.ComboBoxValueProviders["TestSelection"] = new ComboBoxValueProvider(() => comboBoxValues); editorEnvironment.NodeFactory = nodeFactory; EditorViewModel = new TreeEditorViewModel(editorEnvironment); EditorViewModel.AddDefaultCommands(); EditorViewModel.AddDefaultContextMenuCommands(); var catalogTypes = new List <Type> { typeof(SubData) }; EditorViewModel.CatalogItems.AddItems(NodeCatalogItem.CreateItemsForTypes(catalogTypes)); EditorViewModel.ContextMenuCommands.Add(Commands.ContextMenuCommand.Seperator); EditorViewModel.ContextMenuCommands.Add(new Commands.ContextMenuCommand("TestDataNodeWriteRead", TestDataNodeWriteRead)); EditorViewModel.ContextMenuCommands.Add(new Commands.ContextMenuCommand("WriteToFile", WriteToFile)); EditorViewModel.ContextMenuCommands.Add(new Commands.ContextMenuCommand("ReadFromFile", ReadFromFile)); EditorViewModel.ContextMenuCommands.Add(Commands.ContextMenuCommand.Seperator); var dialogRootNode = nodeFactory.CreateDataNode(typeof(RootData)); EditorViewModel.AddRootNode(dialogRootNode); }
void StartUp() { XmlDocument document = new XmlDocument(); document.LoadXml($"<?xml version=\"1.0\" encoding=\"utf - 8\"?><config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> <settings> </settings><pipes><pipe name=\"Name of Pipe\" id=\"{Guid.NewGuid()}\" numInstances=\"1\" ><input type=\"MSMQ\" id=\"{Guid.NewGuid()}\" name=\"Description of the Node\" /><output type=\"MSMQ\" id=\"{Guid.NewGuid()}\" name=\"Description of the Node\" /> </pipe></pipes></config>");; var xmlTreeViewModel = new TreeEditorViewModel(document, null, "new.xml*"); editorsVM.Add(xmlTreeViewModel); }
public DirectoryTabViewModel(EditorEnvironment editorEnvironment) : base("Directory", editorEnvironment) { editorEnvironment.NodeFactory = new TreeNodeFactory(editorEnvironment); EditorViewModel = new TreeEditorViewModel(editorEnvironment); EditorViewModel.AddRootNodes(GetDriveNodes()); EditorViewModel.Commands.Add(new Commands.EditorCommand("Refresh", "Reloads the directory info", () => { EditorViewModel.ClearRootNodes(); EditorViewModel.AddRootNodes(GetDriveNodes()); })); }
public DefaultTabViewModel(EditorEnvironment editorEnvironment) : base("Default", editorEnvironment) { editorEnvironment.NodeFactory = new TreeNodeFactory(editorEnvironment); EditorViewModel = new TreeEditorViewModel(editorEnvironment); EditorViewModel.AddDefaultCommands(); EditorViewModel.AddDefaultContextMenuCommands(); EditorViewModel.CatalogItems.AddItems(NodeCatalogItem.CreateItemsForAssignableTypes(typeof(IDefaultNode), Assembly.GetExecutingAssembly())); var containerNode = editorEnvironment.NodeFactory.CreateNode <DefaultContainer>(); EditorViewModel.AddRootNode(containerNode); }
private void StartUp() { if (args == null) { XmlDocument document = new XmlDocument(); document.LoadXml(Parameters.Template); var location = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase); var dir = new FileInfo(location.AbsolutePath).Directory; try { Directory.SetCurrentDirectory(dir.FullName); } catch (Exception ex) { Console.WriteLine("The specified directory does not exist. {0}", ex); } var xmlTreeViewModel = new TreeEditorViewModel(document, dir.ToString(), "new.xml"); editorsVM.Add(xmlTreeViewModel); } }
public DialogTabViewModel(EditorEnvironment editorEnvironment) : base("Dialog", editorEnvironment) { var nodeFactory = new CustomNodeFactory(editorEnvironment); editorEnvironment.NodeFactory = nodeFactory; EditorViewModel = new TreeEditorViewModel(editorEnvironment); EditorViewModel.AddDefaultCommands(); EditorViewModel.AddDefaultContextMenuCommands(); EditorViewModel.CatalogItems.AddItems(NodeCatalogItem.CreateItemsForAssignableTypes(typeof(DialogNode), Assembly.GetExecutingAssembly())); EditorViewModel.CatalogItems.Add(new NodeCatalogItem(ShowTextHelloWorldCatalogName, "Actions", "ShowText with 'Hello world!'", typeof(ShowTextAction))); EditorViewModel.ContextMenuCommands.Add(new Commands.ContextMenuCommand("Say 'Hello world!'", () => EditorViewModel.SelectedNode is ShowTextAction, () => (EditorViewModel.SelectedNode as ShowTextAction).Text = "Hello world!")); var dialogRootNode = nodeFactory.CreateDialogRootNode(); EditorViewModel.AddRootNode(dialogRootNode); }
//void commandBarView_SearchRequested(object sender, SearchRequestedEventArgs e) { // this.editorsVM.ActiveEditor.FindElementCommand.Execute(e.XPath); //} void CommandBarView_DocumentLoaded(object sender, DocumentLoadedEventArgs e) { var xmlTreeViewModel = new TreeEditorViewModel(e.Document, e.Path, e.FileName); editorsVM.Add(xmlTreeViewModel); }