Ejemplo n.º 1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            string val = NameTemplateEditorForm.Run(VersionInfo.ProgramTitle, "s_type_text", NameTemplate);

            if (val != null)
            {
                NameTemplate = val;
            }
        }
Ejemplo n.º 2
0
        public static string Run(string caption, string label, string text)
        {
            var win = new NameTemplateEditorForm();

            win.nameTemplateFrame1.NameTemplate = text;
            win.label1.Text = Texts.Get(label);
            win.Text        = Texts.Get(caption);
            if (win.ShowDialogEx() == DialogResult.OK)
            {
                return(win.nameTemplateFrame1.NameTemplate);
            }
            return(null);
        }
Ejemplo n.º 3
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_text";

            foreach (Attribute attrib in context.PropertyDescriptor.Attributes)
            {
                if (attrib is EditorDisplayLabelAttribute)
                {
                    label = ((EditorDisplayLabelAttribute)attrib).Label;
                }
            }
            string res = NameTemplateEditorForm.Run(VersionInfo.ProgramTitle, label, value.SafeToString());

            return(res ?? value);
        }