Пример #1
0
        protected virtual void btnNewTab_Click(object sender, RoutedEventArgs e)
        {
            TabItemUI ti = this.CreateTabItem(this.pathUI.Path);

            this.tabControl.Items.Add(ti);
            this.tabControl.SelectedItem = ti;
        }
Пример #2
0
        public bool Load()
        {
            bool flg = true;

            try
            {
                FileStream             fs   = new FileStream(SaveFileName, FileMode.Open, FileAccess.Read);
                DataContractSerializer s    = new DataContractSerializer(typeof(DatSaveInfo));
                DatSaveInfo            info = (DatSaveInfo)s.ReadObject(fs);
                fs.Close();

                foreach (string path in info.Path)
                {
                    TabItemUI ti = this.CreateTabItem(ShellObject.FromParsingName(path));
                    this.tabControl.Items.Add(ti);
                }
                this.tabControl.SelectedIndex = info.SelectedIndex;
                foreach (KeyValuePair <string, string> kv in info.BookMarks)
                {
                    this.BookMarks.Add(kv);
                }
            }
            catch (Exception)
            {
                flg = false;
            }

            return(flg);
        }
Пример #3
0
        /// <summary>
        /// 今使ってない
        /// </summary>
        /// <returns></returns>
        protected virtual ContextMenu CreateContextMenu()
        {
            ContextMenu cm = new ContextMenu();
            MenuItem    mi = new MenuItem();

            mi.Header = "Property";
            mi.Click += (o, e) =>
            {
                TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;
                if (ti != null)
                {
                    List <string> lst = new List <string>();
                    foreach (var obj in ti.DispGrid.SelectedItems)
                    {
                        FileSystemInfo fsi = obj as FileSystemInfo;
                        if (fsi != null)
                        {
                            lst.Add(fsi.FullName);
                        }
                    }
                    if (lst.Count == 1)
                    {
                        Shell32Wrapper.ShowProperty(this.ParentHandle, lst[0]);
                    }
                    else if (lst.Count > 1)
                    {
                        //動かん
                        //Shell32Wrapper.ShowMultiFileProperties(lst.ToArray());
                    }
                }
            };
            cm.Items.Add(mi);

            return(cm);
        }
Пример #4
0
        protected virtual void TabSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;

            if (ti != null)
            {
                this.pathUI.PropertyChanged -= PathPropertyChanged;
                this.pathUI.Path             = ti.Get();
                this.pathUI.PropertyChanged += PathPropertyChanged;
            }
        }
Пример #5
0
        public virtual void ClearInitialize()
        {
            this.tabControl.Items.Clear();

            string    mydoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            TabItemUI ti    = this.CreateTabItem(mydoc);

            this.tabControl.Items.Add(ti);
            this.tabControl.SelectedItem = ti;

            this.TreeViewInitialize(mydoc);
        }
Пример #6
0
 private void InternalKeyBindExecute(object sender, KeyBindInternalEventArgs e)
 {
     switch (e.Kbn)
     {
     case EKeyBindInternalKbn.ReDisp:
         TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;
         if (ti != null)
         {
             ti.ReDisp();
         }
         break;
     }
 }
Пример #7
0
        protected virtual TabItemUI CreateTabItem(string path)
        {
            TabItemUI ti = new TabItemUI();

            ti.MaxWidth = 100;
            ti.Header   = System.IO.Path.GetFileName(path);

            ti.DispGrid = this.CreateDataGrid();
            ti.Go(path);
            ti.Content = ti.DispGrid;

            return(ti);
        }
Пример #8
0
        protected virtual TabItemUI CreateTabItem(ShellObject path)
        {
            TabItemUI ti = new TabItemUI();

            ti.MaxWidth = 100;
            ti.Header   = System.IO.Path.GetFileName(path.GetDisplayName(DisplayNameType.Default));

            ti.Go(path);

            ti.DispExpBrowser.ExplorerBrowserControl.NavigationComplete += (o, e) =>
            {
                Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser b = (Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser)o;
                b.Tag = e.NewLocation;

                TabItemUI tiui = this.tabControl.SelectedItem as TabItemUI;
                if (ti != null)
                {
                    this.pathUI.PropertyChanged -= PathPropertyChanged;
                    this.pathUI.Path             = tiui.Get();
                    this.pathUI.PropertyChanged += PathPropertyChanged;

                    tiui.Header = e.NewLocation.Name;
                    tiui.DispExpBrowser.ViewMode = Microsoft.WindowsAPICodePack.Controls.ExplorerBrowserViewMode.Details;
                }
            };

            ContextMenu cm = new ContextMenu();
            MenuItem    mi = new MenuItem();

            mi.Header = "Close";
            mi.Click += (o, e) =>
            {
                this.tabControl.Items.Remove(ti);
            };
            cm.Items.Add(mi);

            mi        = new MenuItem();
            mi.Header = "BookMark";
            mi.Click += (o, e) =>
            {
                ShellObject shobj = (ShellObject)((TabItemUI)this.tabControl.SelectedItem).DispExpBrowser.ExplorerBrowserControl.Tag;
                string      key   = shobj.ParsingName;
                string      val   = shobj.Name;
                this.BookMarks.Add(new KeyValuePair <string, string>(key, val));
            };
            cm.Items.Add(mi);

            ti.ContextMenu = cm;

            return(ti);
        }
Пример #9
0
        protected virtual void PathPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;

            if (ti != null)
            {
                ti.Header = System.IO.Path.GetFileName(this.pathUI.Path);
                if (string.IsNullOrEmpty((string)ti.Header))
                {
                    ti.Header = this.pathUI.Path;
                }

                ti.Go(this.pathUI.Path);
            }
        }
Пример #10
0
        protected virtual void btnNext_Click(object sender, RoutedEventArgs e)
        {
            TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;

            if (ti != null)
            {
                string tmp = ti.NextPath();
                if (!string.IsNullOrEmpty(tmp))
                {
                    this.pathUI.PropertyChanged -= PathPropertyChanged;
                    this.pathUI.Path             = tmp;
                    this.pathUI.PropertyChanged += PathPropertyChanged;
                }
            }
        }
Пример #11
0
        protected virtual void btnNewTab_Click(object sender, RoutedEventArgs e)
        {
            ShellObject path = null;

            if (this.tabControl.Items.Count == 0)
            {
                path = (ShellObject)KnownFolders.Desktop;
            }
            else
            {
                path = ((TabItemUI)this.tabControl.SelectedItem).DispExpBrowser.ExplorerBrowserControl.Tag as ShellObject;
            }

            if (path != null)
            {
                TabItemUI ti = this.CreateTabItem(path);
                this.tabControl.Items.Add(ti);
                this.tabControl.SelectedItem = ti;
            }
        }
Пример #12
0
        public virtual void ClearInitialize()
        {
            this.SaveFileName = "FilerPrevInfo_" + this.Name + ".xml";
            this.tabControl.Items.Clear();

            bool flg = true;

            if (File.Exists(this.SaveFileName))
            {
                flg = !this.Load();
            }

            if (flg)
            {
                string mydoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                TabItemUI ti = this.CreateTabItem((ShellObject)KnownFolders.Desktop);
                this.tabControl.Items.Add(ti);
                this.tabControl.SelectedItem = ti;
            }
        }
Пример #13
0
        protected virtual void FileMove(string[] files)
        {
            SHFILEOPSTRUCT info = new SHFILEOPSTRUCT();

            info.hwnd  = this.ParentHandle;
            info.wFunc = FOFunc.FO_MOVE;

            //ファイル名の区切りは'\0'で最後にはもう一つ'\0'が必要
            foreach (string f in files)
            {
                info.pFrom = f + '\0';
            }
            info.pFrom = info.pFrom + '\0';
            info.pTo   = this.pathUI.Path;

            Shell32Wrapper.SHFileOperation(ref info);

            TabItemUI ti = this.tabControl.SelectedItem as TabItemUI;

            if (ti != null)
            {
                ti.ReDisp();
            }
        }