Exemplo n.º 1
0
 //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();
             }
         }
     }
 }
Exemplo n.º 2
0
		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;
				}				
			}
		}
Exemplo n.º 3
0
 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);
         }
     }
 }
Exemplo n.º 4
0
        /// <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;
        }
Exemplo n.º 5
0
 public virtual ProjectInfo GetProjectFromSystemEntry(FiledropsFileSystemEntry e)
 {
     return GetProjectFromSystemEntry(e, this.projects);
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
 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();
     }
 }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 public override ProjectInfo GetProjectFromSystemEntry(FiledropsFileSystemEntry e)
 {
     return GetProjectFromSystemEntry(e, GetAllProjects());
 }