//TODO: make this more efficient public void CheckName(object sender, KeyEventArgs args) { if (args.Key == Key.Enter) { if (foldersonly) { FiledropsDirectory dir = this.fs.ConstructDirectory(Path.Combine( this.ExplorerControl.ListDisplay.RootDirectory.FullName, this.ExplorerControl.FileSelectBox.Text)); if (dir.Exists()) { this.SelectedEntry = dir; this.DialogResult = true; this.Close(); } } else { FiledropsFile file = this.fs.ConstructFile(Path.Combine( this.ExplorerControl.ListDisplay.RootDirectory.FullName, this.ExplorerControl.FileSelectBox.Text)); if (file.Exists()) { this.SelectedEntry = file; this.DialogResult = true; this.Close(); } } } }
public void CreateFileClick(object sender, EventArgs args) { FiledropsFileSystemEntry entry = this._lv.SelectedItem; if (entry != null) { this.NewType = entry; this.DialogResult = true; this.Close(); } else { if (entry != null) { _lv.BorderBrush = Brushes.Black; } else { _lv.BorderBrush = Brushes.Crimson; } } }
public void Confirm_Click(object sender, EventArgs args) { FiledropsFileSystemEntry entry; if (foldersonly) { entry = fs.ConstructDirectory(this.ExplorerControl.getInput()); if (entry.Exists() && entry.EntryType == FileSystemEntryType.Folder) { this.SelectedEntry = entry; this.DialogResult = true; this.Close(); } else { string messageBoxText = "You have to enter a Valid directory"; string caption = "Project Manager"; MessageBoxButton button = MessageBoxButton.OK; MessageBoxImage icon = MessageBoxImage.Warning; MessageBox.Show(messageBoxText, caption, button, icon); } } else { entry = fs.ConstructFile(this.ExplorerControl.getInput()); if (entry != null && entry.EntryType == FileSystemEntryType.File) { this.SelectedEntry = entry as FiledropsFile; this.DialogResult = true; this.Close(); } else { string messageBoxText = "You have to select a file in the list"; string caption = "Project Manager"; MessageBoxButton button = MessageBoxButton.OK; MessageBoxImage icon = MessageBoxImage.Warning; MessageBox.Show(messageBoxText, caption, button, icon); } } }
/// <summary> /// Returns a bitmapimage for a certain file. /// Note: size is currently NOT taken into account. /// </summary> /// <param name="entry"></param> /// <param name="foldertype"></param> /// <param name="size"></param> /// <param name="expanded"></param> /// <returns></returns> public virtual BitmapImage GetIcon(FiledropsFileSystemEntry entry, string foldertype = null, int size = 32, bool expanded = false) { BitmapImage image = null; if (entry is FiledropsFile) { FiledropsFile fi = entry as FiledropsFile; if (fi.Extension != null) { if (fi.Extension == ".xsd") { SCHEMA_ICONS.TryGetValue(fi.NameWithoutExtension, out image); } else { FILE_ICONS.TryGetValue(fi.Extension.Substring(1), out image); } } } else if (entry is FiledropsDirectory) { if (foldertype != null) { FiledropsDirectory di = entry as FiledropsDirectory; if (expanded) { OPENFOLDER_ICONS.TryGetValue(foldertype, out image); } else { CLOSEDFOLDER_ICONS.TryGetValue(foldertype, out image); } } } return image; }
public virtual ProjectInfo GetProjectFromSystemEntry(FiledropsFileSystemEntry e) { return GetProjectFromSystemEntry(e, this.projects); }
public ProjectInfo GetProjectFromSystemEntry(FiledropsFileSystemEntry e, Dictionary<string, ProjectInfo> dict) { /* FiledropsFileSystemEntry current = e; while (current != null && current.FullName != null && !(dict.ContainsKey(current.FullName) && current.EntryType.Equals(FileSystemEntryType.Folder))) { string tmp = current.FullName; current = current.Parent; if (current.FullName.Equals(tmp)) break; } if (current != null && dict.ContainsKey(current.FullName) && current.EntryType.Equals(FileSystemEntryType.Folder)) { return dict[current.FullName]; } */ foreach (ProjectInfo projectInfo in dict.Values) { if (e.FullName.StartsWith(projectInfo.Root.FullName)) { return projectInfo; } } return null; }
public void Check_File(object sender, EventArgs args) { FiledropsFileSystemEntry entry = fs.ConstructFile(this.ExplorerControl.getInput()); if (entry.Exists() && entry.EntryType == FileSystemEntryType.File) { this.SelectedEntry = entry; this.DialogResult = true; this.Close(); } }
private SolutionInfo GetSolutionFromSystemEntry(FiledropsFileSystemEntry e) { FiledropsFileSystemEntry current = e; while (current != null && current.FullName != null && !solutions.ContainsKey(Path.Combine(current.FullName, current.Name + "." + SXT))) { current = current.Parent; } if (current != null && solutions.ContainsKey(Path.Combine(current.FullName, current.Name + "." + SXT))) { return solutions[Path.Combine(current.FullName, current.Name + "." + SXT)]; } return null; }
public override ProjectInfo GetProjectFromSystemEntry(FiledropsFileSystemEntry e) { return GetProjectFromSystemEntry(e, GetAllProjects()); }