Esempio n. 1
0
        private ListPage addListPage(Directory path, bool isRoot = false, FileSystemItem selection = null)
        {
            // add new list
            ListPage list = null;

            try
            {
                list = new ListPage(path, isRoot, selection);
            }
            catch (UnauthorizedAccessException)
            {
                addMessagePage(ColumnMessages.AccessDenied);
                return(null);
            }

            stackMain.Children.Add(list);

            // subscribe to events
            list.SelectedMultiple  += list_SelectedMultiple;
            list.SelectedNothing   += list_SelectedNothing;
            list.SelectedFile      += list_SelectedFile;
            list.SelectedDirectory += list_SelectedDirectory;
            list.SelectedJump      += list_SelectedDirectory; // future: have settings to reset home?
            list.SelectedLink      += list_SelectedLink;
            list.ItemDoubleClicked += list_ItemDoubleClicked;

            return(list);
        }
Esempio n. 2
0
        private void trimRight(ListPage source)
        {
            var start  = stackMain.Children.IndexOf(source) + 1;
            var finish = stackMain.Children.Count - 1;

            stackMain.Children.RemoveRange(start, finish);
        }
Esempio n. 3
0
        /*Directory getLowestCommonAncestor(Directory path1, Directory path2)
         * {
         *  var chunks1 = path1.Path.Split('\\');
         *  var chunks2 = path2.Path.Split('\\');
         *
         *  var bloodLine = new List<String>();
         *  for (int i = 0; i < Math.Min(chunks1.Length, chunks2.Length); i++)
         *  {
         *      if (chunks1[i] != chunks2[i])
         *          break;
         *
         *      bloodLine.Add(chunks1[i]);
         *  }
         *
         *  if (bloodLine.Count == 0)
         *      return null;
         *  else
         *      return new Directory(String.Join("\\", bloodLine.ToArray()));
         * }*/

        private ListPage Navigate(ListPage source, Directory item, FileSystemItem selection = null)
        {
            // trim columns to right and add new list
            if (selection == null)
            {
                trimRight(source);
            }
            var list = addListPage(item, false, selection);

            navigationComplete(item);

            return(list);
        }
Esempio n. 4
0
 void list_SelectedMultiple(ListPage sender, Directory fromDirectory, FileSystemItem[] selection)
 {
     trimRight(sender);
     addInfoPage(selection);
 }
Esempio n. 5
0
 void list_SelectedNothing(ListPage sender, Directory fromDirectory)
 {
     trimRight(sender);
 }
Esempio n. 6
0
 void list_SelectedDirectory(ListPage sender, Directory fromDirectory, Directory selection)
 {
     //Navigate(selection);
     Navigate(sender, selection);
 }
Esempio n. 7
0
 void list_SelectedFile(ListPage sender, Directory fromDirectory, File selection)
 {
     trimRight(sender);
 }
Esempio n. 8
0
 void list_SelectedLink(ListPage sender, Directory fromDirectory, Link selection)
 {
     trimRight(sender);
 }