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) { HtmlTreeView tr = context.Instance as HtmlTreeView; if (tr != null) { DlgHtmlTreeViewEditor dlg = new DlgHtmlTreeViewEditor(); dlg.LoadData(tr); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { dlg.SaveData(tr); IDevClass dc = tr.GetDevClass(); if (dc != null) { dc.NotifyChange(tr, context.PropertyDescriptor.Name); } } } } } return(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.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) { HtmlMenu menu = context.Instance as HtmlMenu; if (menu != null) { DlgMenuItems dlg = new DlgMenuItems(); dlg.LoadData(menu); if (edSvc.ShowDialog(dlg) == DialogResult.OK) { IDevClass dc = menu.GetDevClass(); if (dc != null) { dc.NotifyChange(menu, context.PropertyDescriptor.Name); } Form f = menu.FindForm(); if (f != null) { f.Refresh(); } } } } } return(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); }
public void OnDesignTimePropertyValueChange(string propertyName) { IDevClass c = _owner.GetDevClass(); if (c != null) { c.NotifyChange(_owner, propertyName); } }
public void NotifyDesignChange(string name) { if (_owner != null) { IDevClass dc = _owner.GetDevClass(); if (dc != null) { dc.NotifyChange(this, name); } } }
private void onPropertyChanged() { if (_owner != null) { IDevClass dev = _owner.GetDevClass(); if (dev != null) { dev.NotifyChange(this, string.Empty); } } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null && context != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service == null || context.Instance == null) { return(value); } IDataGrid eg = context.Instance as IDataGrid; DataGridViewColumnCollection cols; if (eg != null) { DlgEditColumns dlgCols = new DlgEditColumns(); cols = value as DataGridViewColumnCollection; if (cols == null) { cols = new DataGridViewColumnCollection((DataGridView)eg); } dlgCols.LoadData(cols); eg.DisableColumnChangeNotification = true; if (service.ShowDialog(dlgCols) == DialogResult.OK) { value = cols; eg.OnChangeColumns(cols); } eg.DisableColumnChangeNotification = false; } { IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost)); if (host == null) { IComponent ic = context.Instance as IComponent; if (ic != null && ic.Site != null) { host = ic.Site.GetService(typeof(IDesignerHost)) as IDesignerHost; } } if (host == null) { return(value); } if (dataGridViewColumnCollectionDialog == null) { dataGridViewColumnCollectionDialog = CreateColumnCollectionDialog(provider, value as DataGridViewColumnCollection, context.Instance as DataGridView); } if (dataGridViewColumnCollectionDialog == null) { return(value); } //Unfortunately we had to make property which returns inner datagridview //to access it here because we need to pass DataGridView into SetLiveDataGridView () method DataGridView grid = context.Instance as DataGridView; //we have to set Site property because it will be accessed inside SetLiveDataGridView () method //and by default it's usually null, so if we do not set it here, we will get exception inside SetLiveDataGridView () //var oldSite = grid.Site; //grid.Site = ((UserControl) context.Instance).Site; //execute SetLiveDataGridView () via reflection SetLiveDataGridView(dataGridViewColumnCollectionDialog, grid); using (DesignerTransaction transaction = host.CreateTransaction("DataGridViewColumnCollectionTransaction")) { if (service.ShowDialog(dataGridViewColumnCollectionDialog) == DialogResult.OK) { transaction.Commit(); if (eg != null) { cols = value as DataGridViewColumnCollection; eg.OnChangeColumns(cols); IDevClass dc = eg.GetDevClass(); if (dc != null) { dc.NotifyChange(eg, context.PropertyDescriptor.Name); } } } else { transaction.Cancel(); } } } } return(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) { string name = context.Instance.GetType().Name; WebClientValueCollection svc = context.Instance as WebClientValueCollection; if (svc == null) { IWebClientComponent wa = context.Instance as IWebClientComponent; if (wa != null) { svc = wa.CustomValues; name = wa.GetType().Name; } else { IVplObjectPointer vop = context.Instance as IVplObjectPointer; if (vop != null) { wa = vop.ObjectInstance as IWebClientComponent; if (wa != null) { svc = wa.CustomValues; name = wa.GetType().Name; } } if (svc == null) { WebClientValueCollection.PropertyDescriptorNewClientVariable psdv = context.PropertyDescriptor as WebClientValueCollection.PropertyDescriptorNewClientVariable; if (psdv != null) { svc = psdv.Owner; } else { WebClientValueCollection.PropertyDescriptorClientVariable psdv0 = context.PropertyDescriptor as WebClientValueCollection.PropertyDescriptorClientVariable; if (psdv0 != null) { svc = psdv0.Owner; } } } } } if (svc != null) { DialogWebClientValues dlg = new DialogWebClientValues(); dlg.LoadData(svc, name); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { IHtmlElement ihe = svc.Owner as IHtmlElement; if (ihe != null) { ihe.OnSetProperty(context.PropertyDescriptor.Name); } IDevClassReferencer dcr = svc.Owner as IDevClassReferencer; if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(dcr, context.PropertyDescriptor.Name); } } } } } } return(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) { ConnectionItem ci = value as ConnectionItem; DlgConnectionManager dlg = new DlgConnectionManager(); dlg.UseProjectScope = true; dlg.SetSelection(ci); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { if (dlg.SelectedConnection != null) { PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(context.Instance); PropertyDescriptor p; p = ps["Reserved"]; if (p != null) { p.SetValue(context.Instance, Guid.NewGuid().GetHashCode()); } p = ps["ConnectionID"]; if (p != null) { p.SetValue(context.Instance, new Guid(dlg.SelectedConnection.Filename)); } value = dlg.SelectedConnection; if (VPLUtil.CurrentProject != null) { dlg.SelectedConnection.UpdateUsage(VPLUtil.CurrentProject.ProjectFile); } else { dlg.SelectedConnection.UpdateUsage(Application.ExecutablePath); } IDevClassReferencer dcr = context.Instance as IDevClassReferencer; if (dcr == null) { IClassId classPointer = context.Instance as IClassId; if (classPointer != null) { dcr = classPointer.ObjectInstance as IDevClassReferencer; } } if (dcr == null) { ICustomEventMethodType cemt = context.Instance as ICustomEventMethodType; if (cemt != null) { dcr = cemt.ObjectValue as IDevClassReferencer; } } if (dcr == null) { IDevClassReferencerHolder dcrh = context.Instance as IDevClassReferencerHolder; if (dcrh != null) { dcr = dcrh.DevClass; } } if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(context.Instance, "SqlQuery"); } } } } } } return(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) { SessionVariable sv = context.Instance as SessionVariable; SessionVariableCollection svc = context.Instance as SessionVariableCollection; if (svc == null) { LimnorWebApp wa = context.Instance as LimnorWebApp; if (wa != null) { svc = wa.GlobalVariables; } else { SessionVariableCollection.PropertyDescriptorNewSessionVariable psdv = context.PropertyDescriptor as SessionVariableCollection.PropertyDescriptorNewSessionVariable; if (psdv != null) { svc = psdv.Owner; } else { SessionVariableCollection.PropertyDescriptorSessionVariable psdv0 = context.PropertyDescriptor as SessionVariableCollection.PropertyDescriptorSessionVariable; if (psdv0 != null) { svc = psdv0.Owner; } } } } if (svc != null) { DlgSessionVariable dlg = new DlgSessionVariable(); dlg.LoadData(svc, sv); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { if (sv != null) { sv.Name = dlg.Return.Name; sv.Value = dlg.Return.Value; } else { svc.Add(dlg.Return); } value = dlg.Return; IDevClassReferencer dcr = svc.Owner as IDevClassReferencer; if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(dcr, context.PropertyDescriptor.Name); } } } } } } return(value); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { IQuery qry = context.Instance as IQuery; if (qry == null) { IClassId classPointer = context.Instance as IClassId; if (classPointer != null) { qry = VPLUtil.GetObject(classPointer.ObjectInstance) as IQuery; } } if (qry == null) { ICustomEventMethodType cemt = context.Instance as ICustomEventMethodType; if (cemt != null) { qry = cemt.ObjectValue as IQuery; } } if (qry != null) { IDatabaseAccess da = qry as IDatabaseAccess; if (da != null) { if (da.OnBeforeSetSQL()) { if (context.PropertyDescriptor != null) { da.SetSqlContext(context.PropertyDescriptor.Name); } } else { return(value); } } bool bOK = qry.IsConnectionReady; if (!bOK) { DlgConnectionManager dlgC = new DlgConnectionManager(); dlgC.UseProjectScope = true; if (edSvc.ShowDialog(dlgC) == System.Windows.Forms.DialogResult.OK) { qry.DatabaseConnection = dlgC.SelectedConnection; bOK = true; } } if (bOK) { if (qry.IsConnectionReady) { dlgQueryBuilder dlg = new dlgQueryBuilder(); QueryParser qp = new QueryParser(); qp.LoadData(qry.QueryDef); dlg.LoadData(qp); if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { IDevClassReferencer dcr = qry as IDevClassReferencer; if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyBeforeChange(context.Instance, "SqlQuery"); } } qp.checkQueryreadOnly(qp.query); qry.CopyFrom(qp.query); if (da != null && !(da is EasyGrid)) { da.Query(); //make the query and get SQL } value = qp.query.SQL.Clone(); //qry.SQL.Clone(); if (context.PropertyDescriptor.IsReadOnly) { IDatabaseAccess eq = qry as IDatabaseAccess; if (eq != null) { if (eq.NeedDesignTimeSQL) { eq.SQL = (SQLStatement)value; } else { PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(qry); ISqlUser eds = qry as ISqlUser; if (eds != null) { } else { //SQL property is read-only and will not get designer notified //For EasyGrid it will cause other properties changes. eq.SQL = (SQLStatement)value; } } } if (dcr != null) { IDevClass dc = dcr.GetDevClass(); if (dc != null) { dc.NotifyChange(context.Instance, "SqlQuery"); } } } } } } } } } return(value); }