棱镜多次组成同一模块

时间:2012-06-27 19:12:12

标签: vb.net silverlight prism

我正在开发一个包含多个模块的应用程序(用户,项目,付款,发票等)。这些模块中的每一个都引用了一个包含名为App.Controls的共享控件的公共模块。 App.Controls包含一个名为OKSaveDialogView的视图,它只是一个带有Ok / Save按钮和一些常用功能的shell视图。 OKSaveDialogView动态加载适当的内容以获得可恢复性。不幸的是,App.Controls部分被多次加载到目录中导致错误:

1)找到多个匹配约束的导出'((exportDefinition.ContractName ==" App.Controls.ViewModels.OkCancelDialogViewModel")

我不知道在哪里开始调试这是怎么回事。有人能指出我正确的方向吗?

以下是该项目的一些代码剪辑:

OKCaneclDialogView.Xaml.VB

<Export("OkCancelDialogView")> _
<PartCreationPolicy(CreationPolicy.NonShared)> _
Partial Public Class OkCancelDialogView
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    <Import()> _
    Public Property ViewModel() As OkCancelDialogViewModel
        Get
            Return Me.DataContext
        End Get
        Set(value As OkCancelDialogViewModel)
            Me.DataContext = value
        End Set
    End Property
End Class

OkCancelDialoViewModel.vb

<Export()> _
<PartCreationPolicy(CreationPolicy.NonShared)> _
Public Class OkCancelDialogViewModel
    Inherits ViewModelBase
    Implements INavigationAware
    Implements IPartImportsSatisfiedNotification
    'Implements IOkCancelDialogViewModel


    'Services
    'Private ReadOnly regionManager As IRegionManager
    Private WithEvents userService As IUserDataService

    Private navigationJournal As IRegionNavigationJournal

    Private Const UserIdKey As String = "PrimaryId"
    Private Const SecondaryIdKey As String = "SecondaryId"
    Private Const DialogContentKey As String = "DialogContent"

    'DialogViewModelDictionary
    Private DialogViewModelDictionary As DialogViewModelDictionaries

    Public Sub New()
        Me.New(New RegionManager)
    End Sub

    <ImportingConstructor()> _
    Public Sub New(regionManager As IRegionManager)
        'Setup the global region manager
        Me.RegionManager = regionManager

        'Setup the locally scoped region manager
        Me.LocalRegionManager = regionManager.CreateRegionManager

        Me.synchronizationContext = If(synchronizationContext.Current, New SynchronizationContext())

        'Setup commands
        Me._closeCommand = New DelegateCommand(AddressOf OnClose)

        Me._okSaveCommand = New DelegateCommand(AddressOf Me.OnOkSave, AddressOf Me.CanClickOkSave)
        Me._CancelCommand = New DelegateCommand(AddressOf Me.OnCancel, AddressOf Me.CanClickCancel)


        DialogViewModelDictionary = New DialogViewModelDictionaries
        DialogViewModelDictionary.AddDialogViewModel("EditAddressDialogView", New EditAddressDialogViewModel())
    End Sub

0 个答案:

没有答案
相关问题