Exemplo n.º 1
0
 public static bool SaveBitmapToFile(Bitmap bitmap, string filename, EnumImageFormat format, bool cropImage)
 {
     if (bitmap != null && !string.IsNullOrEmpty(filename))
     {
         if (cropImage)
         {
             DlgCropImage dlg = new DlgCropImage();
             dlg.LoadData(bitmap);
             dlg.ShowDialog();
             bitmap = dlg.Result as Bitmap;
         }
         if (bitmap != null)
         {
             if (System.IO.File.Exists(filename))
             {
                 System.IO.File.Delete(filename);
             }
             try
             {
                 using (Bitmap bm = new Bitmap(bitmap))
                 {
                     bm.Save(filename, VPLUtil.GetImageFormat(format));
                 }
                 return(true);
             }
             catch (Exception err)
             {
                 MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "Error saving image to [{0}]. Verify it is a valid file name. {1}", filename, err.Message));
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node != null)
     {
         mi = e.Node.Tag as MethodInfo;
         if (mi != null)
         {
             this.Text = "Method:" + e.Node.Text;
             ParameterInfo[] pis = mi.GetParameters();
             parameters = new PropertyTable();
             for (int i = 0; i < pis.Length; i++)
             {
                 try
                 {
                     object v = VPLUtil.GetDefaultValue(pis[i].ParameterType);
                     Type   t = pis[i].ParameterType;
                     if (t.Equals(typeof(object)))
                     {
                         t = typeof(string);
                     }
                     parameters.Properties.Add(new PropertySpec(pis[i].Name, t, "", "", v));
                     parameters[pis[i].Name] = v;
                 }
                 catch (Exception err)
                 {
                     MathNode.Log(this, err);
                 }
             }
             propertyGrid1.SelectedObject = parameters;
         }
     }
 }
Exemplo n.º 3
0
 private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
 {
     e.DrawBackground();
     if (e.Index >= 0)
     {
         if ((e.State & DrawItemState.Selected) != 0)
         {
             e.DrawFocusRectangle();
         }
         string sName = listBox1.Items[e.Index] as string;
         Type   t     = _types[sName];
         Image  img;
         if (!imgs.TryGetValue(t, out img))
         {
             img = VPLUtil.GetTypeIcon(t);
             imgs.Add(t, img);
         }
         System.Drawing.Rectangle rc = new System.Drawing.Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
         e.Graphics.DrawImage(img, rc.X, rc.Y);
         rc.X += 16;
         if (rc.Width > 16)
         {
             rc.Width -= 16;
         }
         e.Graphics.DrawString(sName, this.Font, Brushes.Black, rc);
     }
 }
        public TreeNode CreatePointer()
        {
            TreeNodePointer obj = new TreeNodePointer(_xmlNode);

            if (this.IsShortcut)
            {
                bool      loaded = false;
                TreeViewX tvx    = this.TreeView as TreeViewX;
                if (tvx != null)
                {
                    TreeNodeX tnx = tvx.GetCategoryNodeById(this.TreeNodeId);
                    if (tnx != null)
                    {
                        VPLUtil.CopyProperties(tnx, obj);
                        loaded = true;
                    }
                }
                if (!loaded)
                {
                    ObjectXmlReader oxr = new ObjectXmlReader();
                    oxr.ReadProperties(_xmlNode, obj);
                }
            }
            else
            {
                VPLUtil.CopyProperties(this, obj);
            }
            return(obj);
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //
            List <string> lst = new List <string>();

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                string name = VPLUtil.ObjectToString(dataGridView1.Rows[i].Cells[0].Value);
                if (!string.IsNullOrEmpty(name))
                {
                    lst.Add(name);
                }
            }
            string[] valueList = new string[lst.Count];
            lst.CopyTo(valueList, 0);
            DataEditorLookup de = this.SelectedEditor as DataEditorLookup;

            if (de == null)
            {
                de = new DataEditorLookup();
                this.SetSelection(de);
            }
            de.values         = valueList;
            this.DialogResult = DialogResult.OK;
        }
 public static string AddToolboxType(Type t)
 {
     if (t != null)
     {
         if (_toolboxTypes == null)
         {
             _toolboxTypes = new Dictionary <string, Type>();
         }
         foreach (KeyValuePair <string, Type> kv in _toolboxTypes)
         {
             if (t.Equals(kv.Value))
             {
                 return(kv.Key);
             }
         }
         string name = VPLUtil.GetTypeDisplay(t);
         int    n    = 1;
         while (_toolboxTypes.ContainsKey(name))
         {
             n++;
             name = string.Format(CultureInfo.InvariantCulture, "{0}{1}", t.Name, n);
         }
         _toolboxTypes.Add(name, t);
         return(name);
     }
     return(string.Empty);
 }
        public void OnLoadNextLevel(NodeLoader loader)
        {
            _nextLevelLoaded = true;
            WixCultureCollection cultures = this.Cultures;

            if (cultures != null && cultures.CultureList.Count > 0)
            {
                ImageList imgs = null;
                if (this.TreeView != null)
                {
                    imgs = this.TreeView.ImageList;
                }
                foreach (WixCultureNode s in cultures.CultureList)
                {
                    int idx = -1;
                    if (imgs != null)
                    {
                        Image img = VPLUtil.GetLanguageImageByName(s.CultureNode.Culture);
                        if (img != null)
                        {
                            idx = imgs.Images.Add(img, Color.White);
                        }
                    }
                    TreeNodeWixCulture sn = new TreeNodeWixCulture(s, idx);
                    Nodes.Add(sn);
                }
            }
        }
Exemplo n.º 8
0
        private void btDelTable_Click(object sender, System.EventArgs e)
        {
            TableNode nd = treeView1.SelectedNode as TableNode;

            if (nd != null)
            {
                try
                {
                    string s = "Table name:" + nd.Text + "\r\n" + "Do you want to delete this table from the database?";
                    if (MessageBox.Show(this, s, this.Text, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        qry.DatabaseConnection.ConnectionObject.DropTable(nd.Text);
                        Connection cn = new Connection();
                        cn.TheConnection = qry.DatabaseConnection.ConnectionObject.TheConnection;
                        schema.dbCon     = cn;
                        schema.LoadSchema();
                        loadTables();
                    }
                }
                catch (Exception er)
                {
                    MessageBox.Show(this, VPLUtil.FormExceptionText(er), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public static void CheckDeclareField(bool isStatic, string fieldName, DataTypePointer fieldType, CodeTypeDeclaration typeDeclaration, string defaultValue)
        {
            CodeMemberField cmf;

            foreach (CodeTypeMember ctm in typeDeclaration.Members)
            {
                cmf = ctm as CodeMemberField;
                if (cmf != null)
                {
                    if (string.CompareOrdinal(cmf.Name, fieldName) == 0)
                    {
                        return;
                    }
                }
            }
            cmf = new CodeMemberField(fieldType.TypeString, fieldName);
            if (!string.IsNullOrEmpty(defaultValue))
            {
                bool   b;
                object val = VPLUtil.ConvertObject(defaultValue, fieldType.BaseClassType, out b);
                if (b)
                {
                    cmf.InitExpression = ObjectCreationCodeGen.ObjectCreationCode(val);
                }
            }
            if (isStatic)
            {
                cmf.Attributes |= MemberAttributes.Static;
            }
            typeDeclaration.Members.Add(cmf);
        }
Exemplo n.º 10
0
        public override string ToString()
        {
            Type   t = this.DataType.Type;
            object v = VPLUtil.GetDefaultValue(t);

            return(v.ToString());
        }
Exemplo n.º 11
0
        private static void copyFolder(string srcDir, string tgtDir, StringBuilder errs)
        {
            if (!Directory.Exists(tgtDir))
            {
                Directory.CreateDirectory(tgtDir);
            }
            string s = VPLUtil.GrantFolderFullPermission(tgtDir);

            if (!string.IsNullOrEmpty(s))
            {
                errs.Append(string.Format(CultureInfo.InvariantCulture, "Error granting permissions to [{0}]. {1}\r\n", tgtDir, s));
            }
            string[] ss = Directory.GetFiles(srcDir);
            for (int i = 0; i < ss.Length; i++)
            {
                string tgtFile = Path.Combine(tgtDir, Path.GetFileName(ss[i]));
                File.Copy(ss[i], tgtFile, true);
            }
            ss = Directory.GetDirectories(srcDir);
            if (ss != null && ss.Length > 0)
            {
                for (int i = 0; i < ss.Length; i++)
                {
                    string s0 = Path.Combine(tgtDir, Path.GetFileName(ss[i]));
                    copyFolder(ss[i], s0, errs);
                }
            }
        }
Exemplo n.º 12
0
        public IList <CodeAttributeArgument> CreatePropertyExpressions()
        {
            List <CodeAttributeArgument> lst = new List <CodeAttributeArgument>();

            if (_values != null && _values.Count > 0)
            {
                if (_defValues == null)
                {
                    _defValues = new Dictionary <string, object>();
                }
                if (_defValues.Count == 0)
                {
                    GetProperties();
                }
                foreach (KeyValuePair <string, object> kv in _values)
                {
                    if (_defValues.ContainsKey(kv.Key))
                    {
                        if (VPLUtil.IsValueEqual(kv.Value, _defValues[kv.Key]))
                        {
                            continue;
                        }
                    }
                    lst.Add(new CodeAttributeArgument(kv.Key, ObjectCreationCodeGen.ObjectCreationCode(kv.Value)));
                }
            }
            return(lst);
        }
 public CodeExpression GetReferenceCode(object method, CodeStatementCollection statements, string propertyName, CodeExpression target, bool forValue)
 {
     if (_ps != null)
     {
         return(_ps.GetReferenceCode(method, statements, propertyName, target, forValue));
     }
     if (_pp != null)
     {
         for (int i = 0; i < _pp.Length; i++)
         {
             if (string.Compare(_pp[i].Name, propertyName, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 if (forValue)
                 {
                     return(VPLUtil.ConvertByType(EPField.ToSystemType(_pp[i].Type), new CodePropertyReferenceExpression(new CodeArrayIndexerExpression(target, new CodePrimitiveExpression(propertyName)), "Value")));
                 }
                 else
                 {
                     return(new CodePropertyReferenceExpression(new CodeArrayIndexerExpression(target, new CodePrimitiveExpression(propertyName)), "Value"));
                 }
             }
         }
     }
     return(target);
 }
Exemplo n.º 14
0
 public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     if (VPLUtil.GetBrowseableProperties(attributes))
     {
         PropertyDescriptorCollection ps   = TypeDescriptor.GetProperties(this, attributes, true);
         List <PropertyDescriptor>    list = new List <PropertyDescriptor>();
         foreach (PropertyDescriptor p in ps)
         {
             if (string.CompareOrdinal(p.Name, "ReturnValueType") == 0)
             {
                 if (_methodPointer == null || _methodPointer.NoReturn || !_methodPointer.HasReturn)
                 {
                     continue;
                 }
             }
             list.Add(new PropertyDescriptorWrapper(p, this));
         }
         ps = new PropertyDescriptorCollection(list.ToArray());
         return(ps);
     }
     else
     {
         return(TypeDescriptor.GetProperties(this, attributes, true));
     }
 }
        public static PropertyDescriptorCollection GetWebClientProperties(IWebClientComponent obj, StringCollection names, Attribute[] attributes)
        {
            PropertyDescriptorCollection ps  = TypeDescriptor.GetProperties(obj, attributes, true);
            List <PropertyDescriptor>    lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (names == null || names.Contains(p.Name))
                {
                    if (VPLUtil.IsCompiling)
                    {
                        lst.Add(p);
                    }
                    else
                    {
                        if (VPLUtil.HasAttribute(p, typeof(ReadOnlyInProgrammingAttribute)))
                        {
                            lst.Add(new ReadOnlyPropertyDesc(p));
                        }
                        else
                        {
                            lst.Add(p);
                        }
                    }
                }
            }
            WebClientValueCollection.AddPropertyDescs(lst, obj.CustomValues);
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
 public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     if (VPLUtil.GetBrowseableProperties(attributes))
     {
         PropertyDescriptorCollection ps   = TypeDescriptor.GetProperties(this, attributes, true);
         List <PropertyDescriptor>    list = new List <PropertyDescriptor>();
         foreach (PropertyDescriptor p in ps)
         {
             if (p.Name == Instance_Type)
             {
                 if (_var.ObjectType.IsPrimitive || _var.ObjectType.IsSealed || _var.ObjectType.IsValueType)
                 {
                     PropertyDescriptorForDisplay pd = new PropertyDescriptorForDisplay(this.GetType(), p.Name, _valType.ToString(), attributes);
                     list.Add(pd);
                 }
                 else
                 {
                     list.Add(p);
                 }
             }
             else
             {
                 list.Add(p);
             }
         }
         ps = new PropertyDescriptorCollection(list.ToArray());
         return(ps);
     }
     else
     {
         return(TypeDescriptor.GetProperties(this, attributes, true));
     }
 }
 public static string GetMethodSignature(MethodInfo mif, string name, bool includeMethodName, out int paramCount)
 {
     ParameterInfo[] pifs = mif.GetParameters();
     Type[]          pp   = new Type[pifs.Length];
     for (int i = 0; i < pifs.Length; i++)
     {
         pp[i] = pifs[i].ParameterType;
     }
     if (string.IsNullOrEmpty(name))
     {
         name = mif.Name;
     }
     if (mif.ContainsGenericParameters)
     {
         Type[]        tcs = mif.GetGenericArguments();
         StringBuilder sb  = new StringBuilder(name);
         sb.Append("<");
         if (tcs.Length > 0)
         {
             sb.Append(VPLUtil.GetTypeDisplay(tcs[0]));
             for (int i = 1; i < tcs.Length; i++)
             {
                 sb.Append(";");
                 sb.Append(VPLUtil.GetTypeDisplay(tcs[i]));
             }
         }
         sb.Append(">");
         name = sb.ToString();
     }
     return(GetMethodSignature(name, includeMethodName, pp, mif.ReturnType, out paramCount));
 }
        public virtual Dictionary <string, string> GetParameterDescriptions()
        {
            string methodDesc;
            string returnDesc;
            Dictionary <string, string> ps = PMEXmlParser.GetMethodDescription(VPLUtil.GetObjectType(Owner.ObjectType), MethodDef, out methodDesc, out returnDesc);
            IDynamicMethodParameters    d  = Owner.ObjectInstance as IDynamicMethodParameters;

            if (d != null)
            {
                Dictionary <string, string> pc = d.GetParameterDescriptions(this.MemberName);
                if (pc != null)
                {
                    foreach (KeyValuePair <string, string> kv in pc)
                    {
                        if (ps.ContainsKey(kv.Key))
                        {
                            ps[kv.Key] = kv.Value;
                        }
                        else
                        {
                            ps.Add(kv.Key, kv.Value);
                        }
                    }
                }
            }
            return(ps);
        }
        public static string ObjectCreatePhpScriptCode(object v)
        {
            if (v == null || v == System.DBNull.Value)
            {
                return("NULL");
            }
            Type t = v.GetType();

            //if (typeof(Color).Equals(t))
            //{
            //    Color c = (Color)v;
            //    return WebPage.GetColorString(c);
            //}
            //if (typeof(Font).Equals(t))
            //{
            //    Font ft = (Font)v;
            //    return WebPage.GetFontStyleString(ft);
            //}
            if (VPLUtil.IsNumber(t))
            {
                return(v.ToString());
            }
            TypeConverter tc = TypeDescriptor.GetConverter(t);

            if (tc != null && tc.CanConvertTo(typeof(string)))
            {
                string vs = tc.ConvertToInvariantString(v);
                return(string.Format(CultureInfo.InvariantCulture, "'{0}'", vs));
            }
            return(string.Format(CultureInfo.InvariantCulture, "'{0}'", v));
        }
Exemplo n.º 20
0
        private void btEdit_Click(object sender, System.EventArgs e)
        {
            TableNode nd = treeView1.SelectedNode as TableNode;
            int       n  = cbxFields.SelectedIndex;

            if (nd != null && n >= 0)
            {
                try
                {
                    dlgEditField dlg = new dlgEditField();
                    EPField      fld = (EPField)((EPField)cbxFields.Items[n]).Clone();
                    dlg.LoadData(nd.Text, fld, qry.DatabaseConnection.ConnectionObject);
                    if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        nd.table.GetFields(qry.DatabaseConnection.ConnectionObject);
                        nd.table.GetIndexes(qry.DatabaseConnection.ConnectionObject);
                        treeView1_AfterSelect(null, null);
                        if (n < cbxFields.Items.Count)
                        {
                            cbxFields.SelectedIndex = n;
                        }
                    }
                }
                catch (Exception er)
                {
                    MessageBox.Show(this, VPLUtil.FormExceptionText(er), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 private bool validateName(string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         MessageBox.Show("Name is empty", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     if (name.StartsWith("@", StringComparison.Ordinal))
     {
         name = name.Substring(1);
     }
     if (!VPLUtil.IsValidVariableName(name))
     {
         MessageBox.Show("Name is invalid", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     name = string.Format(CultureInfo.InvariantCulture, "@{0}", name);
     for (int i = 0; i < this.Count; i++)
     {
         if (string.Compare(name, this[i].Name, StringComparison.OrdinalIgnoreCase) == 0)
         {
             MessageBox.Show("Name is in use", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
     }
     return(true);
 }
 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)
         {
             if (VPLUtil.delegateGetComponentList != null)
             {
                 IComponent ic = context.Instance as IComponent;
                 if (ic != null)
                 {
                     IList <IComponentID> cs = VPLUtil.delegateGetComponentList(ic);
                     if (cs != null && cs.Count > 0)
                     {
                         ValueList list = new ValueList(edSvc, cs);
                         edSvc.DropDownControl(list);
                         if (list.MadeSelection)
                         {
                             value = list.Selection as IComponentID;
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }
Exemplo n.º 23
0
 public void AddAssembly(Assembly a)
 {
     Type[] tps = VPLUtil.GetExportedTypes(a);
     for (int i = 0; i < tps.Length; i++)
     {
         if (tps[i] != null && tps[i].IsPublic)
         {
             if (string.IsNullOrEmpty(tps[i].Namespace))
             {
                 NamespaceClass nc;
                 if (!_namespaces.TryGetValue(string.Empty, out nc))
                 {
                     nc = new NamespaceClass(string.Empty);
                     _namespaces.Add(string.Empty, nc);
                 }
                 nc.AddType(tps[i]);
             }
             else
             {
                 NamespaceClass nc;
                 if (!_namespaces.TryGetValue(tps[i].Namespace, out nc))
                 {
                     nc = new NamespaceClass(tps[i].Namespace);
                     _namespaces.Add(tps[i].Namespace, nc);
                 }
                 nc.AddType(tps[i]);
             }
         }
     }
 }
Exemplo n.º 24
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //
            Dictionary <string, string> lst = new Dictionary <string, string>();

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                string name = VPLUtil.ObjectToString(dataGridView1.Rows[i].Cells[0].Value);
                string val  = VPLUtil.ObjectToString(dataGridView1.Rows[i].Cells[1].Value);
                if (!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(val))
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        name = val;
                    }
                    if (string.IsNullOrEmpty(val))
                    {
                        val = name;
                    }
                }
                if (!string.IsNullOrEmpty(name))
                {
                    lst.Add(name, val);
                }
            }
            WebDataEditorLookup de = this.SelectedEditor as WebDataEditorLookup;

            if (de == null)
            {
                de = new WebDataEditorLookup();
                this.SetSelection(de);
            }
            de.values         = lst;
            this.DialogResult = DialogResult.OK;
        }
        public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes, true);

            if (!VPLUtil.GetBrowseableProperties(attributes))
            {
                return(ps);
            }
            List <PropertyDescriptor> lst = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                if (string.CompareOrdinal(p.Name, "TextDestination") == 0)
                {
                    if (DestinationType == EnumDataDestination.Database)
                    {
                        continue;
                    }
                }
                else if (string.CompareOrdinal(p.Name, "DatabaseDestination") == 0)
                {
                    if (DestinationType == EnumDataDestination.TextFile)
                    {
                        continue;
                    }
                }
                lst.Add(p);
            }
            return(new PropertyDescriptorCollection(lst.ToArray()));
        }
Exemplo n.º 26
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)
         {
             EasyUpdator eu = context.Instance as EasyUpdator;
             if (eu == null)
             {
                 object   pointer;
                 IClassId ic = context.Instance as IClassId;
                 if (ic != null)
                 {
                     pointer = ic.ObjectInstance;
                 }
                 else
                 {
                     pointer = context.Instance;
                 }
                 if (pointer != null)
                 {
                     eu = VPLUtil.GetObject(pointer) as EasyUpdator;
                 }
             }
             if (eu != null)
             {
                 SQLNoneQuery sq = value as SQLNoneQuery;
                 if (sq == null)
                 {
                     sq = new SQLNoneQuery();
                 }
                 sq.SetConnection(eu.DatabaseConnection);
                 bool bOK = eu.DatabaseConnection.ConnectionObject.IsConnectionReady;
                 if (!bOK)
                 {
                     DlgConnectionManager dlgC = new DlgConnectionManager();
                     dlgC.UseProjectScope = true;
                     if (edSvc.ShowDialog(dlgC) == System.Windows.Forms.DialogResult.OK)
                     {
                         eu.DatabaseConnection = dlgC.SelectedConnection;
                         sq.SetConnection(dlgC.SelectedConnection);
                         bOK = true;
                     }
                 }
                 if (bOK)
                 {
                     dlgPropSQLNonQuery dlg = new dlgPropSQLNonQuery();
                     dlg.LoadData(sq);
                     if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                     {
                         value = dlg.objRet;
                     }
                 }
             }
         }
     }
     return(value);
 }
Exemplo n.º 27
0
 public DlgWebPageData()
 {
     InitializeComponent();
     if (VPLUtil.CollectLanguageIcons != null)
     {
         VPLUtil.CollectLanguageIcons(imageList1);
     }
 }
 public override string ToString()
 {
     if (_type == null)
     {
         return("?");
     }
     return(VPLUtil.GetTypeDisplay(_type));
 }
 public Cultrue(CultureInfo c)
 {
     _culture = c;
     if (VPLUtil.GetLanguageImageByName != null)
     {
         _img = VPLUtil.GetLanguageImageByName(c.Name);
     }
 }
Exemplo n.º 30
0
        public static PropertyDescriptorCollection GetObjectProperties(EnumReflectionMemberInfoSelectScope scope, object obj, bool browsableOnly)
        {
            bool includeClient = MethodInfoWebClient.IsWebClientObject(obj);
            bool includeServer = MethodInfoWebClient.IsWebServerObject(obj);
            PropertyDescriptorCollection ps = VPLUtil.GetProperties(obj, scope, false, browsableOnly, true);            // TypeDescriptor.GetProperties(obj, attrs, false);
            List <PropertyDescriptor>    l  = new List <PropertyDescriptor>();

            foreach (PropertyDescriptor p in ps)
            {
                bool include = false;
                if (includeClient)
                {
                    if (WebClientMemberAttribute.IsClientProperty(p))
                    {
                        include = true;
                    }
                }
                if (!include)
                {
                    if (includeServer)
                    {
                        if (WebServerMemberAttribute.IsServerProperty(p))
                        {
                            include = true;
                        }
                    }
                }
                if (!include)
                {
                    if (includeClient)
                    {
                        if (!(obj is Form) && (obj is IWebClientControl))
                        {
                            if (string.CompareOrdinal(p.Name, "Location") != 0)
                            {
                                include = true;
                            }
                        }
                    }
                }
                if (!include)
                {
                    if (includeServer)
                    {
                        if (obj is IWebServerProgrammingSupport)
                        {
                            include = true;
                        }
                    }
                }
                if (include)
                {
                    l.Add(p);
                }
            }
            return(new PropertyDescriptorCollection(l.ToArray()));
        }