public ExplorerNode(string fp, string name, DateTime chg, explType tp, long sz, Icon ic = null) { this.fullpath = fp; this.Type = tp; this.EdsState = 0; InitializeComponent(); this.expl_name.Text = name; this.expl_chng_date.Text = chg.ToLongTimeString(); this.expl_type.Text = (tp == explType.File ? "Файл" : "Папка"); if (sz < 1024) { this.expl_size.Text = sz.ToString() + " Б"; } else { this.expl_size.Text = (sz / 1024).ToString() + " Кб"; } if (ic == null) { this.expl_ico.Source = new BitmapImage(new Uri("Images/ExplorerNode/Folder.png", UriKind.Relative)); } else { this.expl_ico.Source = SupportEDS.BitmapToImageSource(ic.ToBitmap()); } if (tp == explType.File) { this.expl_state.Visibility = Visibility.Visible; } }
public void AddExplorerNode(string path, string name, DateTime chg, explType type, long size, bool haveEds = false) { ExplorerNode node; if (type == explType.Folder) { node = new ExplorerNode(path, name, chg, type, size); node.MouseDoubleClick += Node_MouseDoubleClick; } else { node = new ExplorerNode(path, name, chg, type, size, Icon.ExtractAssociatedIcon(path)); } if (haveEds) { node.EdsState = 1; } else { node.EdsState = 0; } node.Height = this.HeightNode; Binding binding = new Binding(); binding.Source = this.listbox; binding.Path = new PropertyPath("ActualWidth"); binding.Mode = BindingMode.OneWay; node.SetBinding(WidthProperty, binding); this.listbox.Items.Add(node); }
public ExplorerNode(string fp, explType tp) { this.fullpath = fp; InitializeComponent(); this.expl_name.Text = fp; this.expl_chng_date.Text = ""; this.Type = tp; this.expl_type.Text = "Ключи"; this.expl_size.Text = ""; this.expl_ico.Source = new BitmapImage(new Uri("Images/ExplorerNode/Key.png", UriKind.Relative)); }