Exemple #1
0
 /// <summary>
 /// Initiliase Cinch using the CinchBootStrapper.
 /// </summary>
 public App()
 {
     CinchBootStrapper.Initialise(new List <Assembly> {
         typeof(App).Assembly
     });
     InitializeComponent();
 }
        protected override void InitializeShell()
        {
            base.InitializeShell();

            CinchBootStrapper.Initialise(new[] { Assembly.GetExecutingAssembly() });

            Application.Current.MainWindow = (MainView)Shell;
            Application.Current.MainWindow.Show();
        }
Exemple #3
0
 /// <summary>
 /// Initiliase Cinch using the CinchBootStrapper.
 /// </summary>
 public App()
 {
     CinchBootStrapper.Initialise(new List <Assembly> {
         typeof(App).Assembly
     });
     messageBoxService = new Cinch.WPFMessageBoxService();
     this.Startup     += this.Application_Startup;
     this.Exit        += this.Application_Exit;
     InitializeComponent();
 }
Exemple #4
0
 protected override void OnStartup(StartupEventArgs e)
 {
     try
     {
         CinchBootStrapper.Initialise(new List <Assembly>
         {
             Assembly.GetAssembly(typeof(MainWindow))
         });
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
     base.OnStartup(e);
 }
Exemple #5
0
        /// <summary>
        /// Initiliase Cinch using the CinchBootStrapper.
        /// </summary>

        /*public App()
         * {
         *  CinchBootStrapper.Initialise(new List<Assembly> { typeof(App).Assembly });
         *  ObjectMappingHelper.Setup();
         *  PropertyInfoFactory.Factory = new PropertyInformationFactory();
         *  InitializeComponent();
         * }*/
        #endregion

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            CinchBootStrapper.Initialise(new List <Assembly> {
                typeof(App).Assembly
            });
            ObjectMappingHelper.Setup();
            PropertyInfoFactory.Factory = new PropertyInformationFactory();

            // Disable shutdown when the dialog closes
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var loginVM = new ViewModels.LoginViewModel(new WPFMessageBoxService(), new UserManager());
            var login   = new Views.LoginView();

            login.DataContext = loginVM;

            loginVM.CloseRequest += (sender, args) =>
            {
                try
                {
                    // Execute this statement, dialog will also be closed
                    login.DialogResult = args.Result;
                }
                catch (Exception)
                {
                    login.Close();
                }
            };

            // show login dialog, and check login result
            if (login.ShowDialog() == true)
            {
                Views.MainWindow main = new Views.MainWindow();
                //var context = new MainWindowViewModel(loginVm.CurrentUser);
                var context = new ViewModels.MainWindowViewModel(new Cinch.ViewAwareStatus(), new WPFMessageBoxService());
                main.DataContext = context;
                // Re-enable normal shutdown mode.
                Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
                Current.MainWindow   = main;
                main.Show();
            }
            else
            {
                // exit
                Current.Shutdown(-1);
            }
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            CinchBootStrapper.Initialise(new List <Assembly> {
                typeof(App).Assembly
            });

            ///////////////////////////////////////////////////////////////////
            /// parse parameters passed from ASP.NET
            ///
            ConfigurationSingleton.Instance.ParseInitParams(e.InitParams);

            /////////////////////////////////////////////////////
            /// ... before MainPage initialization
            ///

            MainPage mainPage = new MainPage();

            this.RootVisual = mainPage;
        }
Exemple #7
0
 protected override void OnStartup(StartupEventArgs e)
 {
     CinchBootStrapper.Initialise(new [] { Assembly.GetAssembly(typeof(App)) });
     base.OnStartup(e);
 }