I am having problems getting my application to work switching between the login window and the application window
When it was a windows form app, all worked fine..
WinForm Program Class
Now that I have ported it to WPF...
It keeps erroring every time the login window is closed with..
How do I refactor the code correctly for WPF?
Thanks
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
When it was a windows form app, all worked fine..
WinForm Program Class
Code:
static class Program
{
// add the user to the system.
public static HLPUser HLP_User = new HLPUser("Financial_Promotions");
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// check if logged in, else make user login
if(! HLP_User.Is_Logged)
{
Application.Run(new Login(HLP_User));
if (HLP_User.Is_Logged)
{
Application.Run(new Financial_Promotions());
}
}
else
{
Application.Run(new Financial_Promotions());
}
// logout user
HLP_User.LogoutUser();
}
}
Now that I have ported it to WPF...
Code:
public partial class App : Application
{
// add the user to the system.
public static HLPUser HLP_User = new HLPUser("Financial_Promotions");
[STAThread]
static void Main()
{
Application app = new App();
// check if logged in, else make user login
if (!HLP_User.Is_Logged)
{
app.Run(new Login(HLP_User));
if (HLP_User.Is_Logged)
{
app.Run(new Financial_Promotions());
}
}
else
{
app.Run(new Financial_Promotions());
}
// logout user
HLP_User.LogoutUser();
}
}
This is being flagged up in the Financial_Promotions Window class contructor at the point of initialisation (highlighted below).'System.InvalidOperationException' {"The Application object is being shut down."}
Code:
public Financial_Promotions()
{
[highlight #FCE94F]InitializeComponent();[/highlight]
}
Thanks
1DMF
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music