本文整理汇总了C#中ITypeDescriptorContext.OnComponentChanged方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeDescriptorContext.OnComponentChanged方法的具体用法?C# ITypeDescriptorContext.OnComponentChanged怎么用?C# ITypeDescriptorContext.OnComponentChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeDescriptorContext
的用法示例。
在下文中一共展示了ITypeDescriptorContext.OnComponentChanged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditValue
/// <summary>
/// Edits the specified object's value using the editor style indicated by GetEditStyle.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param>
/// <param name="value">The object to edit.</param>
/// <returns></returns>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if ((context != null) && (context.Instance != null) && (provider != null))
{
// Must use the editor service for showing dialogs
IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (editorService != null)
{
// Cast the value to the correct type
KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance;
// Create the dialog used to edit the set of KryptonCheckButtons
KryptonCheckButtonCollectionForm dialog = new KryptonCheckButtonCollectionForm(checkSet);
if (editorService.ShowDialog(dialog) == DialogResult.OK)
{
// Notify container that value has been changed
context.OnComponentChanged();
}
}
}
// Return the original value
return value;
}
示例2: 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;
}
示例3: EditValue
/// <include file='doc\QueuePathEditor.uex' path='docs/doc[@for="QueuePathEditor.EditValue"]/*' />
/// <devdoc>
/// Edits the given object value using the editor style provided by
/// GetEditorStyle. A service provider is provided so that any
/// required editing services can be obtained.
/// </devdoc>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider != null)
{
IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (edSvc != null)
{
QueuePathDialog dialog = new QueuePathDialog(provider);
MessageQueue queue = null;
if (value is MessageQueue)
queue = (MessageQueue)value;
else if (value is string)
queue = new MessageQueue((string)value);
else if (value != null)
return value;
if (queue != null)
dialog.SelectQueue(queue);
IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
DesignerTransaction trans = null;
if (host != null)
trans = host.CreateTransaction();
try
{
if ((context == null || context.OnComponentChanging()) && edSvc.ShowDialog(dialog) == DialogResult.OK)
{
if (dialog.Path != String.Empty)
{
if (context.Instance is MessageQueue || context.Instance is MessageQueueInstaller)
value = dialog.Path;
else
{
value = MessageQueueConverter.GetFromCache(dialog.Path);
if (value == null)
{
value = new MessageQueue(dialog.Path);
MessageQueueConverter.AddToCache((MessageQueue)value);
if (context != null)
context.Container.Add((IComponent)value);
}
}
context.OnComponentChanged();
}
}
}
finally
{
if (trans != null)
{
trans.Commit();
}
}
}
}
return value;
}
示例4: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
object obj2;
try
{
context.OnComponentChanging();
obj2 = base.EditValue(context, provider, value);
}
finally
{
context.OnComponentChanged();
}
return obj2;
}
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:14,代码来源:EmbeddedMailObjectCollectionEditor.cs
示例5: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
try
{
var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
var F = new Widgetsphere.Generator.Forms.VersionHistoryCollectionForm((VersionHistoryCollection)value);
if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
{
context.OnComponentChanged();
}
}
catch (Exception ex) { }
return value;
}
示例6: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
try
{
var relation = (Relation)context.Instance;
var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
var F = new nHydrate.Generator.Forms.ColumnRelationshipCollectionEditorForm(relation);
if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
{
context.OnComponentChanged();
}
}
catch(Exception ex) { }
return value;
}
示例7: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
try
{
var edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
var table = (nHydrate.Generator.Models.Table)context.Instance;
var F = new nHydrate.Generator.Forms.RowEntryCollectionForm(table);
if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
{
table.Root.Dirty = true;
context.OnComponentChanged();
}
}
catch(Exception ex) { }
return value;
}
示例8: 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;
}
示例9: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
/*
PropertyDescriptor member = TypeDescriptor.GetProperties(context.Instance)["ItemBindings"];
System.Web.UI.Design.ControlDesigner.InvokeTransactedChange((Component)context.Instance, new TransactedChangeCallback(this.InnerEditValues), null, null, member);
*/
DataBindingControl control = (DataBindingControl)context.Instance;
DataBindingItemCollection bindings = (DataBindingItemCollection)control.ItemBindings;
DataBindingItem binding = new DataBindingItem();
binding.ControlID = "Shen Zheng";
bindings.Add(binding);
context.OnComponentChanged();
return bindings;
}
示例10: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if(value==null) return value;
if(!(value is Parameters)) return value;
ParametersEditorForm dlg=new ParametersEditorForm(value as Parameters);
IWindowsFormsEditorService editorService=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
DialogResult res;
if(editorService!=null) res=editorService.ShowDialog(dlg);
else res=dlg.ShowDialog();
if(res!=DialogResult.OK) return value;
context.OnComponentChanged();
return dlg.Result;
}
示例11: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
try
{
System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
Table table = (Table)context.Instance;
Widgetsphere.Generator.Forms.UnitTestDependencyForm F = new Widgetsphere.Generator.Forms.UnitTestDependencyForm(table);
if(edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
{
table.UnitTestDependencies.Clear();
table.UnitTestDependencies.AddRange(F.GetSelectedList());
table.Name = table.Name; //Make Dirty
context.OnComponentChanged();
}
}
catch(Exception ex) { }
return value;
}
示例12: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context!=null && context.Instance!=null && provider!=null)
{
m_EditorService=(System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
if(m_EditorService!=null)
{
if(context.Instance is Bar)
{
Bar bar=context.Instance as Bar;
if(bar.Owner is DotNetBarManager && ((DotNetBarManager)bar.Owner).UseGlobalColorScheme)
System.Windows.Forms.MessageBox.Show("Please note that your DotNetBarManager has its UseGlobalColorScheme set to true and any changes you make to ColorScheme object on the bar will not be used.");
}
else if(context.Instance is DotNetBarManager && !((DotNetBarManager)context.Instance).UseGlobalColorScheme)
{
System.Windows.Forms.MessageBox.Show("Please note that you need to set UseGlobalColorScheme=true in order for all bars to use ColorScheme you change on this dialog.");
}
if(value==null)
value=new ColorScheme();
ColorSchemeEditor editor=new ColorSchemeEditor();
editor.CreateControl();
editor.ColorScheme=(ColorScheme)value;
m_EditorService.ShowDialog(editor);
if(editor.ColorSchemeChanged)
{
value=editor.ColorScheme;
context.OnComponentChanged();
((ColorScheme)value)._DesignTimeSchemeChanged=true;
if(context.Instance is Bar)
{
((Bar)context.Instance).Refresh();
}
}
editor.Close();
}
}
return value;
}
示例13: EditValue
public override object EditValue(
ITypeDescriptorContext context,
IServiceProvider provider,
object value)
{
var service = (IWindowsFormsEditorService)provider
.GetService(typeof (IWindowsFormsEditorService));
if (service != null)
{
var host = (IDesignerHost)context
.GetService(typeof (IDesignerHost));
var trans = host
.CreateTransaction("NodesCollectionEditor");
var dialog = new EditorNodes();
var collection = (ShortcutCollection)value;
if (collection.Count == 0)
{
var root = new CustomShortcut(typeof (Type), "Base");
collection.Add(root);
}
dialog._collection = collection;
if (service.ShowDialog(dialog) == DialogResult.OK)
{
context.OnComponentChanged();
context.OnComponentChanging();
trans.Commit();
return dialog._collection;
}
trans.Cancel();
return value;
}
return value;
}
示例14: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider == null || context == null) return value;
if (context.Instance == null) return value;
try
{
context.OnComponentChanging();
object newConnection = base.EditValue(context, provider, value);
string connectionString = newConnection as string;
int index = -1;
if (connectionString == null && newConnection != null)
{
if (_managerType != null)
{
object manager = Activator.CreateInstance(_managerType, new object[] { provider });
if (manager != null)
{
index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { "System.Data.SQLite" });
if (index > -1 && _selector != null)
{
connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index });
_selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null);
}
}
}
}
if (String.IsNullOrEmpty(connectionString) == false)
{
value = connectionString;
}
context.OnComponentChanged();
}
catch
{
}
return value;
}
示例15: GetProperties
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context,
object value, Attribute[] attributes)
{
PropertyDescriptorCollection properties =
base.GetProperties(context, value, attributes);
ActionBinding binding = value as ActionBinding;
if (binding != null)
{
Control control = GetBindingControl(binding.Parent, context);
if (control != null)
{
if (EnsureEventName(control, binding)) context.OnComponentChanged();
bool isCommandEvent = EventUtil.IsCommandEvent(control, binding.EventName);
if (!isCommandEvent)
{
List<PropertyDescriptor> effective = new List<PropertyDescriptor>();
foreach (PropertyDescriptor property in properties)
{
if (property.Name != "CommandBindings")
{
effective.Add(property);
}
}
properties = new PropertyDescriptorCollection(effective.ToArray(), true);
}
binding.ResetCommandDefaults(isCommandEvent);
}
}
return properties;
}