コード例 #1
0
        private void BuildType(TypeListItem typeListItem, _VSOBJDESCOPTIONS options)
        {
            var compilation = GetCompilation();

            if (compilation == null)
            {
                return;
            }

            var symbol = typeListItem.ResolveTypedSymbol(compilation);

            if (symbol == null)
            {
                return;
            }

            if (symbol.TypeKind == TypeKind.Delegate)
            {
                BuildDelegateDeclaration(symbol, options);
            }
            else
            {
                BuildTypeDeclaration(symbol, options);
            }

            AddEndDeclaration();
            BuildMemberOf(symbol.ContainingNamespace, options);

            BuildXmlDocumentation(symbol, compilation, options);
        }
コード例 #2
0
        private void listView_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (listView.FocusedItem.Bounds.Contains(e.Location) == true)
                {
                    if (listView.SelectedObject != null)
                    {
                        TypeListItem item = listView.SelectedObject as TypeListItem;


                        //CalculatorItem item = listView.SelectedObject as CalculatorItem;
                        ContextMenuStrip menu = new ContextMenuStrip();

                        ToolStripMenuItem importItem = new ToolStripMenuItem()
                        {
                            Text = "Import " + item.Name, Tag = item.Name
                        };
                        importItem.Click += new EventHandler(import_Menu_Click);
                        menu.Items.Add(importItem);

                        ToolStripMenuItem exportItem = new ToolStripMenuItem()
                        {
                            Text = "Export " + item.Name, Tag = item.Name
                        };
                        exportItem.Click += new EventHandler(export_Menu_Click);
                        menu.Items.Add(exportItem);

                        menu.Show(Cursor.Position);
                    }
                }
            }
        }
コード例 #3
0
 private void listView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView.SelectedObject != null)
     {
         TypeListItem item = listView.SelectedObject as TypeListItem;
         ThemeType    type = (ThemeType)Enum.Parse(typeof(ThemeType), item.Name);
         SetTheme(type, ParentForm);
     }
 }
コード例 #4
0
        private void button_SetTheme_Click(object sender, EventArgs e)
        {
            TypeListItem item = listView.SelectedObject as TypeListItem;
            ThemeType    type = (ThemeType)Enum.Parse(typeof(ThemeType), item.Name);

            if (SetTheme(type))
            {
                listView.SelectedIndex = preferences.Theme.type.GetHashCode();
            }
        }
コード例 #5
0
        private object aspect_icon(object rowObject)
        {
            //Machine m = (Machine)rowObject;
            TypeListItem item = (TypeListItem)rowObject;

            //int rowheight = listView.RowHeightEffective - 2;
            //string iconName = EnumUtils.GetDescription(item.Name);
            //return ContentManager.ResizeImage(ContentManager.GetIcon(iconName), listView.RowHeightEffective, listView.RowHeightEffective);
            return(ContentManager.ResizeImage(ContentManager.GetIcon(item.Name), listView.RowHeightEffective, listView.RowHeightEffective));
        }
コード例 #6
0
        //Get (Details by ID)
        public TypeListItem GetTypeById(int typeId)
        {
            var typeEntity = _context.Type.Find(typeId);
            var typeDetail = new TypeListItem
            {
                TypeID   = typeEntity.TypeID,
                TypeName = typeEntity.TypeName
            };

            return(typeDetail);
        }
コード例 #7
0
        private void import_Menu_Click(object sender, EventArgs e)
        {
            TypeListItem item = listView.SelectedObject as TypeListItem;

            //LogManager.AddLogMessage(Name, "import_Menu_Click", item.Name, LogManager.LogMessageType.DEBUG);
            if (item.Name != "Application")
            {
                PreferenceType type = (PreferenceType)Enum.Parse(typeof(PreferenceType), item.Name);
                ImportPreferences(type);
            }
            else
            {
                ImportPreferences(PreferenceType.None);
            }
        }
コード例 #8
0
        private void InitializeThemes()
        {
            var values = EnumUtils.GetValues <ThemeType>();
            List <TypeListItem> list = new List <TypeListItem>();

            foreach (ThemeType type in values)
            {
                //LogManager.AddLogMessage(Name, "UpdateUI", type.ToString() + " | " + type.GetHashCode(), LogManager.LogMessageType.DEBUG);
                TypeListItem item = new TypeListItem()
                {
                    Name = type.ToString(),
                    type = type.GetType()
                };
                list.Add(item);
            }
            listView.SetObjects(list);
            listView.SelectedIndex = preferences.Theme.type.GetHashCode();
        }
コード例 #9
0
        public void UpdateUI(bool resize = false)
        {
            if (InvokeRequired)
            {
                UpdateUICallback d = new UpdateUICallback(UpdateUI);
                Invoke(d, new object[] { resize });
            }
            else
            {
                var values = EnumUtils.GetValues <PreferenceType>();
                List <TypeListItem> list = new List <TypeListItem>();

                foreach (PreferenceType type in values)
                {
                    //LogManager.AddLogMessage(Name, "UpdateUI", type.ToString() + " | " + type.GetHashCode(), LogManager.LogMessageType.DEBUG);
                    TypeListItem item = new TypeListItem()
                    {
                        Name = type.ToString(),
                        type = type.GetType()
                    };

                    if (item.Name != "None")
                    {
                        list.Add(item);
                    }
                    else
                    {
                        item.Name = "Application";
                        list.Add(item);
                    }
                }
                listView.SetObjects(list);
                //listView.SetObjects(ExchangeManager.Exchanges);
                groupBox.Text = listView.Items.Count + " Preferences";

                if (resize)
                {
                    ResizeUI();
                }
            }
        }
コード例 #10
0
            private void OnnewItemTypes_SelectionChangeCommitted(object sender, EventArgs e)
            {
                TypeListItem selectedItem = this.newItemTypes.SelectedItem as TypeListItem;

                if (selectedItem != null)
                {
                    ToolStripItem component = (ToolStripItem)base.CreateInstance(selectedItem.Type);
                    if (((component is ToolStripButton) || (component is ToolStripSplitButton)) || (component is ToolStripDropDownButton))
                    {
                        Image image = null;
                        try
                        {
                            image = new Bitmap(typeof(ToolStripButton), "blank.bmp");
                        }
                        catch (Exception exception)
                        {
                            if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
                            {
                                throw;
                            }
                        }
                        PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Image"];
                        if ((descriptor != null) && (image != null))
                        {
                            descriptor.SetValue(component, image);
                        }
                        PropertyDescriptor descriptor2 = TypeDescriptor.GetProperties(component)["DisplayStyle"];
                        if (descriptor2 != null)
                        {
                            descriptor2.SetValue(component, ToolStripItemDisplayStyle.Image);
                        }
                        PropertyDescriptor descriptor3 = TypeDescriptor.GetProperties(component)["ImageTransparentColor"];
                        if (descriptor3 != null)
                        {
                            descriptor3.SetValue(component, Color.Magenta);
                        }
                    }
                    this.AddItem(component, -1);
                    this.listBoxItems.Focus();
                }
            }
コード例 #11
0
        }         // proc UpdateTypeList

        public Declarations FindDeclarations(bool lTypes, string sStarts)
        {
            InitComponent();

            if (lTypes)
            {
                // Aktualisiere die Typ-Liste
                if (typeRoot == null || Math.Abs(Environment.TickCount - iLastTypeUpdated) > 60000)
                {
                    typeRoot = null;
                    UpdateTypeList();
                }

                // Suche den Passenden Knoten
                return(typeRoot.FindNameSpace(0, sStarts, false));
            }
            else
            {
                return(null);
            }

            //IVsNavInfo navInfo;
            //Guid guid;
            //library.GetGuid(out guid);
            //libraryScope.get_RootNavInfo(out navInfo);
            //ErrorHandler.ThrowOnFailure(libraryScope.CreateNavInfo(ref guid,
            //	new SYMBOL_DESCRIPTION_NODE[] { new SYMBOL_DESCRIPTION_NODE() { dwType = (uint)_LIB_LISTTYPE.LLT_NAMESPACES, pszName = "System" } }, 1, out navInfo));

            //IVsObjectList2 listC;
            //ErrorHandler.ThrowOnFailure(libraryScope.put_ChildListOptions((uint)(_BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_DRAG_DROP | _BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_REMOVE | _BROWSE_COMPONENT_SET_OPTIONS.BCSO_NO_RENAME)));
            //ErrorHandler.ThrowOnFailure(libraryScope.GetList2((uint)_LIB_LISTTYPE.LLT_NAMESPACES, (uint)_LIB_FLAGS.LF_GLOBAL,
            //	new[]
            //	{
            //		new VSOBSEARCHCRITERIA2()
            //		{
            //			eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //			szName = sStarts
            //		}
            //	}, null, out listC));

            //IVsSimpleObjectList2 simpleList = listC as IVsSimpleObjectList2;
            //ErrorHandler.ThrowOnFailure(library.GetList2((uint)(_LIB_LISTTYPE.LLT_CLASSES), (uint)_LIB_FLAGS.LF_GLOBAL,
            //	new[]
            //	{
            //		new VSOBSEARCHCRITERIA2()
            //		{
            //			eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //			szName = sStarts
            //		}
            //	}, out simpleList));

            //string sTmp;
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_BASETEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_CUSTOM, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_DEFAULT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_DISPLAYTEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_EXTENDED, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_PREFIX, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_PREFIX2, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_SEARCHTEXT, out sTmp);
            //Debug.Print(sTmp);
            //simpleList.GetTextWithOwnership(0, VSTREETEXTOPTIONS.TTO_SORTTEXT, out sTmp);
            //Debug.Print(sTmp);


            //Guid riid = typeof(IVsSimpleObjectList2).GUID;
            //IntPtr p;
            //Marshal.QueryInterface(Marshal.GetIUnknownForObject(listC), ref riid, out p);

            //simpleList = listC as IVsSimpleObjectList2;

            //simp

            //return new ObjectListDeclarations(simpleList);
        }         // func FidDeclarations
コード例 #12
0
        }         // proc InitComponent

        private void UpdateTypeList()
        {
            //	IVsObjectList2 _list;
            //	ErrorHandler.ThrowOnFailure(libraryScope.GetList2((uint)_LIB_LISTTYPE.LLT_CLASSES, (uint)_LIB_FLAGS.LF_GLOBAL,
            //		new[]
            //			{
            //				new VSOBSEARCHCRITERIA2()
            //				{
            //					eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
            //					szName = String.Empty
            //				}
            //			}, null, out _list));
            //	IVsCoTaskMemFreeMyStrings t = _list as IVsCoTaskMemFreeMyStrings;
            //	string s;
            //	_list.GetText(0, VSTREETEXTOPTIONS.TTO_DEFAULT, out s);
            //	Debug.Print(s);


            IVsSimpleObjectList2 simpleList;            // = _list as IVsSimpleObjectList2;

            ErrorHandler.ThrowOnFailure(library.GetList2((uint)_LIB_LISTTYPE.LLT_CLASSES, (uint)_LIB_FLAGS.LF_GLOBAL,
                                                         new[]
            {
                new VSOBSEARCHCRITERIA2()
                {
                    eSrchType = VSOBSEARCHTYPE.SO_ENTIREWORD,
                    szName    = String.Empty
                }
            }, out simpleList));

            uint dwCount;

            ErrorHandler.ThrowOnFailure(simpleList.GetItemCount(out dwCount));

            typeRoot = new TypeListItem(simpleList, TypeListItem.NamespaceIndex, String.Empty);

            for (uint i = 0; i < dwCount; i++)
            {
                // Ermittle den Namen
                string sNamespace;
                string sTypeName;
                ErrorHandler.ThrowOnFailure(simpleList.GetTextWithOwnership(i, VSTREETEXTOPTIONS.TTO_PREFIX2, out sNamespace));
                ErrorHandler.ThrowOnFailure(simpleList.GetTextWithOwnership(i, VSTREETEXTOPTIONS.TTO_DEFAULT, out sTypeName));

                // Hole die Attribute ab
                uint dwClassType;
                uint dwClassAccess;
                ErrorHandler.ThrowOnFailure(simpleList.GetCategoryField2(i, (int)LIB_CATEGORY.LC_CLASSTYPE, out dwClassType));
                ErrorHandler.ThrowOnFailure(simpleList.GetCategoryField2(i, (int)LIB_CATEGORY.LC_CLASSACCESS, out dwClassAccess));

                // Keine eigentlichen Typen und Namespaces
                if (((_LIBCAT_CLASSTYPE)dwClassType) == _LIBCAT_CLASSTYPE.LCCT_INTRINSIC ||
                    ((_LIBCAT_CLASSTYPE)dwClassType) == _LIBCAT_CLASSTYPE.LCCT_NSPC)
                {
                    continue;
                }

                // Nur öffentliche Methoden
                if ((dwClassAccess & (uint)_LIBCAT_CLASSACCESS.LCCA_PUBLIC) == 0)
                {
                    continue;
                }

                // Suche den Knoten
                typeRoot.FindNameSpace(0, sNamespace, true).Add(i, sTypeName);
            }

            iLastTypeUpdated = Environment.TickCount;
        }         // proc UpdateTypeList
コード例 #13
0
        private void BuildType(TypeListItem typeListItem, _VSOBJDESCOPTIONS options)
        {
            var compilation = GetCompilation();
            if (compilation == null)
            {
                return;
            }

            var symbol = typeListItem.ResolveTypedSymbol(compilation);
            if (symbol == null)
            {
                return;
            }

            if (symbol.TypeKind == TypeKind.Delegate)
            {
                BuildDelegateDeclaration(symbol, options);
            }
            else
            {
                BuildTypeDeclaration(symbol, options);
            }

            AddEndDeclaration();
            BuildMemberOf(symbol.ContainingNamespace, options);

            BuildXmlDocumentation(symbol, compilation, options);
        }
コード例 #14
0
 private void OnlistBoxItems_DrawItem(object sender, DrawItemEventArgs e)
 {
     if (e.Index != -1)
     {
         System.Type itemType = null;
         string      str      = null;
         bool        flag     = false;
         bool        flag2    = false;
         bool        flag3    = (e.State & DrawItemState.ComboBoxEdit) == DrawItemState.ComboBoxEdit;
         if (sender is ListBox)
         {
             ListBox   box       = sender as ListBox;
             Component component = box.Items[e.Index] as Component;
             if (component == null)
             {
                 return;
             }
             if (component is ToolStripItem)
             {
                 flag = true;
             }
             itemType = component.GetType();
             str      = (component.Site != null) ? component.Site.Name : itemType.Name;
         }
         else
         {
             if (!(sender is ComboBox))
             {
                 return;
             }
             flag2 = (e.Index == this.customItemIndex) && !flag3;
             TypeListItem item = ((ComboBox)sender).Items[e.Index] as TypeListItem;
             if (item == null)
             {
                 return;
             }
             itemType = item.Type;
             str      = item.ToString();
         }
         if (itemType != null)
         {
             Color empty = Color.Empty;
             if (flag2)
             {
                 e.Graphics.DrawLine(SystemPens.ControlDark, (int)(e.Bounds.X + 2), (int)(e.Bounds.Y + 2), (int)(e.Bounds.Right - 2), (int)(e.Bounds.Y + 2));
             }
             Rectangle bounds = e.Bounds;
             bounds.Size = new Size(0x10, 0x10);
             int x = flag3 ? 0 : 2;
             bounds.Offset(x, 1);
             if (flag2)
             {
                 bounds.Offset(0, 4);
             }
             if (flag)
             {
                 bounds.X += 20;
             }
             if (!flag3)
             {
                 bounds.Intersect(e.Bounds);
             }
             Bitmap toolboxBitmap = ToolStripDesignerUtils.GetToolboxBitmap(itemType);
             if (toolboxBitmap != null)
             {
                 if (flag3)
                 {
                     e.Graphics.DrawImage(toolboxBitmap, e.Bounds.X, e.Bounds.Y, 0x10, 0x10);
                 }
                 else
                 {
                     e.Graphics.FillRectangle(SystemBrushes.Window, bounds);
                     e.Graphics.DrawImage(toolboxBitmap, bounds);
                 }
             }
             Rectangle rectangle2 = e.Bounds;
             rectangle2.X = bounds.Right + 6;
             rectangle2.Y = bounds.Top - 1;
             if (!flag3)
             {
                 rectangle2.Y += 2;
             }
             rectangle2.Intersect(e.Bounds);
             Rectangle rect = e.Bounds;
             rect.X = rectangle2.X - 2;
             if (flag2)
             {
                 rect.Y      += 4;
                 rect.Height -= 4;
             }
             if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
             {
                 empty = SystemColors.HighlightText;
                 e.Graphics.FillRectangle(SystemBrushes.Highlight, rect);
             }
             else
             {
                 empty = SystemColors.WindowText;
                 e.Graphics.FillRectangle(SystemBrushes.Window, rect);
             }
             if (!string.IsNullOrEmpty(str))
             {
                 TextFormatFlags flags = TextFormatFlags.Default;
                 TextRenderer.DrawText(e.Graphics, str, this.Font, rectangle2, empty, flags);
             }
             if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
             {
                 rect.Width--;
                 ControlPaint.DrawFocusRectangle(e.Graphics, rect, e.ForeColor, e.BackColor);
             }
         }
     }
 }