Example #1
0
        public static List <string> Run(string caption, string label, IEnumerable <string> lines, bool onlyNotEmpty)
        {
            LinesDialog   win = new LinesDialog();
            List <string> src = new List <string>();

            if (lines != null)
            {
                foreach (string l in lines)
                {
                    src.Add(l);
                }
            }
            win.tbxLines.Lines = src.ToArray();
            win.Text           = Texts.Get(caption);
            win.tbxLabel.Text  = Texts.Get(label);
            if (win.ShowDialogEx() == DialogResult.OK)
            {
                var res = new List <string>();
                foreach (string line in win.tbxLines.Lines)
                {
                    string s = line;
                    if (onlyNotEmpty)
                    {
                        s = s.Trim();
                        if (s == "")
                        {
                            continue;
                        }
                    }
                    res.Add(s);
                }
                return(res);
            }
            return(null);
        }
Example #2
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            string label = "s_type_items_each_item_per_line";

            foreach (Attribute attrib in context.PropertyDescriptor.Attributes)
            {
                if (attrib is EditorDisplayLabelAttribute)
                {
                    label = ((EditorDisplayLabelAttribute)attrib).Label;
                }
            }
            List <string> res = LinesDialog.Run(VersionInfo.ProgramTitle, label, (IEnumerable <string>)value, true);

            return(res ?? value);
        }