コード例 #1
0
ファイル: Actor.cs プロジェクト: fcenobi/FarNet
        public void ShowPanel()
        {
            string currentDirectory = A.Psf.SyncPaths();

            try
            {
                string drive = UI.SelectMenu.SelectPowerPanel();
                if (drive == null)
                {
                    return;
                }

                AnyPanel ap;
                if (drive == UI.SelectMenu.TextFolderTree)
                {
                    ap = new FolderTree();
                }
                else if (drive == UI.SelectMenu.TextAnyObjects)
                {
                    ap = new ObjectPanel();
                }
                else
                {
                    ap = new ItemPanel(drive);
                }
                ap.Open();
            }
            finally
            {
                A.SetCurrentDirectoryFinally(currentDirectory);
            }
        }
コード例 #2
0
        public void ShowPanel()
        {
            string currentDirectory = A.Psf.SyncPaths();

            try
            {
                string drive = UI.SelectMenu.SelectDrive(null, true);
                if (drive == null)
                {
                    return;
                }

                AnyPanel ap;
                if (drive == "Folder &tree")
                {
                    ap = new FolderTree();
                }
                else if (drive == "&Any objects")
                {
                    ap = new ObjectPanel();
                }
                else
                {
                    ap = new ItemPanel(drive);
                }
                ap.Open();
            }
            finally
            {
                A.SetCurrentDirectoryFinally(currentDirectory);
            }
        }
コード例 #3
0
        /// <summary>
        /// Puts a value into the command line or opens a lookup panel or member panel.
        /// </summary>
        /// <param name="file">The file to process.</param>
        public override void OpenFile(FarFile file)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            PSPropertyInfo pi = file.Data as PSPropertyInfo;

            // e.g. visible mode: sender is MemberDefinition
            if (pi == null)
            {
                return;
            }

            // lookup opener?
            if (_LookupOpeners != null)
            {
                ScriptHandler <OpenFileEventArgs> handler;
                if (_LookupOpeners.TryGetValue(file.Name, out handler))
                {
                    handler.Invoke(this, new OpenFileEventArgs(file));
                    return;
                }
            }

            // case: can show value in the command line
            string s = Converter.InfoToLine(pi);

            if (s != null)
            {
                // set command line
                ILine cl = Far.Api.CommandLine;
                cl.Text = "=" + s;
                cl.SelectText(1, s.Length + 1);
                return;
            }

            // case: enumerable
            IEnumerable ie = Cast <IEnumerable> .From(pi.Value);

            if (ie != null)
            {
                ObjectPanel op = new ObjectPanel();
                op.AddObjects(ie);
                op.OpenChild(this);
                return;
            }

            // open members
            OpenFileMembers(file);
        }