Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Mon, 05 Mar 2007 13:51:11 +0100,    group: microsoft.public.vstudio.extensibility        back       


my Visual Studio install refuse to load any addins   
Hello,

my Visual Studio install refuse to load any addins, nothing shows up in the addin manager. I tried wizard created addins and some I found in the internet. Apart from reinstalling Visual Studio is there anything I can try? I think I've used addins before so it got broke somehow.

Normally I prefer macros but it's problematic with the design time because the macro IDE runs in another process, what I want to do is adding a DesignerActionList (the smart tag thingy) to any control after the designer host has loaded a form or control. Maybe anybody with deep knowledge about extensibility, automation, design time, AppDomain etc. can give me some hints, my knowledge about all this is only sketchy. My macro code where I'm stuck looks like this:

Sub WindowEvents_WindowCreated(ByVal Window As EnvDTE.Window) Handles WindowEvents.WindowCreated
     MsgBox(1)
     Dim h As IDesignerHost = Window.Object
     Dim s As IServiceProvider = h.GetService(GetType(IServiceProvider))
     MsgBox(2)
End Sub

the second message box isn't displayed so it terminates silently

My current why to setup my DesignerActionLists is putting a custom control on my form which overrides OnParentChanged to iterate then over all controls to retrieve the designer of the control to add the DesignerActionList to the designer. What I don't like about that approach is I have to put a dummy control on every form only to get my design time code running.

Some things I don't understand, when I override the Text property of a form, it doesn't ever get called when the designer host loads the form.

thx
stax

Public Class DesignModeDummyControl
     Inherits Label

     'when the designer puts this control on a form a init method is called
     Protected Overrides Sub OnParentChanged(ByVal e As EventArgs)
         MyBase.OnParentChanged(e)
         InitSmartTags()
     End Sub

     Private DesignerActionUIService As DesignerActionUIService

     'the init method puts a the DesignerActionLists on all controls
     'and creates a event handler to add the the lists if new controls are added to the form
     Public Sub InitSmartTags()
         Dim s As IComponentChangeService = DirectCast(GetService(GetType(IComponentChangeService)), IComponentChangeService)

         If Not s Is Nothing Then
             AddHandler s.ComponentAdded, AddressOf OnComponentAdded
             AddLists(Me)
         End If
     End Sub

     Private Sub OnComponentAdded(ByVal sender As Object, ByVal e As ComponentEventArgs)
         AddLists(e.Component)
     End Sub

     'check if the list was already added to the designer
     Private Function ContainsList(ByVal designer As ControlDesigner, ByVal type As Type) As Boolean
         For Each i As DesignerActionList In designer.ActionLists
             If i.GetType Is type Then
                 Return True
             End If
         Next
     End Function

     'add the lists to the designer
     Private Sub AddLists(ByVal c As IComponent)
         Dim host As IDesignerHost = DirectCast(c.Site.GetService(GetType(IDesignerHost)), IDesignerHost)

         If TypeOf host.RootComponent Is Form Then
             Dim cd As ControlDesigner = DirectCast(host.GetDesigner(host.RootComponent), ControlDesigner)

             If Not ContainsList(cd, GetType(FormActionList)) Then
                 cd.ActionLists.Add(New FormActionList(host.RootComponent))
             End If
         End If

         For Each i As Component In host.RootComponent.Site.Container.Components
             If TypeOf i Is Control Then
                 If TypeOf host.GetDesigner(i) Is ControlDesigner Then
                     Dim cd As ControlDesigner = DirectCast(host.GetDesigner(i), ControlDesigner)

                     If TypeOf i Is TextBox OrElse TypeOf i Is Label OrElse _
                         TypeOf i Is ComboBox OrElse TypeOf i Is CheckBox OrElse _
                         TypeOf i Is GroupBox Then

                         If Not ContainsList(cd, GetType(CommonActionList)) Then
                             cd.ActionLists.Clear()
                             cd.ActionLists.Add(New CommonActionList(i))
                         End If
                     End If
                 End If
             End If
         Next
     End Sub
End Class

Public Class CommonActionList
         Inherits DesignerActionList

         Private Items As New DesignerActionItemCollection()
         Private DesignerActionService As DesignerActionService

         Public Sub New(ByVal component As IComponent)
             MyBase.New(component)
             DesignerActionService = DirectCast(GetService(GetType(DesignerActionService)), DesignerActionService)
         End Sub

         Protected Function FixControlName(ByVal value As String) As String
             Dim ret As String = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value)

             For Each i As Char In value
                 If Not Char.IsLetterOrDigit(i) Then
                     ret = ret.Replace(i, "")
                 End If
             Next

             Return ret
         End Function

         Protected Sub RefreshComponent()
             DirectCast(GetService(GetType(DesignerActionUIService)), DesignerActionUIService).Refresh(Component)
         End Sub

         Public Sub SetValue(ByVal propertyName As String, ByVal value As Object)
             Dim pd As PropertyDescriptor = TypeDescriptor.GetProperties(Component)(propertyName)
             pd.SetValue(Component, value)
         End Sub

         Public Function GetValue(Of T)(ByVal propertyName As String) As T
             Dim pd As PropertyDescriptor = TypeDescriptor.GetProperties(Component)(propertyName)
             Return DirectCast(pd.GetValue(Component), T)
         End Function

         Private Function GetPrefix() As String
             Dim ret As String = ""

             For Each i As Char In GetComponent.GetType.Name
                 If Char.IsUpper(i) Then
                     ret += i
                 End If
             Next

             Return ret.ToLower
         End Function

         Private Function GetComponent() As Component
             Return DirectCast(Component, Component)
         End Function

         Public Property Text() As String
             Get
                 Return GetValue(Of String)("Text")
             End Get
             Set(ByVal Value As String)
                 SetValue("Text", Value)
                 SetValue("Name", GetPrefix() + FixControlName(Value))
                 RefreshComponent()
             End Set
         End Property

         Public Property Name() As String
             Get
                 Return GetValue(Of String)("Name")
             End Get
             Set(ByVal value As String)
                 SetValue("Name", value)
             End Set
         End Property

         Public Property Multiline() As Boolean
             Get
                 Return GetValue(Of Boolean)("Multiline")
             End Get
             Set(ByVal value As Boolean)
                 SetValue("Multiline", value)
             End Set
         End Property

         Public Property Anchor() As AnchorStyles
             Get
                 Return GetValue(Of AnchorStyles)("Anchor")
             End Get
             Set(ByVal Value As AnchorStyles)
                 SetValue("Anchor", Value)
             End Set
         End Property

         Public Property TextAlign() As ContentAlignment
             Get
                 Return GetValue(Of ContentAlignment)("TextAlign")
             End Get
             Set(ByVal Value As ContentAlignment)
                 SetValue("TextAlign", Value)
             End Set
         End Property

         Public Property AutoSize() As Boolean
             Get
                 Return GetValue(Of Boolean)("AutoSize")
             End Get
             Set(ByVal Value As Boolean)
                 SetValue("AutoSize", Value)
             End Set
         End Property

         Public Property DropDownStyle() As ComboBoxStyle
             Get
                 Return GetValue(Of ComboBoxStyle)("DropDownStyle")
             End Get
             Set(ByVal value As ComboBoxStyle)
                 SetValue("DropDownStyle", value)
             End Set
         End Property

         Public Sub AddPropertyItem(ByVal name As String, ByVal ParamArray t As Type())
             For Each i As Type In t

                 If GetComponent.GetType Is i OrElse _
                     GetComponent.GetType.IsSubclassOf(i) Then

                     Items.Add(New DesignerActionPropertyItem(name, name))
                 End If
             Next
         End Sub

         Public Overrides Function GetSortedActionItems() As DesignerActionItemCollection
             items.Clear()

             AddPropertyItem("Text", _
                 GetType(TextBox), _
                 GetType(GroupBox), _
                 GetType(Label), _
                 GetType(CheckBox))

             AddPropertyItem("Name", GetType(Control))
             AddPropertyItem("TextAlign", GetType(Label))
             AddPropertyItem("AutoSize", GetType(Label))
             AddPropertyItem("Multiline", GetType(TextBox))
             AddPropertyItem("DropDownStyle", GetType(ComboBox))
             AddPropertyItem("Anchor", GetType(Control))

             Return items
         End Function
     End Class
date: Mon, 05 Mar 2007 13:51:11 +0100   author:   stax

Re: my Visual Studio install refuse to load any addins   
the solution was to instal MSXML6

stax wrote:
> Hello,
> 
> my Visual Studio install refuse to load any addins, nothing shows up in 
> the addin manager. I tried wizard created addins and some I found in the 
> internet. Apart from reinstalling Visual Studio is there anything I can 
> try? I think I've used addins before so it got broke somehow.
date: Thu, 08 Mar 2007 12:21:11 +0100   author:   stax

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us