Beispiel #1
0
        protected async override void OnLaunched(LaunchActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }

            if (Window.Current.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter

                var setup = new Setup(rootFrame);
                setup.Initialize();

                await AskForADCredentialsAsync();

                Window.Current.Content = new Views.MainView(rootFrame, Mvx.Resolve <IMvxMessenger>());

                var start = Mvx.Resolve <Cirrious.MvvmCross.ViewModels.IMvxAppStart>();
                start.Start();

                ((MainViewModel)((Views.MainView)Window.Current.Content).DataContext).NavigateToHomeCommand.Execute();
            }
            // Ensure the current window is active
            Window.Current.Activate();
            PushNotifications.UploadChannel();
        }