Esempio n. 1
0
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (SelectedItem != null)
     {
         FSItemVM item = SelectedItem as FSItemVM;
         CurrentFolder = item.FullPath;
     }
 }
Esempio n. 2
0
 protected void HandleDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (AllowNavigation)
     {
         //((ListViewItem)sender).
         FSItemVM info = ((ListViewItem)sender).Content as FSItemVM; //.Content as Track; //Casting back to the binded Track
         if (info.type == FSItemType.Folder)
         {
             CurrentFolder = info.FullPath;
         }
     }
 }
Esempio n. 3
0
        void PopulateView()
        {
            CurrentItems.Clear();
            System.Drawing.Icon icon;
            icon = Etier.IconHelper.IconReader.GetFolderIcon(Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed);

            try
            {
                foreach (string s in Directory.EnumerateDirectories(CurrentFolder))
                {
                    FSItemVM info = new FSItemVM()
                    {
                        FullPath    = s,
                        DisplayName = System.IO.Path.GetFileName(s),
                        type        = FSItemType.Folder,
                        DisplayIcon = Etier.IconHelper.IconReader.GetFolderIcon(s, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource()
                    };
                    CurrentItems.Add(info);
                }
            } catch (Exception) {}

            try
            {
                foreach (string s in Directory.EnumerateFiles(CurrentFolder))
                {
                    FSItemVM info = new FSItemVM()
                    {
                        FullPath = s, DisplayName = System.IO.Path.GetFileName(s), type = FSItemType.File
                    };
                    try
                    {
                        icon             = Etier.IconHelper.IconReader.GetFileIcon(info.FullPath, Etier.IconHelper.IconReader.IconSize.Small, false);
                        info.DisplayIcon = icon.ToImageSource();
                    }
                    catch (Exception)
                    {
                        info.DisplayIcon = null;
                    }
                    CurrentItems.Add(info);
                }
            }
            catch (Exception) { }

            if (RecentFolders.Count == 0 || String.Compare(CurrentFolder, RecentFolders.Last()) != 0)
            {
                RecentFolders.Push(CurrentFolder);
            }
            if (ClearFuture)
            {
                FutureFolders.Clear();
            }
        }
Esempio n. 4
0
        void PopulateView()
        {
            CurrentItems.Clear();
            System.Drawing.Icon icon;
            icon = Etier.IconHelper.IconReader.GetFolderIcon(Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed);

            // add special folders
            //ShellObject o = (ShellObject)KnownFolders.Desktop;
            foreach (IKnownFolder o in new IKnownFolder[] { KnownFolders.Desktop, KnownFolders.Documents })
            {
                //string s = o. //Environment.GetFolderPath(spf);
                FSItemVM info = new FSItemVM()
                {
                    FullPath    = o.Path,
                    DisplayName = o.LocalizedName,                        //System.IO.Path.GetFileName(s),
                    type        = FSItemType.Folder,
                    DisplayIcon = ((ShellObject)o).Thumbnail.BitmapSource //Etier.IconHelper.IconReader.GetFolderIcon(s, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource()
                };
                CurrentItems.Add(info);
            }

            /*foreach (ShellObject o in KnownFolders.Desktop)
             * {
             *  FSItemVM info = new FSItemVM()
             *  {
             *      FullPath = o.ParsingName,
             *      DisplayName = o.Name, //System.IO.Path.GetFileName(s),
             *      type = FSItemType.Folder,
             *      DisplayIcon = ((ShellObject)o).Thumbnail.BitmapSource//Etier.IconHelper.IconReader.GetFolderIcon(s, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource()
             *  };
             *  CurrentItems.Add(info);
             * }*/

            // add drives
            foreach (string s in Directory.GetLogicalDrives())
            {
                FSItemVM info = new FSItemVM()
                {
                    FullPath    = s,
                    DisplayName = s,//System.IO.Path.GetFileName(s),
                    type        = FSItemType.Folder,
                    DisplayIcon = Etier.IconHelper.IconReader.GetFolderIcon(s, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource()
                };
                CurrentItems.Add(info);

                // add items under current folder
                if (String.Compare(System.IO.Path.GetPathRoot(CurrentFolder), s, true) == 0)
                {
                    string[] dirs = CurrentFolder.Split(new char[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 1; i < dirs.Length; i++)
                    {
                        string curdir = String.Join("" + System.IO.Path.DirectorySeparatorChar, dirs, 0, i + 1);
                        info = new FSItemVM()
                        {
                            FullPath    = curdir,
                            DisplayName = dirs[i],//System.IO.Path.GetFileName(s),
                            type        = FSItemType.Folder,
                            DisplayIcon = Etier.IconHelper.IconReader.GetFolderIcon(curdir, Etier.IconHelper.IconReader.IconSize.Small, Etier.IconHelper.IconReader.FolderType.Closed).ToImageSource(),
                            Indentation = i * 10
                        };
                        CurrentItems.Add(info);
                    }
                    SelectedItem = CurrentItems[CurrentItems.Count - 1];
                }
            }
        }