Beispiel #1
0
        private async Task InitAsync(SplashScreen splash)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            var appShell = AppShell.GetForCurrentView();

            if (appShell == null)
            {
                //create app shell to hold app content
                appShell = AppShell.CreateForWindow(Window.Current);

                //create extended splash screen
                ExtendedSplashScreen extendedSplash = new ExtendedSplashScreen(splash, false);
                //temporarily place splash into the root frame
                appShell.UnderlyingFrame.Content = extendedSplash;

                SetupWindowServices(Window.Current);
                await InitializeMvvmCrossAsync();

                //setup the title bar
                await SetupTitleBarAsync();

                InitializeStyle();
            }
            CoreApplication.EnablePrelaunch(true);
            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #2
0
        /// <summary>
        /// Sets up the application title bar design
        /// </summary>
        private async Task SetupTitleBarAsync()
        {
            //setup the custom title bar in app shell
            AppShell.GetForCurrentView().SetupCustomTitleBar();

            await SetupStatusBarAsync();
        }
Beispiel #3
0
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            OptimizeDisplay();
            if (AppShell.GetForCurrentView() == null)
            {
                await InitAsync(args.SplashScreen);
            }
            var file = args.Files.OfType <StorageFile>().FirstOrDefault();

            if (file != null)
            {
                var basicProperties = await file.GetBasicPropertiesAsync();

                var contents = await FileIO.ReadTextAsync(file);

                var fileInfo = new FileContentInfo(file.Name, basicProperties.Size, basicProperties.DateModified, contents);
                Mvx.RegisterSingleton(new LibraryViewModel.NavigationModel()
                {
                    SgfFileInfo = fileInfo
                });
                AppShell.GetForCurrentView().TabManager.ProcessViewModelRequest(
                    new MvxViewModelRequest(typeof(LibraryViewModel), new MvxBundle(), new MvxBundle(),
                                            MvxRequestedBy.UserAction), TabNavigationType.NewForegroundTab);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Invoked when the application is launched normally by the end user.  Other entry points
 /// will be used such as when the application is launched to open a specific file.
 /// </summary>
 /// <param name="e">Details about the launch request and process.</param>
 protected override async void OnLaunched(LaunchActivatedEventArgs e)
 {
     OptimizeDisplay();
     if (AppShell.GetForCurrentView() == null)
     {
         await InitAsync(e.SplashScreen);
     }
 }
Beispiel #5
0
        /// <summary>
        /// Updates visual settings bindings
        /// </summary>
        public void Refresh()
        {
            _backgroundColor = AppShell.GetForCurrentView().BackgroundColor;
            RaisePropertyChanged(() => BackgroundColor);

            _backgroundColorBrush = null;
            RaisePropertyChanged(() => BackgroundColorBrush);
            _elementTheme = AppShell.GetForCurrentView().AppTheme;
            RaisePropertyChanged(() => ElementTheme);
        }
Beispiel #6
0
 /// <summary>
 /// Checks and handles cheat keyboard combinations
 /// </summary>
 /// <param name="sender">Core dispatcher</param>
 /// <param name="args">Accelerator key event args</param>
 private static void CheckForCheatKeys(CoreDispatcher sender, AcceleratorKeyEventArgs args)
 {
     // activate cheat mode -- disabling is not needed, cheats are used in short
     // debug sessions anyway
     if (args.VirtualKey == Windows.System.VirtualKey.C && args.KeyStatus.IsMenuKeyDown)
     {
         if (!Cheats.PermitCheats)
         {
             AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("Cheats are now enabled.", "Do you dare to cheat?"));
         }
         Cheats.PermitCheats = true;
         args.Handled        = true;
     }
     //handle cheat key combinations
     if (Cheats.PermitCheats)
     {
         Cheats.HandleKeyPress(args);
     }
 }
Beispiel #7
0
        private async Task InitializeMvvmCrossAsync()
        {
            var shell = AppShell.GetForCurrentView();

            if (shell == null)
            {
                throw new NullReferenceException("Shell is not initialized");
            }
            var setup = new Setup(shell);

            setup.Initialize();

            //hide splash screen
            shell.UnderlyingFrame.Content = null;
            var start = Mvx.Resolve <IAsyncAppStart>();
            await start.StartAsync();

            OnlineStartup.Startup();
        }
Beispiel #8
0
        public static void HandleKeyPress(AcceleratorKeyEventArgs keyPressEventArgs)
        {
            if (keyPressEventArgs.EventType != CoreAcceleratorKeyEventType.KeyDown)
            {
                return;
            }
            switch (keyPressEventArgs.VirtualKey)
            {
            case VirtualKey.F1:
                Cheats.GameSettings.Quests.Points = 20;
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: Points set to 20.", "Cheat activated"));
                break;

            case VirtualKey.F2:
                Cheats.GameSettings.Quests.LastQuestReceivedWhen  = DateTime.Today.GetNoon().GetPreviousDay();
                Cheats.GameSettings.Quests.LastQuestExchangedWhen = DateTime.Today.GetNoon().GetPreviousDay();

                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: Cooldowns refreshed to 1 day.", "Cheat activated"));
                break;

            case VirtualKey.F3:
                Cheats.GameSettings.Quests.ClearAllQuests();
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: All quests cleared.", "Cheat activated"));
                break;

            case VirtualKey.F4:
                QuestManager.AddPoints(100);
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: +100 points", "Cheat activated"));
                break;

            default:
                //not handled, just return
                return;
            }
            //handle the key press
            keyPressEventArgs.Handled = true;
        }
Beispiel #9
0
 public void TriggerNotification(BubbleNotification notification)
 {
     AppShell.GetForCurrentView().TriggerBubbleNotification(notification);
 }
 private void EasterEggButton_OnClick(object sender, RoutedEventArgs e)
 {
     AppShell.GetForCurrentView().ToggleEasterEgg();
 }
Beispiel #11
0
 /// <summary>
 /// Closes this tab using tab manager
 /// </summary>
 private void Close()
 {
     AppShell.GetForCurrentView().TabManager.CloseTab(this);
 }
Beispiel #12
0
 /// <summary>
 /// Goes back in the tab
 /// </summary>
 private void GoBack()
 {
     AppShell.GetForCurrentView().TabManager.HandleBackNavigation(CurrentViewModel);
 }
Beispiel #13
0
 /// <summary>
 /// Retrieves the tab manager for current view
 /// </summary>
 /// <returns>Tab manager</returns>
 private TabManager GetTabManager() => AppShell.GetForCurrentView().TabManager;