Interaction logic for ExploreView.xaml
Inheritance: System.Windows.Controls.UserControl
コード例 #1
0
        private TabItem AddTabItem()
        {
            int count = tabcount;

            Debug.WriteLine(count);
            // create new tab item
            var tab = new TabItem
            {
                Header         = string.Format("C:\\", count),
                Name           = $"tab{count}",
                HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate
            };



            ExploreView view = new ExploreView {
                Name = "Explore"
            };

            view.FillView("C:\\");
            tab.Content = view;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(_tabItems.Count - 1, tab);
            tabcount += 1;
            return(tab);
        }
コード例 #2
0
        private void OpenDrive(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount < 2)
            {
                return;
            }
            StackPanel panel = (StackPanel)sender;
            string     path  = "";

            foreach (
                var textBlock in
                panel.Children.OfType <FrameworkElement>().Where(child => child.Name == "Path").OfType <TextBlock>())
            {
                path = textBlock.Text;
            }
            var view = new ExploreView();

            view.FillView(path);
            var parentWindow = (MainWindow)Window.GetWindow(this);

            if (parentWindow == null)
            {
                return;
            }
            var tab = (TabItem)parentWindow.tabDynamic.SelectedItem;

            tab.Header  = path; // because it won't be too long. I hope...
            tab.Content = view;
        }
コード例 #3
0
        private TabItem AddTabItem()
        {
            int count = _tabItems.Count;
            // create new tab item
            TabItem tab = new TabItem();
            tab.Header = string.Format("C:\\", count);
            tab.Name = string.Format("tab{0}", count);
            tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;

            ExploreView view = new ExploreView();
            view.Name = "Explore";
            view.FillView("C:\\");
            tab.Content = view;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(count-1, tab);
            return tab;
        }
コード例 #4
0
ファイル: StartPage.xaml.cs プロジェクト: ethanhs/Explore10
 private void OpenDrive(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount < 2) return;
     StackPanel panel = (StackPanel) sender;
     string path = "";
     foreach (
         var textBlock in
             panel.Children.OfType<FrameworkElement>().Where(child => child.Name == "Path").OfType<TextBlock>())
     {
         path = textBlock.Text;
     }
     var view = new ExploreView();
     view.FillView(path);
     var parentWindow = (MainWindow) Window.GetWindow(this);
     if (parentWindow == null) return;
     var tab = (TabItem) parentWindow.tabDynamic.SelectedItem;
     tab.Header = path; // because it won't be too long. I hope...
     tab.Content = view;
 }
コード例 #5
0
        private void PowerShell(object sender, RoutedEventArgs e)
        {
            ProcessStartInfo powerShell = new ProcessStartInfo {
                FileName = "powershell"
            };

            try
            {
                ExploreView view = (ExploreView)tabDynamic.SelectedContent;
                powerShell.Arguments = "-NoExit -Command cd " + view.CurrDir;
            }
            catch //if we are in this pc view, the above will fail.
            {
                powerShell.Arguments = "-NoExit -Command cd " + Environment.SpecialFolder.UserProfile;
            }

            //If you want to make it open an admin command prompt, uncomment:
            //cmd.Verb = "runas";
            Process P = Process.Start(powerShell);
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: ethanhs/Explore10
        private TabItem AddTabItem()
        {
            int count = tabcount;
            Debug.WriteLine(count);
            // create new tab item
            var tab = new TabItem
            {
                Header = string.Format("C:\\", count),
                Name = $"tab{count}",
                HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate
            };



            ExploreView view = new ExploreView {Name = "Explore"};
            view.FillView("C:\\");
            tab.Content = view;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(_tabItems.Count-1, tab);
            tabcount += 1;
            return tab;
        }
コード例 #7
0
 private void OpenDrive(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount >= 2)
     {
         StackPanel panel = (StackPanel)sender;
         string path = "";
         foreach (object child in panel.Children)
         {
             if (child is FrameworkElement)
             {
                 if ((child as FrameworkElement).Name == "Path")
                 {
                     path = (child as TextBlock).Text;
                 }
             }
         }
         ExploreView view = new ExploreView();
         view.FillView(path);
         MainWindow parentWindow = (MainWindow)Window.GetWindow(this);
         TabItem tab = (TabItem)parentWindow.tabDynamic.SelectedItem;
         tab.Header = path; // because it won't be too long. I hope...
         tab.Content = view;
     }
 }