public override Panel CreatePanel() { Panel panel = new Panel(this); panel.HostFile = FileName; panel.Title = Path.GetFileName(FileName); // Set sort and view modes panel.SortMode = PanelSortMode.Name; panel.ViewMode = PanelViewMode.AlternativeFull; // Define the panel columns PanelPlan plan = new PanelPlan(); plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = "Name" }, new SetColumn() { Kind = "Z", Name = "Value" } }; panel.SetPlan(PanelViewMode.AlternativeFull, plan); return(panel); }
/// <summary> /// New panel with the explorer. /// </summary> /// <param name="explorer">The panel explorer.</param> public ACDPanel(Explorer explorer) : base(explorer) { // start mode //ViewMode = PanelViewMode.AlternativeFull; CurrentLocation = "\\"; Title = "Amazon Cloud Drive"; // Set sort and view modes SortMode = PanelSortMode.Default; ViewMode = PanelViewMode.Full; Highlighting = PanelHighlighting.Full; UseSortGroups = true; // Define the panel columns PanelPlan plan = new PanelPlan(); plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = "Name" }, new SetColumn() { Kind = "Z", Name = "ID" } }; SetPlan(PanelViewMode.AlternativeFull, plan); Log.Source.TraceInformation("Entering DoExplored from Constructor"); DoExplored((ACDExplorer)explorer); }
public SettingsPanel(SettingsExplorer explorer) : base(explorer) { _Explorer = explorer; Title = explorer.Location; CurrentLocation = explorer.Location; SortMode = PanelSortMode.Name; ViewMode = PanelViewMode.AlternativeFull; PanelPlan plan = new PanelPlan(); plan.Columns = new FarColumn[] { new SetColumn() { Kind = "O", Name = "Setting" }, new SetColumn() { Kind = "Z", Name = "Value" } }; SetPlan(PanelViewMode.AlternativeFull, plan); }
/// <summary> /// New tree panel with the explorer. /// </summary> /// <param name="explorer">The panel explorer.</param> public TreePanel(TreeExplorer explorer) : base(explorer) { IgnoreDirectoryFlag = true; // _090810_180151 SortMode = PanelSortMode.Unsorted; // columns SetColumn cO = new SetColumn() { Kind = "O", Name = "Name" }; SetColumn cZ = new SetColumn() { Kind = "Z", Name = "Description" }; // mode: tree column and description status PanelPlan plan0 = new PanelPlan(); plan0.Columns = new FarColumn[] { cO }; plan0.StatusColumns = new FarColumn[] { cZ }; SetPlan((PanelViewMode)0, plan0); // mode: tree and description columns PanelPlan plan1 = new PanelPlan(); plan1.Columns = new FarColumn[] { cO, cZ }; SetPlan((PanelViewMode)1, plan1); }
internal ListPanel(Explorer explorer) : base(explorer) { PostName(_lastCurrentName); // 090411 Use custom Descriptions mode PanelPlan plan = new PanelPlan { Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = "Name" }, new SetColumn() { Kind = "Z", Name = "Value" } } }; SetPlan(PanelViewMode.AlternativeFull, plan); InvokingCommand += OnInvokingCommand; }
/// <summary> /// Gets meta objects for columns. /// </summary> /// <returns>Meta objects ready for column mapping.</returns> internal static PanelPlan SetupPanelMode(IList <Meta> metas) { PanelPlan r = new PanelPlan(); r.Columns = new FarColumn[metas.Count]; for (int i = 0; i < metas.Count; ++i) { r.Columns[i] = metas[i]; } return(r); }
/// <summary> /// New super panel with a super explorer. /// </summary> /// <param name="explorer">The panel explorer.</param> public SuperPanel(SuperExplorer explorer) : base(explorer) { CurrentLocation = Name; Title = Name; var plan = new PanelPlan(); plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N" }, new SetColumn() { Kind = "O" } }; SetPlan(PanelViewMode.AlternativeFull, plan); ViewMode = PanelViewMode.AlternativeFull; SortMode = PanelSortMode.Unsorted; }
internal void BuildPlan(string sameType) { PanelPlan plan = GetPlan(PanelViewMode.AlternativeFull); if (plan == null) { plan = new PanelPlan(); } // choose columns if (sameType == null) { //! The long "Index" clashes to sort order mark, use the short "##" plan.Columns = new FarColumn[] { new SetColumn() { Kind = "S", Name = "##" }, new SetColumn() { Kind = "N", Name = "Value" }, new SetColumn() { Kind = "Z", Name = "Type" } }; } else { plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = sameType } }; } SetPlan(PanelViewMode.AlternativeFull, plan); }
public override Panel CreatePanel() { Panel panel = new Panel(this); panel.HostFile = FileName; panel.Title = Path.GetFileName(FileName); // Set sort and view modes panel.SortMode = PanelSortMode.Name; panel.ViewMode = PanelViewMode.AlternativeFull; // Define the panel columns PanelPlan plan = new PanelPlan(); plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = "Name" }, new SetColumn() { Kind = "Z", Name = "Value" } }; panel.SetPlan(PanelViewMode.AlternativeFull, plan); return panel; }
/// <inheritdoc/> public override IList <FarFile> DoGetFiles(GetFilesEventArgs args) { if (args == null) { return(null); } var panel = args.Parameter as FormatPanel; // call the worker // _090408_232925 If we throw then FarNet returns false and Far closes the panel. object data; try { data = GetData(args); } catch (RuntimeException ex) { if (args.UI) { Far.Api.ShowError(Res.Me, ex); } data = new List <FarFile>(); } // if the data are files just use them, assume all is done IList <FarFile> readyFiles = data as IList <FarFile>; if (readyFiles != null) { Cache = readyFiles; return(Cache); } // PS objects Collection <PSObject> values = (Collection <PSObject>)data; // empty? if (values.Count == 0) { // drop files in any case Cache.Clear(); // no panel, no job if (panel == null) { return(Cache); } // respect custom columns if (Columns != null) { return(Cache); } // is it already <empty>? PanelPlan plan = panel.GetPlan(PanelViewMode.AlternativeFull); if (plan == null) { plan = new PanelPlan(); } else if (plan.Columns.Length == 1 && plan.Columns[0].Name == "<empty>") { return(Cache); } // reuse the mode: reset columns, keep other data intact plan.Columns = new FarColumn[] { new SetColumn() { Kind = "N", Name = "<empty>" } }; panel.SetPlan(PanelViewMode.AlternativeFull, plan); return(Cache); } // not empty; values has to be removed in any case try { // custom if (Columns != null) { BuildFiles(values); return(Cache); } // Check some special cases and try to get the common type. // _100309_121508 Linear type case Type theType; if (Converter.IsLinearType(values[0].BaseObject.GetType()) || values[0].BaseObject is System.Collections.IEnumerable || null == (theType = A.FindCommonType(values))) { // use index, value, type mode if (panel != null) { panel.BuildPlan(Format.BuildFilesMixed(Cache, values)); } return(Cache); } Meta[] metas = null; // try to get format if (theType != typeof(PSCustomObject)) { metas = Format.TryFormatByTableControl(values[0], panel == null ? 80 : panel.Window.Width); //???? avoid formatting at all } // use members if (metas == null) { metas = Format.TryFormatByMembers(values, theType != null && theType == values[0].BaseObject.GetType()); } if (metas == null) { if (panel != null) { panel.BuildPlan(Format.BuildFilesMixed(Cache, values)); } } else { MakeMap(metas); if (panel != null) { panel.SetPlan(PanelViewMode.AlternativeFull, Format.SetupPanelMode(Metas)); } BuildFiles(values); } } finally { values.Clear(); } return(Cache); }