コード例 #1
0
        private void LayoutRoot_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            var ctrlState = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control);

            if ((ctrlState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down)
            {
                // Check to see if any basic modals are open first
                if ((SettingsView != null && SettingsView.IsOpen) ||
                    (PrintPresenter != null && PrintPresenter.Child != null))
                {
                    return;
                }

                switch (e.Key)
                {
                case VirtualKey.C:
                    FontMap.TryCopy();
                    break;

                case VirtualKey.S:
                    if (FontMap.ViewModel.SelectedVariant is FontVariant v && FontMap.ViewModel.SelectedVariantAnalysis is CanvasTextLayoutAnalysis a)
                    {
                        ExportManager.RequestExportFontFile(v, a);
                    }
                    break;

                case VirtualKey.N:
                    if (ViewModel.SelectedFont is InstalledFont fnt)
                    {
                        _ = FontMapView.CreateNewViewForFontAsync(fnt);
                    }
                    break;

                case VirtualKey.P:
                    Messenger.Default.Send(new PrintRequestedMessage());
                    break;

                case VirtualKey.Delete:
                    if (ViewModel.SelectedFont is InstalledFont font && font.HasImportedFiles)
                    {
                        FlyoutHelper.RequestDelete(font);
                    }
                    break;
                }
            }
        }
コード例 #2
0
        private void LayoutRoot_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == VirtualKey.F11)
            {
                Utils.ToggleFullScreenMode();
            }

            var ctrlState = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control);

            if ((ctrlState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down)
            {
                // Check to see if any basic modals are open first
                if (AreModalsOpen())
                {
                    return;
                }

                if (!FontMap.HandleInput(e))
                {
                    switch (e.Key)
                    {
                    case VirtualKey.N:
                        if (ViewModel.SelectedFont is InstalledFont fnt)
                        {
                            _ = FontMapView.CreateNewViewForFontAsync(fnt);
                        }
                        break;

                    case VirtualKey.Delete:
                        if (ViewModel.SelectedFont is InstalledFont font && font.HasImportedFiles)
                        {
                            FlyoutHelper.RequestDelete(font);
                        }
                        break;

                    case VirtualKey.L:
                        TogglePane_Click(null, null);
                        break;
                    }
                }
            }
        }
コード例 #3
0
        private void LayoutRoot_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == VirtualKey.F11)
            {
                Utils.ToggleFullScreenMode();
            }

            var ctrlState = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Control);

            if ((ctrlState & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down)
            {
                // Check to see if any basic modals are open first
                if ((SettingsView != null && SettingsView.IsOpen) ||
                    (PrintPresenter != null && PrintPresenter.Child != null))
                {
                    return;
                }

                switch (e.Key)
                {
                case VirtualKey.C:
                    FontMap.TryCopy();
                    break;

                case VirtualKey.S:
                    if (FontMap.ViewModel.SelectedVariant is FontVariant v)
                    {
                        ExportManager.RequestExportFontFile(v);
                    }
                    break;

                case VirtualKey.N:
                    if (ViewModel.SelectedFont is InstalledFont fnt)
                    {
                        _ = FontMapView.CreateNewViewForFontAsync(fnt);
                    }
                    break;

                case VirtualKey.P:
                    Messenger.Send(new PrintRequestedMessage());
                    break;

                case VirtualKey.Delete:
                    if (ViewModel.SelectedFont is InstalledFont font && font.HasImportedFiles)
                    {
                        FlyoutHelper.RequestDelete(font);
                    }
                    break;

                case VirtualKey.Add:
                case (VirtualKey)187:
                    FontMap.ViewModel.IncreaseCharacterSize();
                    break;

                case VirtualKey.Subtract:
                case (VirtualKey)189:
                    FontMap.ViewModel.DecreaseCharacterSize();
                    break;

                case VirtualKey.L:
                    TogglePane_Click(null, null);
                    break;

                case VirtualKey.R:
                    ViewModel.Settings.EnablePreviewPane = !ViewModel.Settings.EnablePreviewPane;
                    break;

                case VirtualKey.B:
                    ViewModel.Settings.EnableCopyPane = !ViewModel.Settings.EnableCopyPane;
                    break;

                case VirtualKey.T:
                    FontMap.ViewModel.ChangeDisplayMode();
                    break;

                case VirtualKey.Q:
                    _ = QuickCompareView.CreateNewWindowAsync();
                    break;
                }
            }
        }