private void GetDirs(string path, int level) { //try //{ // path=Environment.GetFolderPath((Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), path, true)); //} //catch { } var itm = new Item { path = path, keyword = replace(Ikonka.getname(path)) }; files.Add(itm); if (level == 0) { return; } foreach (var b in Directory.GetFiles(path)) { var ke = Ikonka.getname(b); if (!files.Any(a => Ikonka.getname(a.path) == ke)) { files.Add(new Item { path = b, keyword = replace(ke) }); } } foreach (var b in Directory.GetDirectories(path)) { if (Directory.Exists(b)) { GetDirs(b, level - 1); } } }
void Update(Point pos) { double minvalue = double.MaxValue; Ikonka i = null; foreach (Ikonka ik in ikonki) { Vector p = VisualTreeHelper.GetOffset(ik); double a = Math.Min(minvalue, Math.Abs(p.X - pos.X + ik.Width / 2)); if (a < minvalue) { i = ik; minvalue = a; } var dest = 150; var b = Math.Max(0, dest - Math.Abs((pos.X - (ik.Width / 2)) - p.X)) / dest * .8; ik._ScaleTransform.ScaleX = ik._ScaleTransform.ScaleY = 1 + b; ik._ScaleTransform.CenterX = ik.Width / 2; ik._ScaleTransform.CenterY = ik.Height / 2; ik.Width = ik.ow + ik.ow * b; ik.Height = ik.oh + ik.oh * b; } if (i != null && selectedicon != i) { i.onmouseenter(); } }
public void UpdateSearch() { IEnumerable <Item> list = NewMethod(); //list = _DB.favs.Where(a => comp(a.keyword)).OrderBy(a => a.dt).Select(a => a.path).Concat(list); this.stackPanel.Children.Clear(); foreach (var item in list.Distinct().Take(8)) { Ikonka li = new Ikonka(); li.item = item; li.Load(); } if (ikonki.Count() > 0) { ikonki.First().onmouseenter(); } }
protected override void OnDrop(DragEventArgs e) { if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList()) { foreach (string filePath in ((System.Windows.DataObject)e.Data).GetFileDropList()) { Item ikon = new Item() { path = filePath }; ikon.dt = DateTime.Now; ikon.keyword = txt + "" + replace(Ikonka.getname(filePath)); db.favs.Add(ikon); } UpdateSearch(); SaveXml(); } }
public void UpdateSearch() { IEnumerable<Item> list = NewMethod(); //list = _DB.favs.Where(a => comp(a.keyword)).OrderBy(a => a.dt).Select(a => a.path).Concat(list); this.stackPanel.Children.Clear(); foreach (var item in list.Distinct().Take(8)) { Ikonka li = new Ikonka(); li.item = item; li.Load(); } if (ikonki.Count() > 0) ikonki.First().onmouseenter(); }