I have a project with some classes. I wanted to change one's(classA) design so I created a new project in expression blend 4. I want to use this in order to do this I need to access that project from main project.
I have in that class:
class1 c = new class1();
c.pass = read.Value;
if (c.ShowDialog() == DialogResult.OK)
{
read.Close();
return c.status;
}
I tried this https://stackoverflow.com/a/3556586/2763129 but it doesn't work. Is it even possible?
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();
}
}
}
my wpf which I try to ipmlement
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;
}
}
}
}
edit : I tried adding this to mainwindow.xaml.cs
public void show()
{
Window.Show();
}
but it gives The type or namespace name 'MainWindow' could not be found (are you missing a using directive or an assembly reference?) .Visual Studio 2012\Projects\momolocker\momo\memoform.cs 14 7 Momo