public void GetTreeViewData(System.IO.DirectoryInfo dir, ReadProgramFolderItemViewModel node) { System.IO.DirectoryInfo[] allDs = dir.GetDirectories(); node.Nodes = new ObservableCollection <ReadProgramFolderItemViewModel>(); for (int i = 0; i < allDs.Length; i++) { ReadProgramFolderItemViewModel child = new ReadProgramFolderItemViewModel(); child.Name = allDs[i].Name; child.Folder = allDs[i].FullName; node.Nodes.Add(child); GetTreeViewData(allDs[i], child); } }
private void GetProgramFolder(JObject jObject) { ReadProgramFolderItemViewModel readProgramFolder = new ReadProgramFolderItemViewModel(); if (jObject != null) { readProgramFolder.RegNum = (int)jObject["regNum"]; readProgramFolder.Name = jObject["name"].ToString(); readProgramFolder.Folder = jObject["folder"].ToString(); var jArray = JArray.Parse(jObject["nodes"].ToString()); ReadProgramFolderNode(jArray, readProgramFolder); ProgramConfigConsts.CurrentReadProgramFolder = readProgramFolder; } }
private void ReadProgramFolderNode(JArray jArray, ReadProgramFolderItemViewModel node) { if (jArray == null) { return; } node.Nodes = new System.Collections.ObjectModel.ObservableCollection <ReadProgramFolderItemViewModel>(); foreach (var item in jArray) { var childNode = new ReadProgramFolderItemViewModel { RegNum = (int)item["regNum"], Name = item["name"].ToString(), Folder = item["folder"].ToString(), }; node.Nodes.Add(childNode); ReadProgramFolderNode(JArray.Parse(item["nodes"].ToString()), childNode); } }
public ProgramDetailViewModel() { SelectedProgramFolders = new ReadProgramFolderItemViewModel(); }
public CNCPathViewModel(ReadProgramFolderItemViewModel programFolderInfo) { ProgramFolders = programFolderInfo; SelectedProgramFolders = programFolderInfo; }
public CNCPathControl(ReadProgramFolderItemViewModel readProgramFolder) { InitializeComponent(); this.DataContext = cncPathVM = new CNCPathViewModel(readProgramFolder); }