本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例13: ShowDialog
public DialogResult ShowDialog(string caption, IWindowsFormsEditorService edSrv)
{
this.Text = caption;
return edSrv.ShowDialog(this);
}
示例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;
}
示例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;
}