当前位置: 首页>>代码示例>>C#>>正文


C# IWindowsFormsEditorService.ShowDialog方法代码示例

本文整理汇总了C#中IWindowsFormsEditorService.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# IWindowsFormsEditorService.ShowDialog方法的具体用法?C# IWindowsFormsEditorService.ShowDialog怎么用?C# IWindowsFormsEditorService.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWindowsFormsEditorService的用法示例。


在下文中一共展示了IWindowsFormsEditorService.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Default behavior
            if ((context == null) ||
                (provider == null) || (context.Instance == null)) {
                return base.EditValue(context, provider, value);
            }

            ModelElement modelElement = (context.Instance as ModelElement);
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null) {
                FrmFeatureModelDiagramSelector form = new FrmFeatureModelDiagramSelector(modelElement.Store);
                if (edSvc.ShowDialog(form) == DialogResult.OK) {
                    using (Transaction transaction = modelElement.Store.TransactionManager.BeginTransaction("UpdatingFeatureModelFileValue")) {

                        if (modelElement is FeatureShape) {
                            FeatureShape featureShape = modelElement as FeatureShape;
                            (featureShape.ModelElement as Feature).DefinitionFeatureModelFile = form.SelectedFeatureModelFile;
                        } else if (modelElement is FeatureModelDSLDiagram) {
                            FeatureModelDSLDiagram featureModelDslDiagram = modelElement as FeatureModelDSLDiagram;
                            (featureModelDslDiagram.ModelElement as FeatureModel).ParentFeatureModelFile = form.SelectedFeatureModelFile;
                        }

                        transaction.Commit();
                    }
                }
            }

            // Default behavior
            return base.EditValue(context, provider, value);
        }
开发者ID:ngm,项目名称:feature-model-dsl,代码行数:31,代码来源:FeatureModelDiagramTypeEditor.cs

示例2: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    if (_mappingPropertyEditorForm == null)
                    {
                        _mappingPropertyEditorForm = new MappingPropertyEditorForm();
                    }

                    _mappingPropertyEditorForm.Start(editorService, value);
                    editorService.ShowDialog(_mappingPropertyEditorForm);

                    if (_mappingPropertyEditorForm.DialogResult == DialogResult.OK)
                    {
                        MappingProperty mappingProperty = new MappingProperty();
                        mappingProperty.MappingInfoCollection = _mappingPropertyEditorForm.MappingInfoCollection;
                        value = mappingProperty;
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return value;
        }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:30,代码来源:MappingPropertyEditor.cs

示例3: EditValue

        public override object EditValue(ITypeDescriptorContext context,
            IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                edSvc = (IWindowsFormsEditorService) provider.GetService(typeof
                                                                             (IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    var style = (TextStyle) value;
                    using (var tsd = new TextStyleDesignerDialog(style)
                        )
                    {
                        context.OnComponentChanging();
                        if (edSvc.ShowDialog(tsd) == DialogResult.OK)
                        {
                            ValueChanged(this, EventArgs.Empty);
                            context.OnComponentChanged();
                            return style;
                        }
                    }
                }
            }

            return value;
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:27,代码来源:TextStyleUIEditor.cs

示例4: EditValue

        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
                throw new ArgumentNullException("typeDescriptorContext");
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");

            object returnVal = o;

            // Do not allow editing expression if the name is not set.
            RuleConditionReference conditionDeclaration = typeDescriptorContext.Instance as RuleConditionReference;

            if (conditionDeclaration == null || conditionDeclaration.ConditionName == null || conditionDeclaration.ConditionName.Length <= 0)
                throw new ArgumentException(Messages.ConditionNameNotSet);

            Activity baseActivity = null;

            IReferenceService rs = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
            if (rs != null)
                baseActivity = rs.GetComponent(typeDescriptorContext.Instance) as Activity;

            RuleConditionCollection conditionDefinitions = null;
            RuleDefinitions rules = ConditionHelper.Load_Rules_DT(serviceProvider, Helpers.GetRootActivity(baseActivity));
            if (rules != null)
                conditionDefinitions = rules.Conditions;

            if (conditionDefinitions != null && !conditionDefinitions.Contains(conditionDeclaration.ConditionName))
            {
                string message = string.Format(CultureInfo.CurrentCulture, Messages.ConditionNotFound, conditionDeclaration.ConditionName);
                throw new ArgumentException(message);
            }

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                CodeExpression experssion = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as CodeExpression;
                try
                {
                    using (RuleConditionDialog dlg = new RuleConditionDialog(baseActivity, experssion))
                    {
                        if (DialogResult.OK == editorService.ShowDialog(dlg))
                            returnVal = dlg.Expression;
                    }
                }
                catch (NotSupportedException)
                {
                    DesignerHelpers.DisplayError(Messages.Error_ExpressionNotSupported, Messages.ConditionEditor, serviceProvider);
                }
            }

            return returnVal;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:52,代码来源:LogicalExpressionEditor.cs

示例5: EditValue

        /// <summary>
        /// Called when we want to edit the value of a property.  Brings up the Glyph Editor control.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null && value is ArrayList)
            {
                GlyphEditor glyphEditor = new GlyphEditor();
                glyphEditor.Glyphs = value as ArrayList;

                if (edSvc.ShowDialog(glyphEditor) == DialogResult.OK)
                    return new ArrayList(glyphEditor.Glyphs);
            }

            return value;
        }
开发者ID:RasterCode,项目名称:OtterUI,代码行数:21,代码来源:UIGlyphEditor.cs

示例6: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if ((context != null) && (provider != null))
            {
                _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (_editorService != null)
                {
                    foreach (Component component in context.Container.Components)
                    {
                        if (component != null)
                        {
                            if (component is NugenCCalcBase)
                            {
                                if ((component as NugenCCalcBase).FunctionParameters == (FunctionParameters)context.Instance)
                                {
                                    context.OnComponentChanging();
                                    if (component is NugenCCalc2D)
                                    {
                                        NugenCCalcDesignerForm designerForm = new NugenCCalcDesignerForm((component as NugenCCalc2D));
                                        _editorService.ShowDialog(designerForm);
                                    }
                                    else
                                    {
                                        NugenCCalc3DDesignerForm designerForm = new NugenCCalc3DDesignerForm((component as NugenCCalc3D));
                                        _editorService.ShowDialog(designerForm);
                                    }
                                    context.OnComponentChanged();
                                }
                            }
                        }
                    }
                    RefreshPropertyGrid();
                }
            }
            return value;
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:37,代码来源:SourceEditor.cs

示例7: EditValue

        public override object EditValue (
            ITypeDescriptorContext context, 
            IServiceProvider provider, 
            object value)
        {
            if (context == null ||
                context.Instance == null ||
                provider == null)
                return value;

            object originalValue = value;
            
            // if the value is null
            if (value==null)
            {
                Type type = context.PropertyDescriptor.PropertyType;
                value = Activator.CreateInstance(type);
            }

            m_context = context;

            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc == null)
            {
                Trace.WriteLine("Editor service is null");
                return value;
            }

            CustomCollectionEditorForm collEditorFrm = CreateForm();
            collEditorFrm.ItemAdded += new CustomCollectionEditorForm.InstanceEventHandler(ItemAdded);
            collEditorFrm.ItemRemoved += new CustomCollectionEditorForm.InstanceEventHandler(ItemRemoved);
            collEditorFrm.Collection = value as IList;
            
            context.OnComponentChanging();
            
            if (edSvc.ShowDialog(collEditorFrm) == DialogResult.OK)
            {
                OnCollectionChanged(context.Instance, value);
                context.OnComponentChanged();
            }

            IList newValue = (IList)Activator.CreateInstance(value.GetType());
            foreach (object obj in (IList)value) {
               newValue.Add(obj);
            }
            return (object)newValue;
        }
开发者ID:borkaborka,项目名称:gmit,代码行数:47,代码来源:CustomCollectionEditor.cs

示例8: EditValue

        //---------------------------------------------------------------------------
        public override object EditValue(ITypeDescriptorContext context, 
            IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            { 
                // Получаем интерфейс сервиса
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                
                if (edSvc != null)
                {
                    IDataLinkLayer current;
                    FormConnectionEditor frm;
                    // Получаем текущий редактируемый компонент или создаём его
                    if (context.Instance != null)
                    {
                        Modbus.WCF.NetworksServer.Network.Network network =
                            (Modbus.WCF.NetworksServer.Network.Network)context.Instance;
                        current = (IDataLinkLayer)network.Connection;
                        if (current != null)
                        {
                            if (current.IsOpen())
                            {
                                current.CloseConnect();
                            }
                        }
                        // Создаём форму для редактирования
                        frm = new FormConnectionEditor();
                        frm.Connection = current;
                    }
                    else
                    {
                        frm = new FormConnectionEditor();
                    }
                    
                    //DialogResult result = frm.ShowDialog();
                    DialogResult result = edSvc.ShowDialog(frm);

                    if (result == DialogResult.OK)
                    {
                        value = frm.Connection;
                    }
                    
                    frm.Dispose();
                }
            }
            return value;
        }
开发者ID:serialbus,项目名称:NGK,代码行数:48,代码来源:ConnectionUITypeEditor.cs

示例9: EditValue

 /// <summary>
 /// Overrides the method used to provide basic behaviour for selecting editor.
 /// Shows our custom control for editing the value.
 /// </summary>
 /// <param name="context">The context of the editing control</param>
 /// <param name="provider">A valid service provider</param>
 /// <param name="value">The current value of the object to edit</param>
 /// <returns>The new value of the object</returns>
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null
         && context.Instance != null
         && provider != null)
     {
         edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if(edSvc != null)
         {
             editor = new TreeListViewItemsEditorForm((TreeListViewItemCollection) value);
             edSvc.ShowDialog(editor);
             if(editor.DialogResult == DialogResult.OK)
                 return(editor.Items);
         }
     }
     return(value);
 }
开发者ID:andreigec,项目名称:Folder-View,代码行数:25,代码来源:TreeListViewItemsEditor.cs

示例10: ProcessDialog

        private object ProcessDialog(object value, IWindowsFormsEditorService editorService)
        {
            GumpArtSelectorDialog dialog = new GumpArtSelectorDialog();
            dialog.Index = Convert.ToInt32(value);

            if (editorService.ShowDialog(dialog) == DialogResult.OK)
            {
                if (!Ultima.Gumps.IsValidIndex(dialog.Index))
                {
                    MessageBox.Show("You may not select invalid images.", "RunUO: GDK");
                    dialog.Dispose();
                    return ProcessDialog(value, editorService);
                }

                returnValue = dialog.Index;

                return returnValue;
            }

            return value;
        }
开发者ID:jeffboulanger,项目名称:runuogdk,代码行数:21,代码来源:GumpIndexEditor.cs

示例11: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService != null)
            {
                ItemArtSelectorDialog dialog = new ItemArtSelectorDialog();

                dialog.Index = Convert.ToInt32(value);

                if (editorService.ShowDialog(dialog) == DialogResult.OK)
                {
                    returnValue = dialog.Index;
                    dialog.Dispose();

                    return returnValue;
                }

                dialog.Dispose();
            }

            return value;
        }
开发者ID:jeffboulanger,项目名称:runuogdk,代码行数:23,代码来源:ItemIndexEditor.cs

示例12: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    if (_modalEditorPropertyEditorForm == null) _modalEditorPropertyEditorForm = new ModalEditorPropertyEditorForm();
                    _modalEditorPropertyEditorForm.Start(editorService, value);
                    editorService.ShowDialog(_modalEditorPropertyEditorForm);
                    if (_modalEditorPropertyEditorForm.DialogResult == DialogResult.OK)
                    {
                        value = new ModalEditorProperty(_modalEditorPropertyEditorForm.SampleStringTextBox.Text, _modalEditorPropertyEditorForm.SampleBooleanCheckBox.Checked);
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return value;
        }
开发者ID:mattfrerichs,项目名称:Templates,代码行数:23,代码来源:ModalEditorPropertyEditor.cs

示例13: ShowDialog

 public DialogResult ShowDialog(string caption, IWindowsFormsEditorService edSrv)
 {
     this.Text = caption;
     return edSrv.ShowDialog(this);
 }
开发者ID:powernick,项目名称:CodeLib,代码行数:5,代码来源:NoteEditorDialog.cs

示例14: EditValue

        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object value)
        {
            if (typeDescriptorContext == null)
                throw new ArgumentNullException("typeDescriptorContext");
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");

            object returnVal = value;
            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                ITypeFilterProvider typeFilterProvider = null;
                TypeFilterProviderAttribute typeFilterProvAttr = null;

                if (typeDescriptorContext.PropertyDescriptor != null && typeDescriptorContext.PropertyDescriptor.Attributes != null)
                    typeFilterProvAttr = typeDescriptorContext.PropertyDescriptor.Attributes[typeof(TypeFilterProviderAttribute)] as TypeFilterProviderAttribute;

                if (typeFilterProvAttr != null)
                {
                    ITypeProvider typeProvider = serviceProvider.GetService(typeof(ITypeProvider)) as ITypeProvider;
                    if (typeProvider == null)
                        throw new Exception(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));

                    Type typeFilterProviderType = Type.GetType(typeFilterProvAttr.TypeFilterProviderTypeName);
                    //typeProvider.GetType(typeFilterProvAttr.TypeFilterProviderTypeName);
                    if (typeFilterProviderType != null)
                        typeFilterProvider = Activator.CreateInstance(typeFilterProviderType, new object[] { serviceProvider }) as ITypeFilterProvider;
                }

                if (typeFilterProvider == null)
                    typeFilterProvider = ((typeDescriptorContext.Instance is object[]) ? ((object[])typeDescriptorContext.Instance)[0] : typeDescriptorContext.Instance) as ITypeFilterProvider;

                if (typeFilterProvider == null)
                    typeFilterProvider = value as ITypeFilterProvider;

                if (typeFilterProvider == null)
                {
                    IReferenceService rs = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                    if (rs != null)
                    {
                        IComponent baseComponent = rs.GetComponent(typeDescriptorContext.Instance);
                        if (baseComponent is ITypeFilterProvider)
                            typeFilterProvider = baseComponent as ITypeFilterProvider;
                    }
                }

                if (typeFilterProvider == null)
                {
                    typeFilterProvider = typeDescriptorContext.PropertyDescriptor as ITypeFilterProvider;
                }

                string oldTypeName = value as string;
                if (value != null && typeDescriptorContext.PropertyDescriptor.PropertyType != typeof(string) && typeDescriptorContext.PropertyDescriptor.Converter != null && typeDescriptorContext.PropertyDescriptor.Converter.CanConvertTo(typeof(string)))
                    oldTypeName = typeDescriptorContext.PropertyDescriptor.Converter.ConvertTo(typeDescriptorContext, CultureInfo.CurrentCulture, value, typeof(string)) as string;

                using (TypeBrowserDialog dlg = new TypeBrowserDialog(serviceProvider, typeFilterProvider as ITypeFilterProvider, oldTypeName))
                {
                    if (DialogResult.OK == editorService.ShowDialog(dlg))
                    {
                        if (typeDescriptorContext.PropertyDescriptor.PropertyType == typeof(Type))
                            returnVal = dlg.SelectedType;
                        else if (typeDescriptorContext.PropertyDescriptor.PropertyType == typeof(string))
                            returnVal = dlg.SelectedType.FullName;
                        else if (typeDescriptorContext.PropertyDescriptor.Converter != null && typeDescriptorContext.PropertyDescriptor.Converter.CanConvertFrom(typeDescriptorContext, typeof(string)))
                            returnVal = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentCulture, dlg.SelectedType.FullName);
                    }
                }
            }
            return returnVal;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:70,代码来源:UITypeEditors.cs

示例15: EditValue

        /// <summary>
        ///   Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
        /// </summary>
        /// 
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// 
        /// <returns>
        ///   The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
        /// </returns>
        /// 
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                object originalValue = value;

                this.editorService = (IWindowsFormsEditorService)provider
                    .GetService(typeof(IWindowsFormsEditorService));

                this.CollectionType = context.PropertyDescriptor.ComponentType;
                this.CollectionItemType = detectCollectionType();

                if (editorService != null)
                {
                    NumericCollectionEditorForm form = new NumericCollectionEditorForm(this, value);

                    context.OnComponentChanging();

                    if (editorService.ShowDialog(form) == DialogResult.OK)
                    {
                        context.OnComponentChanged();
                    }
                }
            }

            return value;
        }
开发者ID:natepan,项目名称:framework,代码行数:39,代码来源:NumericCollectionEditor.cs


注:本文中的IWindowsFormsEditorService.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。