Beispiel #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            if (_args.Length > 0)
            {
                try
                {
                    string newPath = _args[0];

                    if (Directory.Exists(newPath))
                    {
                        UserControlExplorer curUCE = AddExplorer(tabControl1, "", true);
                        tabControl1.SelectedIndex = tabControl1.TabCount - 2;

                        if (curUCE != null)
                        {
                            curUCE.explorerBrowser.Navigate(ShellObject.FromParsingName(newPath));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
        }
Beispiel #2
0
        private void FormMain_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.Modifiers == Keys.Control) && (e.KeyCode == Keys.Add))
            {
                TabUp(current_uce.CurrentTabControl);
            }
            else if ((e.Modifiers == Keys.Control) && (e.KeyCode == Keys.Subtract))
            {
                TabDown(current_uce.CurrentTabControl);
            }
            else if ((e.Modifiers == Keys.Control) && (e.KeyCode == Keys.U))
            {
                if (current_uce == current_uce1)
                {
                    current_uce = current_uce2;
                }
                else
                {
                    current_uce = current_uce1;
                }

                MarkTabControl(current_uce.Parent.Parent.Name);
                current_uce.Focus();
            }
        }
Beispiel #3
0
        private void tabControlDragDrop(TabControl tc, DragEventArgs e)
        {
            String[] Params  = (String[])e.Data.GetData(DataFormats.FileDrop);
            string   myParam = Params[0];
            string   myDir;

            if (File.Exists(myParam))
            {
                myDir = Path.GetDirectoryName(myParam);
            }
            else
            {
                myDir = Path.GetFullPath(myParam);
            }

            try
            {
                AddExplorer(tc, "", true);
                tc.SelectedIndex = tc.TabCount - 2;

                UserControlExplorer cur_uce = tc.SelectedTab.Controls["UserControlExplorer"] as UserControlExplorer;
                cur_uce.explorerBrowser.Navigate(ShellFileSystemFolder.FromFolderPath(myDir));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Beispiel #4
0
 private void ResetAllTabPages(TabControl tc)
 {
     foreach (TabPage item in tc.TabPages)
     {
         if (item.Text != string.Empty)
         {
             UserControlExplorer my_uce = item.Controls["UserControlExplorer"] as UserControlExplorer;
             my_uce.ResetToLockedPath();
         }
     }
 }
Beispiel #5
0
 private void path_Changed(string pathname, string name, UserControlExplorer uce)
 {
     uce.Parent.Text = pathname;
     if ((uce.TabControlLocked == true) && (uce.LockedPath == pathname))
     {
         (uce.Parent as TabPage).ImageIndex = 0;
     }
     else if ((uce.TabControlLocked == true) && (uce.LockedPath != pathname))
     {
         (uce.Parent as TabPage).ImageIndex = 2;
     }
 }
Beispiel #6
0
        private void GetMyEvent(object sender, EventArgs e)
        {
            try
            {
                current_uce = (sender as UserControlExplorer);

                MarkTabControl(current_uce.Parent.Parent.Name);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Beispiel #7
0
        private void tabControl2_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                string curLocation = current_uce.explorerBrowser.NavigationLog.CurrentLocation.ParsingName;
                AddExplorer(tabControl1, "", true);
                tabControl1.SelectedIndex = tabControl1.TabCount - 2;

                UserControlExplorer cur_uce = tabControl1.SelectedTab.Controls["UserControlExplorer"] as UserControlExplorer;
                cur_uce.explorerBrowser.Navigate(ShellFileSystemFolder.FromFolderPath(curLocation));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Beispiel #8
0
        private void SetCurrentUCE(TabControl tabControlx)
        {
            if (tabControlx.SelectedTab.ImageIndex == 1)
            {
                AddExplorer(tabControlx, "", true);
                tabControlx.SelectedIndex = tabControlx.TabCount - 2;
            }
            else
            {
                try
                {
                    string sectionName = tabControlx.SelectedTab.Tag.ToString();
                    if (tabControlx == tabControl1)
                    {
                        current_uce1 = (tabControlx.SelectedTab.Controls["UserControlExplorer"] as UserControlExplorer);
                        current_uce  = current_uce1;
                    }
                    else if (tabControlx == tabControl2)
                    {
                        current_uce2 = (tabControlx.SelectedTab.Controls["UserControlExplorer"] as UserControlExplorer);
                        current_uce  = current_uce2;
                    }

                    foreach (TabPage tp in tabControlx.TabPages)
                    {
                        try
                        {
                            if (tp.Controls["UserControlExplorer"] is UserControlExplorer)
                            {
                                (tp.Controls["UserControlExplorer"] as UserControlExplorer).ShowSelected = false;
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex);
                        }
                    }

                    MarkTabControl(tabControlx.Name);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }
            current_uce.ShowSelected = true;
        }
Beispiel #9
0
        private UserControlExplorer AddExplorer(TabControl DestinationTabControl, string name, bool newMode)
        {
            if (DestinationTabControl == null)
            {
                return(null);
            }

            string newSectionName = applicationSettings.GetNewSectionName();

            if ((name != "") || (newSectionName != ""))
            {
                TabPage newTabPage = new TabPage();

                if (!newMode)
                {
                    DestinationTabControl.TabPages.Add(newTabPage);
                }
                else
                {
                    int insertPosition = DestinationTabControl.TabCount - 1;

                    DestinationTabControl.TabPages.Insert(insertPosition, newTabPage);   //Add(newTabPage);
                }

                UserControlExplorer uce = new UserControlExplorer(newSectionName, applicationSettings, name, DestinationTabControl, newTabPage);
                uce.Parent            = newTabPage;
                uce.Dock              = DockStyle.Fill;
                uce.MyEvent          += new MyDelegate(GetMyEvent);
                uce.pathChanged      += new UserControlExplorer.PathChanged(path_Changed);
                uce.myPreviewKeyDown += new UserControlExplorer.MyPreviewKeyDown(uce_myPreviewKeyDown);

                return(uce);
            }

            return(null);
        }