コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctrl"></param>
        /// <param name="tv"></param>
        /// <param name="extra"></param>
        public static async void BindTo(this ListBox ctrl, Task <TextValues> tv, ExtraItems extra = ExtraItems.NoExtra)
        {
            NotNull(ctrl, "ctrl");
            if (tv == null)
            {
                throw new ArgumentNullException("tv");
            }

            ctrl.Items.Clear();
            ctrl.DisplayMember = "Item1"; // name of Tuple.Item1
            ctrl.ValueMember   = "Item2"; // name of Tuple.Item2

            if ((extra & ExtraItems.AddNone) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemNone, NoneValue));
            }
            if ((extra & ExtraItems.AddAll) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemAll, AllValue));
            }

            (await tv).ForEach(_ => ctrl.Items.Add(_));

            if (ctrl.Items.Count > 0)
            {
                ctrl.SelectedIndex = 0;
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctrl"></param>
        /// <param name="tv"></param>
        /// <param name="extra"></param>
        public static void BindTo(this ComboBox ctrl, TextValues tv, ExtraItems extra = ExtraItems.NoExtra
                                  , ComboBoxStyle style = ComboBoxStyle.DropDownList)
        {
            NotNull(ctrl, "ctrl");
            NotNull(tv, "tv");

            ctrl.Items.Clear();
            ctrl.DisplayMember = "Item1"; // name of Tuple.Item1
            ctrl.ValueMember   = "Item2"; // name of Tuple.Item2
            ctrl.DropDownStyle = style;

            if ((extra & ExtraItems.AddNone) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemNone, NoneValue));
            }
            if ((extra & ExtraItems.AddAll) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemAll, AllValue));
            }

            tv.ForEach(_ => ctrl.Items.Add(_));

            if (ctrl.Items.Count > 0)
            {
                ctrl.SelectedIndex = 0;
            }
        }
コード例 #3
0
        public void Show()
        {
            if (!string.IsNullOrEmpty(Title))
            {
                Logger.WriteLine($"{Title}:", ConsoleColor.Magenta);
                Logger.WriteLine(new string('─', Title.Length + 1), ConsoleColor.Magenta);
            }

            foreach (var item in MainItems)
            {
                Logger.WriteLine(item.ToString());
            }
            Logger.LineBreak();

            if (ExtraItems.Count == 0)
            {
                return;
            }

            ExtraItems.RemoveAll(i => i.Condition == false);
            foreach (var item in ExtraItems)
            {
                Logger.WriteLine(item.ToString(), ConsoleColor.Blue);
            }
            Logger.LineBreak();
        }
コード例 #4
0
        public VCPKGSampleSolution()
        {
            Name = "VCPKGSample";

            AddTargets(SampleTargets.Targets);
            ExtraItems.Add("Markdown", new Strings()
            {
                @"[solution.SharpmakeCsPath]/../README.md",
            });
        }
コード例 #5
0
ファイル: Hawl.sharpmake.cs プロジェクト: juteman/Hawl
        public HawlSolution()
        {
            Name = "Hawl";

            AddTargets(new Target(
                           Platform.win64,
                           DevEnv.vs2019,
                           Optimization.Debug | Optimization.Release
                           ));

            ExtraItems.Add("Markdown", new Strings()
            {
                @"[solution.SharpmakeCsPath]/../README.md",
            });
        }
コード例 #6
0
        public static void BindTo(this ListView ctrl, TextValues tv, ExtraItems extra = ExtraItems.NoExtra)
        {
            NotNull(ctrl, "ctrl");
            NotNull(tv, "tv");

            ctrl.Items.Clear();

            if ((extra & ExtraItems.AddNone) != 0)
            {
                ctrl.Items.Add(NoneValue, Properties.Resources.ListControl_ItemNone, 1);
            }
            if ((extra & ExtraItems.AddAll) != 0)
            {
                ctrl.Items.Add(AllValue, Properties.Resources.ListControl_ItemAll, 2);
            }

            tv.ForEach(item => {
                ctrl.Items.Add(item.Item2, item.Item1, 9);
            });
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctrl"></param>
        /// <param name="tv"></param>
        /// <param name="extra"></param>
        public static void BindTo(this ListBox ctrl, TextValues tv, ExtraItems extra = ExtraItems.NoExtra)
        {
            NotNull(ctrl, "ctrl");
            NotNull(tv, "tv");

            ctrl.Items.Clear();
            ctrl.DisplayMember = "Item1"; // name of Tuple.Item1
            ctrl.ValueMember   = "Item2"; // name of Tuple.Item2

            if ((extra & ExtraItems.AddNone) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemNone, NoneValue));
            }
            if ((extra & ExtraItems.AddAll) != 0)
            {
                ctrl.Items.Add(Tuple.Create(Properties.Resources.ListControl_ItemAll, AllValue));
            }

            tv.ForEach(_ => ctrl.Items.Add(_));
        }
コード例 #8
0
        public static async void BindTo(this ListView ctrl, Task <TextValues> tv, ExtraItems extra = ExtraItems.NoExtra)
        {
            NotNull(ctrl, "ctrl");
            if (tv == null)
            {
                throw new ArgumentNullException("tv");
            }

            ctrl.Items.Clear();

            if ((extra & ExtraItems.AddNone) != 0)
            {
                ctrl.Items.Add(NoneValue, Properties.Resources.ListControl_ItemNone, 1);
            }
            if ((extra & ExtraItems.AddAll) != 0)
            {
                ctrl.Items.Add(AllValue, Properties.Resources.ListControl_ItemAll, 2);
            }
            (await tv).ForEach(item => {
                ctrl.Items.Add(item.Item2, item.Item1, 9);
            });
        }
コード例 #9
0
        public void Prompt()
        {
            while (true)
            {
                Logger.Write("> ");
                var choice = Console.ReadLine()?.ToLower();
                Logger.ClearLast();

                var chosenItem = MainItems.Find(i => i.HotKey == choice) ?? ExtraItems.Find(i => i.HotKey == choice);
                if (chosenItem == null)
                {
                    continue;
                }
                chosenItem.Action();

                if (chosenItem.PostAction != MenuItem.PostActionMode.START)
                {
                    continue;
                }
                Logger.Clear();
                break;
            }
        }