示例#1
0
        public override void Build()
        {
            var results = BlockCounter.Refresh();

            var seg1 = CreateStandardSegment(InsertPosition.ZeroCursor);

            seg1.AddInterpretter(Button.Quick(
                                     "Order by " + (BlockCounter.OrderByCount
                ? "name instead of by count"
                : "count instead of by name"
                                                    ), new ToolTip("Change order"), () =>
            {
                BlockCounter.OrderByCount = !BlockCounter.OrderByCount;
                Segments.Clear();
                Build();
            }));

            var seg2 = CreateTableSegment(2, results.Length);

            for (int i = 0; i < results.Length; i++)
            {
                var name = new StringDisplay(M.m(results[i].Key.ComponentId.Name), M.m(results[i].Key.GetToolTip()));
                name.Justify = TextAnchor.MiddleLeft;

                var count = StringDisplay.Quick(results[i].Value.ToString());
                count.Justify = TextAnchor.MiddleRight;

                seg2.AddInterpretter(name, i, 0);
                seg2.AddInterpretter(count, i, 1);
            }
        }
示例#2
0
            protected override void AddContentToWindow(ConsoleWindow window)
            {
                var seg0 = window.Screen.CreateTableSegment(5, changes.Length);

                seg0.SqueezeTable = true;
                seg0.SetColumnHeadings(
                    "Version",
                    "Date",
                    "Type",
                    "Component",
                    "Description"
                    );
                seg0.BackgroundStyleWhereApplicable = _s.Segments.OptionalSegmentDarkBackground.Style;
                seg0.eTableOrder = ScreenSegmentTable.TableOrder.Rows;

                foreach (var c in changes)
                {
                    var label = seg0.AddInterpretter(StringDisplay.Quick(
                                                         $"<color=lime>{c.Version}</color>",
                                                         "The version this change was released in"));
                    label.WrapText        = false;
                    label.PrescribedWidth = new FractionalSizing(0.03f, Dimension.Width);

                    label = seg0.AddInterpretter(StringDisplay.Quick(
                                                     $"<color=yellow>{c.DateOfRelease.ToString("yyyy-MM-dd")}</color>",
                                                     "Date of release of this version"));
                    label.WrapText        = false;
                    label.PrescribedWidth = new FractionalSizing(0.04f, Dimension.Width);

                    label = seg0.AddInterpretter(StringDisplay.Quick(
                                                     $"<color=cyan>{c.Type}</color>",
                                                     "Type of the change"));
                    label.WrapText        = false;
                    label.PrescribedWidth = new FractionalSizing(0.04f, Dimension.Width);

                    label = seg0.AddInterpretter(StringDisplay.Quick(
                                                     $"<color=orange>{c.Tag}</color>",
                                                     "The component which has been changed"));
                    label.WrapText        = false;
                    label.PrescribedWidth = new FractionalSizing(0.1f, Dimension.Width);

                    label = seg0.AddInterpretter(StringDisplay.Quick(
                                                     c.Description.ToString(),
                                                     "Description of the change"));
                    label.WrapText = true;
                    label.Justify  = TextAnchor.MiddleLeft;
                    //.PrescribedWidth = new FractionalSizing(0.4f, Dimension.Width);
                }

                window.Screen.CreateSpace(0);

                var seg1 = window.Screen.CreateStandardHorizontalSegment();

                //seg1.SqueezeSides = true;
                seg1.AddInterpretter(Button.Quick("Continue", new ToolTip("Close this popup"), () => _focus.Do()));
            }
        protected override void AddContentToWindow(ConsoleWindow window)
        {
            var seg0 = window.Screen.CreateStandardSegment();

            seg0.AddInterpretter(SubjectiveDisplay <bool> .Quick(false, M.m <bool>(x =>
            {
                if (mods.All(y => y.processed))
                {
                    _focus.Do();
                }
                return
                ("The following mods are required by this construct but are not installed on this instance of FtD.\n" +
                 "This popup will automatically close when all mods are either installed or discarded.\n" +
                 "You have to restart FtD in order to apply the newly installed mods.");
            }), ""));

            foreach (var mod in mods)
            {
                window.Screen.CreateHeader(mod.name, new ToolTip("Missing mod"))
                .SetConditionalDisplay(() => !mod.processed);
                var seg1 = window.Screen.CreateStandardSegment();
                seg1.SetConditionalDisplay(() => !mod.processed);

                seg1.AddInterpretter(StringDisplay.Quick(mod.description, "Description of missing mod"));

                var seg2 = window.Screen.CreateStandardHorizontalSegment();
                seg2.SetConditionalDisplay(() => !mod.processed);

                if (!string.IsNullOrWhiteSpace(mod.manifest) &&
                    Uri.TryCreate(mod.manifest, UriKind.Absolute, out var _))
                {
                    seg2.AddInterpretter(Button.Quick("Install mod with FtdModManager", new ToolTip(mod.manifest), () =>
                    {
                        mod.processed = true;
                        ModManagerPlugin.Instance.manager.Install(mod.manifest);
                    }));
                }

                if (!string.IsNullOrWhiteSpace(mod.manifest) &&
                    Uri.TryCreate(mod.link, UriKind.Absolute, out var _))
                {
                    seg2.AddInterpretter(Button.Quick("Open mod page", new ToolTip(mod.link), () =>
                    {
                        Application.OpenURL(mod.link);
                    }));
                }

                seg2.AddInterpretter(Button.Quick("Discard", new ToolTip("Ignore this alert"), () =>
                {
                    mod.processed = true;
                }));
            }
        }