Example #1
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            //Always return a valid value.
            object retvalue = value;

            IWindowsFormsEditorService srv = null;

            //Get the forms editor service from the provider, to display the form.
            if (provider != null)
            {
                srv = (IWindowsFormsEditorService)
                      provider.GetService(typeof(IWindowsFormsEditorService));
            }

            if (srv != null)
            {
                form    = new ValidationSchemaForm();
                service = (MessageTypeConfiguration)context.Instance;

                form.SchemasComboBox.Items.Clear();
                form.SchemasComboBox.Items.Add("(none)");

                form.SchemasComboBox.SelectedIndexChanged += new System.EventHandler(this.SchemasComboBox_SelectedIndexChanged);

                IDictionaryEnumerator enumerator = service.Schemas.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    form.SchemasComboBox.Items.Add(enumerator.Key.ToString());
                }

                foreach (XmlSchemaCollection schema in service.ServiceBroker.Parent.XmlSchemaCollections)
                {
                    form.SchemasComboBox.Items.Add(schema.Name);
                }

                if (String.IsNullOrEmpty(service.ValidationXmlSchemaCollection))
                {
                    form.SchemasComboBox.Text = "(none)";
                }
                else
                {
                    form.SchemasComboBox.Text = service.ValidationXmlSchemaCollection;
                }

                form.SchemaTexBox.Text = service.ValidationXmlSchemaCollectionSchema;

                if (srv.ShowDialog(form) == DialogResult.OK)
                {
                    retvalue = form.SchemaTexBox.Text;
                }
            }

            return(retvalue);
        }
Example #2
0
        public override object EditValue(ITypeDescriptorContext context, 
			IServiceProvider provider, object value)
		{
			//Always return a valid value.
			object retvalue = value;

			IWindowsFormsEditorService srv = null;
			
			//Get the forms editor service from the provider, to display the form.
			if (provider != null)
				srv = (IWindowsFormsEditorService)
					provider.GetService(typeof(IWindowsFormsEditorService));

			if (srv != null)
			{
				form = new ValidationSchemaForm();
                service = (MessageTypeConfiguration)context.Instance;

                form.SchemasComboBox.Items.Clear();
                form.SchemasComboBox.Items.Add("(none)");

                form.SchemasComboBox.SelectedIndexChanged += new System.EventHandler(this.SchemasComboBox_SelectedIndexChanged);

                IDictionaryEnumerator enumerator = service.Schemas.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    form.SchemasComboBox.Items.Add(enumerator.Key.ToString() );
                }

                foreach (XmlSchemaCollection schema in service.ServiceBroker.Parent.XmlSchemaCollections)
                {
                    form.SchemasComboBox.Items.Add(schema.Name);
                }

                if (String.IsNullOrEmpty(service.ValidationXmlSchemaCollection))
                    form.SchemasComboBox.Text = "(none)";
                else
                    form.SchemasComboBox.Text = service.ValidationXmlSchemaCollection;
                
                form.SchemaTexBox.Text = service.ValidationXmlSchemaCollectionSchema;

                if (srv.ShowDialog(form) == DialogResult.OK)
                    retvalue = form.SchemaTexBox.Text;
               
			}
			
			return retvalue;
		}