交互式交互请求错误

时间:2016-02-15 09:47:07

标签: wpf mvvm prism

只想询问我遇到的错误。在引发interactionrequest时,首先程序根据我的代码运行,但如果我多次关闭交互请求,将发生以下错误

  

“类型'System.ComponentModel.Win32Exception'的未处理异常   发生在PresentationFramework.dll

中      

附加信息:操作成功完成

为了帮助您理解我的代码:

查看模型

 public class FinanceShellMainViewModel : BindableBase 
    {
     public InteractionRequest<LoginNotification> LoginFormShow { get; private set; }
     public DelegateCommand WindowLoaded { get; set; }

        public FinanceShellMainViewModel()
         {
             WindowLoaded = new DelegateCommand(SystemOnload);
             LoginFormShow = new InteractionRequest<LoginNotification>();
         }



      private void SystemOnload()
       {
           OpenAuthenticateUser();
       }



private void OpenAuthenticateUser()
       {
           LoginNotification Auth = new LoginNotification();

           Auth.Title = "Login Form";
           this.LoginFormShow.Raise(Auth, retval => 
           {
               if (retval != null &&  retval.IsLegit == true && retval.Confirmed)
               {

               }
               else 
               {
                   OpenAuthenticateUser();
               }

           });

       }

 }

加载模型视图后,将出现PopupWindowAction

查看

 <Window x:Class="FINNANCE_PROGRAM.Views.FinanceShellMain"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        Title="FinanceShellMain" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:intr="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True"
         Height="500" Width="800"
        xmlns:views="clr-namespace:FINNANCE_PROGRAM.Views.ViewNotifications">

    <intr:Interaction.Triggers>

        <intr:EventTrigger EventName="Loaded">
            <intr:InvokeCommandAction Command="{Binding WindowLoaded}"/>
        </intr:EventTrigger>

        <prism:InteractionRequestTrigger SourceObject="{Binding LoginFormShow, Mode=OneWay}">
            <prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
                <prism:PopupWindowAction.WindowContent>
                    <views:SystemLogin />
                </prism:PopupWindowAction.WindowContent>
            </prism:PopupWindowAction>
        </prism:InteractionRequestTrigger>



     </intr:Interaction.Triggers>

 </Window>

LoginNotification

  public class LoginNotification : Confirmation
    {
      public LoginNotification()
      {
          IsLegit = false;
      }
        public bool IsLegit { get; set; }
    }

我非常需要你的帮助。 任何建议都非常感谢。

堆栈跟踪

  

WindowsBase.dll!MS.Win32.UnsafeNativeMethods.CreateWindowEx(int dwExStyle = {unknown},string lpszClassName = {unknown},string lpszWindowName = {unknown},int style = {unknown},int x = {unknown}, int y = {unknown},int width = {unknown},int height = {unknown},System.Runtime.InteropServices.HandleRef hWndParent = {unknown},System.Runtime.InteropServices.HandleRef hMenu = {unknown},System.Runtime .InteropServices.HandleRef hInst = {unknown},object pvParam = {unknown})C#
      WindowsBase.dll!MS.Win32.HwndWrapper..ctor(int classStyle = {unknown},int style = {unknown},int exStyle = {unknown},int x = {unknown},int y = {unknown},int width = {unknown},int height = {unknown},string name = {unknown},System.IntPtr parent = {unknown},MS.Win32.HwndWrapperHook [] hooks = {unknown})C#
      PresentationCore.dll!System.Windows.Interop.HwndSource.Initialize(System.Windows.Interop.HwndSourceParameters parameters = {unknown})C#       PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow = {unknown})C#       PresentationFramework.dll!System.Windows.Window.CreateSourceWindowDuringShow()C#
      PresentationFramework.dll!System.Windows.Window.SafeCreateWindowDuringShow()C#
      PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox = {unknown})C#
      PresentationFramework.dll!System.Windows.Window.Show()C#
      PresentationFramework.dll!System.Windows.Window.ShowDialog()C#       Prism.Wpf.dll!Prism.Interactivity.PopupWindowAction.Invoke(object parameter = {unknown})C#
      System.Windows.Interactivity.dll!System.Windows.Interactivity.TriggerBase.InvokeActions(object parameter = {unknown})C#
      System.Windows.Interactivity.dll!System.Windows.Interactivity.EventTriggerBase.OnEvent(System.EventArgs eventArgs = {unknown})C#
      System.Windows.Interactivity.dll!System.Windows.Interactivity.EventTriggerBase.OnEventImpl(object sender = {unknown},System.EventArgs eventArgs = {unknown})C#       Prism.Wpf.dll!Prism.Interactivity.InteractionRequest.InteractionRequest`1.Raise(T context = {unknown},System.Action callback = {unknown})C#

0 个答案:

没有答案