private void setConstructorValues() { if (_owner != null && _owner.Pointer != null) { ClassInstancePointer cip = _owner.Pointer as ClassInstancePointer; if (cip != null && cip.Host != null) { ClassPointer cp = cip.Host as ClassPointer; if (cp != null) { IXType xt = cp.ObjectList.GetObjectByID(cip.MemberId) as IXType; if (xt != null) { Dictionary <string, object> cvs = xt.GetConstructorParameterValues(); if (cvs != null) { foreach (KeyValuePair <string, object> kv in cvs) { this.SetConstructorValue(kv.Key, kv.Value); } } } } } } }
internal XMemberType(string name, MemberTypes memberType, bool inherited, IXType type, string typeName) { Name = name; MemberType = memberType; Inherited = inherited; Type = type; TypeName = typeName; }
public override void SetValue(object component, object value) { if (_pif == null) { return; } if (IsStatic) { //use the type to set the static value //indexers are treated as methods _pif.SetValue(typeof(T), value, null); } else { if (typeof(T).IsAbstract) { if (_propertyValues == null) { _propertyValues = new Dictionary <string, object>(); } if (_propertyValues.ContainsKey(_pif.Name)) { _propertyValues[_pif.Name] = value; } else { _propertyValues.Add(_pif.Name, value); } } else { if (_owner != null) { _pif.SetValue(_owner, value, null); } else { _pif.SetValue(component, value, null); } } IXType xt = component as IXType; if (xt != null) { xt.OnCustomValueChanged(Name, value); } } }
public void SetConstructorValue(string name, object value) { _constructor.SetConstructorValue(name, value); if (_pointer != null && _pointer.Host != null) { ClassPointer h = _pointer.Host as ClassPointer; if (h != null) { IXType xt = h.ObjectList.GetObjectByID(_pointer.MemberId) as IXType; if (xt != null) { xt.OnConstructorValueChanged(name, value); } } } }
public void OnCustomValueChanged(string name, object value) { if (_pointer != null && _pointer.Host != null) { ClassPointer h = _pointer.Host as ClassPointer; if (h != null) { IXType xt = h.ObjectList.GetObjectByID(_pointer.MemberId) as IXType; if (xt != null) { xt.OnCustomValueChanged(name, value); } h.NotifyChange(_pointer, _pointer.Name); } } }
/// <summary> /// for a non-static abstract base type, use a dictionary to hold the value /// </summary> /// <param name="component"></param> /// <returns></returns> public override object GetValue(object component) { IXType xt = component as IXType; if (xt != null) { if (xt.IsPropertyValueSet(Name)) { return(xt.GetPropertyValue(Name)); } } if (_pif == null) { return(_defVal); } if (IsStatic) { //use the type to get the static value //indexers are treated as methods return(_pif.GetValue(typeof(T), null)); } else { if (typeof(T).IsAbstract) { if (_propertyValues != null) { object v; if (_propertyValues.TryGetValue(_pif.Name, out v)) { return(v); } } return(VPLUtil.GetDefaultValue(typeof(T))); } else { if (_owner != null) { return(_pif.GetValue(_owner, null)); } return(_pif.GetValue(component, null)); } } }
/// <summary> /// Get the summary of the type /// </summary> /// <param name="member"></param> /// <param name="project"></param> /// <returns></returns> static public string GetTypeSummary(IXType type, XProject project, out string returns, out string remarks) { string summary = null; returns = remarks = ""; if (type == null) { return(""); } if (type is XTypeDefinition) { var xdef = (XTypeDefinition)type; var xml = xdef.XmlComments; var xfile = XSharpXMLDocTools.firstfile; if (xfile != null && !string.IsNullOrEmpty(xml)) { summary = getSummary(xfile, xml, out returns, out remarks); } return(summary); } var xtype = (XTypeReference)type; var declarationAssembly = xtype.Assembly; var file = XSharpXMLDocTools.GetXmlDocFile(declarationAssembly, project); if (file == null) { return(null); } string sig = xtype.XMLSignature; if (!string.IsNullOrEmpty(sig)) { uint id = 0; string xml = ""; var result = file.ParseMemberSignature(sig, out id); if (result >= 0 && id != 0) { result = file.GetMemberXML(id, out xml); } summary = getSummary(file, xml, out returns, out remarks); } return(summary); }
internal XCodeTypeReference(IXType type) : base(type.FullName) { }
/// This is called whenever the user right-clicks on a designer. It removes any local verbs /// added by a previous, different selection and adds the local verbs for the current (primary) /// selection. Then it displays the ContextMenu. public override void ShowContextMenu(CommandID menuID, int x, int y) { ISelectionService ss = this.GetService(typeof(ISelectionService)) as ISelectionService; if (ss == null || ss.PrimarySelection == null) { return; } IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost)); // if (host != null) { HostSurface surface = host.GetService(typeof(DesignSurface)) as HostSurface; if (surface != null) { ContextMenu menu = new ContextMenu(); if (host.RootComponent != ss.PrimarySelection && ss.PrimarySelection is Control) { MenuItem mi = new MenuItem("Bring to front", menu_bringToFront); mi.Tag = ss.PrimarySelection; menu.MenuItems.Add(mi); // mi = new MenuItem("Send to back", menu_sendToBack); mi.Tag = ss.PrimarySelection; menu.MenuItems.Add(mi); // menu.MenuItems.Add("-"); } if (host.RootComponent != ss.PrimarySelection) { MenuItem mi = new MenuItem("Copy", menu_cmd); mi.Tag = StandardCommands.Copy; menu.MenuItems.Add(mi); // mi = new MenuItem("Cut", menu_cmd); mi.Tag = StandardCommands.Cut; menu.MenuItems.Add(mi); // mi = new MenuItem("Delete", menu_cmd); mi.Tag = StandardCommands.Delete; menu.MenuItems.Add(mi); // if (ss.SelectionCount == 1) { MenuItem mi2 = new MenuItemWithBitmap("Add to toolbar", addToToolbar, Resource1._toolbar.ToBitmap()); IXType ix = ss.PrimarySelection as IXType; if (ix != null) { mi2.Tag = ix.ValueType; } else { mi2.Tag = ss.PrimarySelection.GetType(); } menu.MenuItems.Add(mi2); } } else { MenuItem mi = new MenuItem("Undo", menu_cmd); mi.Tag = StandardCommands.Undo; menu.MenuItems.Add(mi); // mi = new MenuItem("Redo", menu_cmd); mi.Tag = StandardCommands.Redo; menu.MenuItems.Add(mi); // mi = new MenuItem("Paste", menu_cmd); mi.Tag = StandardCommands.Paste; menu.MenuItems.Add(mi); } // DrawingPage dp = ss.PrimarySelection as DrawingPage; if (dp != null) { MenuItem mi2 = new MenuItem("-"); menu.MenuItems.Add(mi2); // mi2 = new MenuItemWithBitmap("Drawing Board", showDrawingBoard, Resource1._paint.ToBitmap()); mi2.Tag = dp; menu.MenuItems.Add(mi2); } else { IDrawDesignControl drc = ss.PrimarySelection as IDrawDesignControl; if (drc != null) { MenuItem midrc = new MenuItemWithBitmap("Copy to Clipboard as bitmap image", mi_copyDrawing, Resource1._copy.ToBitmap()); midrc.Tag = drc; menu.MenuItems.Add(midrc); midrc = new MenuItemWithBitmap("Save to XML file", mi_savedrawing, Resource1._savefile.ToBitmap()); midrc.Tag = drc; menu.MenuItems.Add(midrc); midrc = new MenuItemWithBitmap("Load from XML file", mi_loadDrawing, Resource1._loadfile.ToBitmap()); midrc.Tag = drc; menu.MenuItems.Add(midrc); } } MenuItem mi20 = new MenuItem("-"); menu.MenuItems.Add(mi20); MenuItem miAddComponent = new MenuItemWithBitmap("Add component", mi_addComponent, Resource1._newIcon.ToBitmap()); menu.MenuItems.Add(miAddComponent); // LimnorContextMenuCollection mdata = surface.GetObjectMenuData(ss.PrimarySelection); if (mdata != null) { if (menu.MenuItems.Count > 0) { menu.MenuItems.Add("-"); } mdata.CreateContextMenu(menu, new Point(0, 0), surface.Loader.ViewerHolder); } if (menu.MenuItems.Count > 0) { Control ps = surface.View as Control; if (ps != null) { LimnorXmlDesignerLoader2.MenuPoint = new Point(x, y); Point s = ps.PointToClient(LimnorXmlDesignerLoader2.MenuPoint); menu.Show(ps, s); } else { ps = ss.PrimarySelection as Control; if (ps != null) { LimnorXmlDesignerLoader2.MenuPoint = new Point(x, y); Point s = ps.PointToScreen(new Point(0, 0)); menu.Show(ps, new Point(x - s.X, y - s.Y)); } } } } } }
internal QuickInfoTypeAnalysis(IXType type, Brush fg, Brush txt) : base(type) { this.kwBrush = fg; this.txtBrush = txt; _type = type; }