示例#1
0
 public void AppendMenuItem(FileContextMenuItem item)
 {
     listView1.Items.Add(new ListViewItem(new string[] { item.Title, item.AppName, item.Arguments })
     {
         Tag = item
     });
 }
示例#2
0
        private void AddItemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var f = new FileContextMenuItem()
            {
                Title = "new item", AppName = "cmd.exe"
            };

            Stuff.FileContextMenuItems.Add(f);
            AppendMenuItem(f);
            Stuff.IsDirty = true;
        }
示例#3
0
        private void SetMenuClickedEventArgs(FileContextMenuItem MenuItem, ActivityConfig.ACSeriesRow acs)
        {
            appDB.EFileSearchRow efilerow   = null;
            docDB.DocXRefRow     docxrefrow = null;
            TreeNode             nd         = null;

            try
            {
                nd = (TreeNode)uiCommandManager1.Tag;
                if (nd.Tag.GetType() == typeof(appDB.EFileSearchRow))
                {
                    efilerow = (appDB.EFileSearchRow)nd.Tag;
                }
                else if (nd.Tag.GetType() == typeof(docDB.DocXRefRow))
                {
                    docxrefrow = (docDB.DocXRefRow)nd.Tag;
                }


                //efilerow = (appDB.EFileSearchRow)nd.Tag;
            }
            catch (Exception x)
            {
                efilerow = (appDB.EFileSearchRow)uiCommandManager1.Tag;
            }

            if (ContextMenuClicked != null)
            {
                FileContextEventArgs fe = new FileContextEventArgs();
                fe.MenuItem     = MenuItem;
                fe.SelectedFile = efilerow;
                fe.ACSeries     = acs;
                fe.Node         = nd;
                ContextMenuClicked(this, fe);
            }
        }
示例#4
0
        public static void LoadSettings()
        {
            if (!File.Exists("settings.xml"))
            {
                return;
            }
            var findex = new FileIndex()
            {
                FileName = "settings.xml", RootPath = Application.StartupPath
            };

            using (FileStream fs = new FileStream("settings.xml", FileMode.Open, FileAccess.Read))
            {
                findex.Load(fs, new DirectoryInfoWrapper(new DirectoryInfo(Application.StartupPath)), "settings.xml");
            }

            FileIndexes.Add(findex);

            var s  = XDocument.Load("settings.xml");
            var fr = s.Descendants("settings").First();

            Stuff.PasswordHash = fr.Attribute("password").Value;
            foreach (var descendant in s.Descendants("path"))
            {
                RecentPathes.Add(descendant.Value);
            }

            List <DirectoryEntry> direntries  = new List <DirectoryEntry>();
            List <FileEntry>      fileentries = new List <FileEntry>();

            //#region load directory and files entries
            //var entries = s.Descendants("entries").First();
            //foreach (var item in entries.Descendants("directory"))
            //{
            //    var id = int.Parse(item.Attribute("id").Value);
            //    var path = item.Value;
            //    //var dir = new DirectoryInfo(path);
            //    //path = dir.Parent.GetDirectories(dir.Name).First().FullName;
            //    direntries.Add(new DirectoryEntry() { Id = id, Path = path });
            //}
            //foreach (var item in entries.Descendants("file"))
            //{
            //    var id = int.Parse(item.Attribute("id").Value);
            //    var dirId = int.Parse(item.Attribute("dirId").Value);
            //    var name = item.Value;

            //    var dir = direntries.First(z => z.Id == dirId);
            //    //var path = Path.Combine(dir.Path, name);
            //    //var diri = new DirectoryInfo(dir.Path);
            //    //name = diri.GetFiles(name).First().Name;

            //    fileentries.Add(new FileEntry() { Id = id, Directory = dir, Name = name });
            //}
            //#endregion


            //#region meta

            //var metas = s.Descendants("meta").FirstOrDefault();
            //if (metas != null)
            //{
            //    foreach (var item in metas.Descendants("file"))
            //    {
            //        var fid = int.Parse(item.Attribute("fileId").Value);
            //        var f = fileentries.First(z => z.Id == fid);
            //        Stuff.MetaInfos.Add(new FileMetaInfo() { File = new FileInfoWrapper(new FileInfo(f.FullName)) });
            //        var minf = Stuff.MetaInfos.Last();

            //        foreach (var kitem in item.Descendants())
            //        {
            //            if (kitem.Name == "keywordsMetaInfo")
            //            {
            //                minf.Infos.Add(new KeywordsMetaInfo() { Parent = minf, Keywords = kitem.Value });
            //            }

            //        }

            //    }
            //}
            //#endregion
            foreach (var descendant in s.Descendants("tab"))
            {
                var hint   = descendant.Attribute("hint").Value;
                var owner  = descendant.Attribute("owner").Value;
                var path   = descendant.Attribute("path").Value;
                var filter = descendant.Attribute("filter").Value;

                var tab = new TabInfo()
                {
                    Filter = filter, Path = path, Hint = hint
                };
                tab.Owner = owner;
                Stuff.AddTab(tab);
            }

            foreach (var descendant in s.Descendants("library"))
            {
                var name = descendant.Attribute("name").Value;
                var path = descendant.Attribute("path").Value;
                Stuff.Libraries.Add(new FilesystemLibrary()
                {
                    Name = name, BaseDirectory = new DirectoryInfoWrapper(path)
                });
            }

            foreach (var descendant in s.Descendants("hotkey"))
            {
                var path    = descendant.Attribute("path").Value;
                var enabled = bool.Parse(descendant.Attribute("enabled").Value);
                var key     = (Keys)Enum.Parse(typeof(Keys), descendant.Attribute("key").Value);
                Stuff.Hotkeys.Add(new HotkeyShortcutInfo()
                {
                    IsEnabled = enabled, Hotkey = key, Path = path
                });
            }

            foreach (var descendant in s.Descendants("shortcut"))
            {
                var name = descendant.Attribute("name").Value;

                if (descendant.Attribute("type") != null)
                {
                    var tp = descendant.Attribute("type").Value;
                    switch (tp)
                    {
                    case "url":
                        var url = descendant.Element("url").Value;
                        Stuff.Shortcuts.Add(new UrlShortcutInfo(name, url));
                        break;

                    case "cmd":
                        var    wd   = descendant.Attribute("workdir").Value;
                        string args = null;
                        if (descendant.Element("args") != null)
                        {
                            args = descendant.Element("args").Value;
                        }

                        string appName = null;
                        if (descendant.Element("app") != null)
                        {
                            appName = descendant.Element("app").Value;
                        }
                        Stuff.Shortcuts.Add(new CmdShortcutInfo(name, args, wd, appName));
                        break;
                    }
                }
                else
                {
                    var path = descendant.Attribute("path").Value;
                    Stuff.Shortcuts.Add(new AppShortcutInfo(path, name));
                }
            }

            //foreach (var descendant in s.Descendants("tag"))
            //{
            //    var name = descendant.Attribute("name").Value;

            //    string flags = "";
            //    if (descendant.Attribute("flags") != null) { flags = descendant.Attribute("flags").Value; }

            //    var tag = new TagInfo() { Name = name, IsHidden = flags.Contains("hidden") };

            //    var snms = descendant.Descendants("synonym");
            //    foreach (var item in snms)
            //    {
            //        tag.Synonyms.Add(item.Value.Trim());
            //    }

            //    Stuff.Tags.Add(tag);
            //    foreach (var item in descendant.Descendants("file"))
            //    {
            //        var arr1 = item.Attribute("id").Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
            //        foreach (var aitem in arr1)
            //        {
            //            var ff = fileentries.First(z => z.Id == aitem);
            //            tag.AddFile(new FileInfoWrapper(ff.FullName));
            //        }
            //    }
            //}

            foreach (var descendant in s.Descendants("fileContextMenuItem"))
            {
                var    title   = descendant.Attribute("title").Value;
                var    appName = descendant.Attribute("appName").Value;
                string args    = null;
                if (descendant.Element("arguments") != null)
                {
                    args = descendant.Element("arguments").Value;
                }
                var f = new FileContextMenuItem()
                {
                    Title = title, AppName = appName, Arguments = args
                };
                Stuff.FileContextMenuItems.Add(f);
            }
            foreach (var descendant in s.Descendants("site"))
            {
                var path = descendant.Value;
                var f    = new OfflineSiteInfo()
                {
                    Path = path
                };
                Stuff.OfflineSites.Add(f);
            }
            var root = s.Descendants("bookmarks").First();

            LoadBookmarks(root);
        }
示例#5
0
        public void EnableMenuItem(bool EnableItem, FileContextMenuItem MenuItem)
        {
            Janus.Windows.UI.CommandBars.UICommand ts;
            switch (MenuItem)
            {
            case FileContextMenuItem.FileAKAs:
                ts = cmdFileAKA;
                break;

            case FileContextMenuItem.BrowseFileInExplorer:
                ts = cmdExplorerFindFile;
                break;

            case FileContextMenuItem.FileXrefView:
                ts = cmdJumpToXref;
                break;

            case FileContextMenuItem.FileXrefDelete:
                ts = cmdDeleteXRef;
                break;

            case FileContextMenuItem.DocXrefViewInExternalApp:
                ts = cmdViewInExternal;
                break;

            case FileContextMenuItem.DocXrefViewInLMViewer:
                ts = cmdViewInLMViewer;
                break;

            case FileContextMenuItem.DocXrefMove:
                ts = cmdMove;
                break;

            case FileContextMenuItem.DocXrefJumpToFile:
                ts = cmdJumpToFileDocXref;
                break;

            case FileContextMenuItem.DocXrefDelete:
                ts = cmdDelete;
                break;

            case FileContextMenuItem.MoveFileShortcut:
                ts = cmdMoveFileShortcut;
                break;

            case FileContextMenuItem.RenameFileShortcut:
                ts = cmdRenameFileShortcut;
                break;

            case FileContextMenuItem.DeleteFileShortcut:
                ts = cmdDeleteFileShortcut;
                break;

            case FileContextMenuItem.DeleteShortcutContainer:
                ts = cmdDeleteShortcutFolder;
                break;

            case FileContextMenuItem.RenameShortcutContainer:
                ts = cmdRenameFolder;
                break;

            case FileContextMenuItem.MoveShortcutContainer:
                ts = cmdMoveShortcutContainer;
                break;

            case FileContextMenuItem.NewMemo:
                ts = cmdFNewMemo;
                break;

            case FileContextMenuItem.NewFaxCoverSheet:
                ts = cmdFNewFaxCover;
                break;

            case FileContextMenuItem.RenameFile:
                ts = cmdFRename;
                break;

            case FileContextMenuItem.Delete:
                ts = cmdFDelete;
                break;

            case FileContextMenuItem.AddToShortcuts:
                ts = cmdFAddToShortcuts;
                break;

            case FileContextMenuItem.MoveFile:
                ts = cmdFMove;
                break;

            case FileContextMenuItem.CreateXRef:
                ts = cmdFNewXref;
                break;

            case FileContextMenuItem.NewOffice:
                ts = cmdFNewOffice;
                break;

            case FileContextMenuItem.NewFile:
                ts = cmdFNewFile;
                break;

            case FileContextMenuItem.NewActivity:
                ts = cmdFNewActivity;
                break;

            case FileContextMenuItem.NewMail:
                ts = cmdFNewEmail;
                break;

            case FileContextMenuItem.NewDocument:
                ts = cmdFNewDocument;
                break;

            case FileContextMenuItem.ViewExplorer:
                ts = cmdFLawMateExplorer;
                break;

            default:
                ts = null;
                break;
            }
            if (ts != null)
            {
                if (EnableItem)
                {
                    ts.Enabled = Janus.Windows.UI.InheritableBoolean.True;
                }
                else
                {
                    ts.Enabled = Janus.Windows.UI.InheritableBoolean.False;
                }
            }
        }
示例#6
0
 private void SetMenuClickedEventArgs(FileContextMenuItem MenuItem)
 {
     SetMenuClickedEventArgs(MenuItem, null);
 }