internal void sortByName() { SortedList <string, DIcon> list = new SortedList <string, DIcon>(new DuplicateKeyComparer <string>()); foreach (DIcon it in gridMain.Children) { list.Add(System.IO.Path.GetFileName(it.filename), it); } DIcon[] items = list.Values.ToArray(); int k = 0; for (int i = 0; i < wcount; i++) { for (int j = 0; j < hcount; j++) { if (k < items.Length) { items[k].setPosition(i, j); } else { DIconPositionManager.savePositions(); reCalculateItems(); return; } k++; } } }
public void setPosition(int x, int y) { this.x = x; this.y = y; SetValue(Grid.ColumnProperty, x); SetValue(Grid.RowProperty, y); DIconPositionManager.setPosition(filename, x, y); }
internal void moveTo(string[] fileList, int x, int y) { foreach (var f in fileList) { foreach (DIcon it in gridMain.Children) { if (it.filename == f) { items[it.x, it.y] = null; it.setPosition(x, y); placeIcon(it); } } } DIconPositionManager.savePositions(); }
internal void reName(string oldFullPath, string fullPath) { this.Dispatcher.Invoke((Action)(() => { DIconPositionManager.renamePosition(oldFullPath, fullPath); foreach (DIcon it in gridMain.Children) { if (it.filename == oldFullPath) { it.setFileName(fullPath); break; } } DIconPositionManager.savePositions(); })); }
internal void addNewIcon(string fullPath) { this.Dispatcher.Invoke((Action)(() => { if (isFileHidden(fullPath)) { return; } var p = DIconPositionManager.getPosition(fullPath); if (p.x == 0 && p.y == 0) { addNewIconToEnd(fullPath); } else { gridMain.Children.Add(placeIcon(new DIcon(this, fullPath, p.x, p.y))); } DIconPositionManager.savePositions(); })); }
public void loadIcons(string[] files) { DIconPositionManager.loadPositions(); foreach (var f in files) { if (isFileHidden(f)) { continue; } var p = DIconPositionManager.getPosition(f); if (p.x == 0 && p.y == 0) { addNewIconToEnd(f); } else { gridMain.Children.Add(placeIcon(new DIcon(this, f, p.x, p.y))); } } DIconPositionManager.savePositions(); }
internal void delete(string fullPath) { this.Dispatcher.Invoke((Action)(() => { DIconPositionManager.deletePosition(fullPath); int temp = -1; for (int i = 0; i < gridMain.Children.Count; i++) { if ((gridMain.Children[i] as DIcon).filename == fullPath) { temp = i; break; } } if (temp >= 0) { DIcon deleted = gridMain.Children[temp] as DIcon; gridMain.Children.RemoveAt(temp); items[deleted.x, deleted.y] = null; } DIconPositionManager.savePositions(); })); }