コード例 #1
0
ファイル: Page.xaml.cs プロジェクト: RobRobertsCE/MVVM
        private void btnAuthorizationC_Click(object sender, RoutedEventArgs e)
        {
            txtAuthorizationC.Text = String.Empty;

            SLPrincipal.Logout();
            SLPrincipal.Login("PropertyARole", (o, e2) =>
            {
                bool pass = true;

                try
                {
                    try
                    {
                        ClassC1 classC1 = new ClassC1();
                        pass            = false;
                    }
                    catch (SecurityException ex)
                    { }

                    ClassC2 classC2 = new ClassC2();
                    classC2.A       = "test";
                    classC2.B       = "test";
                    if (classC2.A != "test" || classC2.B != "test")
                    {
                        pass = false;
                    }
                }
                catch (Exception ex)
                {
                    pass = false;
                }

                if (pass)
                {
                    txtAuthorizationC.Text = "Pass";
                }
                else
                {
                    txtAuthorizationC.Text = "Fail";
                }
            });
        }
コード例 #2
0
ファイル: Page.xaml.cs プロジェクト: nschonni/csla-svn
    private void btnAuthorizationC_Click(object sender, RoutedEventArgs e)
    {
      txtAuthorizationC.Text = String.Empty;

      SLPrincipal.Logout();
      SLPrincipal.Login("PropertyARole", (o, e2) =>
      {
        bool pass = true;

        try
        {
          try
          {
            ClassC1 classC1 = new ClassC1();
            pass = false;
          }
          catch (SecurityException ex)
          { }

          ClassC2 classC2 = new ClassC2();
          classC2.A = "test";
          classC2.B = "test";
          if (classC2.A != "test" || classC2.B != "test")
            pass = false;
        }
        catch (Exception ex)
        {
          pass = false;
        }

        if (pass)
        {
          txtAuthorizationC.Text = "Pass";
        }
        else
        {
          txtAuthorizationC.Text = "Fail";
        }
      });
    }