如何从wfa访问表达式混合项目?

时间:2013-12-05 23:54:09

标签: c# expression-blend

我有一个带有一些课程的项目。我想改变一个(classA)设计,所以我在表达式混合4中创建了一个新项目。我想使用它来执行此操作我需要从主项目访问该项目。

我上课了:

       class1 c = new class1();
       c.pass = read.Value;
       if (c.ShowDialog() == DialogResult.OK)
      {
       read.Close();
       return c.status;
       }

我尝试了这个https://stackoverflow.com/a/3556586/2763129,但它不起作用。它甚至可能吗?

ClassA的

        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Text;
        using System.Windows.Forms;

     namespace momo
   {
       public partial class ClassA : Form
      {
          public string pass;
          public bool status;
          public ClassA()
       {
        status = false;
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        if (textBox1.Text.Equals(pass))
        {
            status = true;
            this.Close();
        }
        else
        {
            MessageBox.Show("Errör", MessageBoxButtons.OK, MessageBoxIcon.Error);
            status = false;
        }

    }

    private void button2_Click(object sender, EventArgs e)
    {
        this.Close();
    }
}

}

我尝试ipmlement的wpf

               using System;
              using System.Windows.Data;
       using System.Windows.Documents;
         using System.Windows.Input;
         using System.Windows.Media;
         using System.Windows.Media.Imaging;
         using System.Windows.Shapes;
         using System.Collections.Generic;
         using System.ComponentModel;
         using System.Data;
         using System.Text;
         using System.Windows;
         using System.Windows.Controls;
         //using System.Windows.Forms;

       namespace ZGNH
       {

public class ayat 
{
    //public checkpassword()
    //{
    //    status = false;
    //    this.InitializeComponent();
    //}

    public string pass;
    public bool status;


}

public partial class MainWindow : Window
{

    ayat saf = new ayat();

    string pass;
    bool status;

   //public string pass;
    //public bool status;
    public MainWindow()
    {
        //InitializeCo
        this.InitializeComponent();

       // saf.pass = pass;
        //saf.status = status;
        // Insert code required on object creation below this point.
    }

    private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
    {
        this.Close();
        //
    }

    private void Button1_Click(object sender, System.Windows.RoutedEventArgs e)
    {


        //pass="c";
        //password
        if (pboxxx.Password.Equals(pass))
        {
            status = true;
            //PasswordBox s =new PasswordBox();

            this.Close();
        }
        else
        {
            Window1 s = new Window1();
            s.ShowDialog();
            //MessageBox.Show("Errör", MessageBoxButtons.OK, MessageBoxIcon.Error);
            status = false;
        }


    }


}

}

编辑:我尝试将其添加到mainwindow.xaml.cs

        public void show()
     {
        Window.Show();
     }

但是它给出了类型或命名空间名称'MainWindow'找不到(你是否缺少using指令或程序集引用?)。Visual Studio 2012 \ Projects \ momolocker \ momo \ memoform.cs 14 7 Momo

0 个答案:

没有答案