private static List <string> GetPath(List <string> path, IoDeviceDirectoryItem item) { if (item == null) { return(path); } path.Insert(0, item.ItemName); var parent = item.Parent as IoDeviceDirectoryItem; return(parent != null?GetPath(path, parent) : path); }
private void IoDeviceTypeEditorLoaded(object sender, RoutedEventArgs e) { Loaded -= IoDeviceTypeEditorLoaded; if (!DesignerProperties.GetIsInDesignMode(this)) { string path = string.Join( Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture), Path.GetDirectoryName(Assembly.GetAssembly(typeof(IoDeviceTypeEditor)).Location), PHmiConstants.PHmiIoDevicesDirectoryName); foreach (TreeViewItem i in IoDeviceDirectoryItem.GetItems(path)) { treeView.Items.Add(i); } Action action = () => UpdateType(Type); Dispatcher.BeginInvoke(action); } }
private static List<string> GetPath(List<string> path, IoDeviceDirectoryItem item) { if (item == null) return path; path.Insert(0, item.ItemName); var parent = item.Parent as IoDeviceDirectoryItem; return parent != null ? GetPath(path, parent) : path; }