Beispiel #1
0
 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);
 }
Beispiel #3
0
 public void SetOwner(IDevClassReferencer owner)
 {
     _owner = owner;
     if (_text == null)
     {
         _text = new DTSSourceText();
     }
     _text.SetOwner(_owner);
 }
 public void SetOwner(IDevClassReferencer owner)
 {
     _owner = owner;
     if (_text == null)
     {
         _text = new DTDestTextFile();
     }
     _text.SetOwner(_owner);
     if (_db == null)
     {
         _db = new DTDest();
     }
     _db.SetOwner(_owner);
 }
 public void SetOwner(IDevClassReferencer owner)
 {
     _owner = owner;
 }
 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);
 }
Beispiel #8
0
 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);
        }