public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { VplPropertyBag ps = context.PropertyDescriptor.GetValue(context.Instance) as VplPropertyBag; if (ps != null && ps.Count > 0) { DialogJsVariables dlg = new DialogJsVariables(); dlg.LoadData(ps); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { IDevClassReferencer dcr = ps.Owner as IDevClassReferencer; if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(dcr, context.PropertyDescriptor.Name); } } } } } } return(base.EditValue(context, provider, value)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { VplPropertyBag ps = context.Instance as VplPropertyBag; if (ps != null) { StringCollection names = new StringCollection(); for (int i = 0; i < ps.Count; i++) { names.Add(ps[i].Name); } DlgNewTypedNamedValue dlg = new DlgNewTypedNamedValue(); dlg.LoadData(names, "Define Javascript variable", null, WebClientData.GetJavascriptTypes(), false); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { ps.AddValue(dlg.DataName, dlg.DataType); IDevClassReferencer dcr = ps.Owner as IDevClassReferencer; if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(dcr, context.PropertyDescriptor.Name); } } } } } } return(value); }
private void createPageVariables() { if (_pageVariabes == null) { _pageVariabes = new VplPropertyBag(this); _pageVariabes.EditorType = typeof(TypeSelectorJsVariable); } }
public void LoadData(VplPropertyBag vars) { _vars = vars; IList <TypedNamedValue> ps = vars.PropertyList; foreach (TypedNamedValue tn in ps) { checkedListBox1.Items.Add(tn.Name, true); } }