Log In/Log On Dialog in Catel

162 Views Asked by At

How would you create a Login/Logon Dialog in Catel?

We currently make use of a Custom Splash screen with a Boot Class and a single BootTask to sleep until a successful login occurs or is cancelled.

Are there any other options?

EDIT

Here is some code of what we currently do:

App.xaml.cs:

protected override void OnStartup(StartupEventArgs e)
{
      base.OnStartup(e);

      new Boot().RunWithSplashScreen<LoginViewModel>();
}

Boot Class:

public class Boot : BootstrapperBase<MainMenuWindow>
    {
        private Session CurrentSession = Session.Instance;

        protected override void InitializeBootTasks(IList<ITask> bootTasks)
        {
            bootTasks.Add(new ActionTask("Awaiting Login", delegate
                {
                    while (/*not successfully logged in*/) Thread.Sleep(1000);

                    if (/*login cancelled*/)
                        App.Current.Dispatcher.Invoke((Action)(
                            delegate
                            {
                                App.Current.Shutdown();
                            }));
                }));

            base.InitializeBootTasks(bootTasks);
        }
    }
0

There are 0 best solutions below