private void ActiveTracing_Checked(object sender, RoutedEventArgs e) { if (!m_cursorShadowInitialized) { this.FindName("TraceCanvas"); // add shadow to the trace pointer AddTracePointerShadow(); // hide the shadow in high contrast mode CursorShadow.Visibility = m_accessibilitySettings.HighContrast ? Visibility.Collapsed : Visibility.Visible; Canvas.SetLeft(TracePointer, TraceCanvas.ActualWidth / 2 + 40); Canvas.SetTop(TracePointer, TraceCanvas.ActualHeight / 2 - 40); m_cursorShadowInitialized = true; } _ = FocusManager.TryFocusAsync(GraphingControl, FocusState.Programmatic); Window.Current.CoreWindow.KeyUp += ActiveTracing_KeyUp; KeyboardShortcutManager.IgnoreEscape(false); TracePointer.Visibility = Visibility.Visible; CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingChecked, GraphButtonValue.None); }
internal static void Initialize() { var coreWindow = Window.Current.CoreWindow; coreWindow.CharacterReceived += OnCharacterReceivedHandler; coreWindow.KeyDown += OnKeyDownHandler; coreWindow.Dispatcher.AcceleratorKeyActivated += OnAcceleratorKeyActivated; KeyboardShortcutManager.RegisterNewAppViewId(); }
private void ActiveTracing_Unchecked(object sender, RoutedEventArgs e) { ActiveTracing.PointerCaptureLost -= ActiveTracing_PointerCaptureLost; Window.Current.CoreWindow.KeyUp -= ActiveTracing_KeyUp; KeyboardShortcutManager.HonorEscape(); TracePointer.Visibility = Visibility.Collapsed; CalculatorApp.ViewModel.Common.TraceLogger.GetInstance().LogGraphButtonClicked(GraphButton.ActiveTracingUnchecked, GraphButtonValue.None); }
public FViewer(ChangeTracker changeTracker, IOperationFactory operationFactory, WinFormsExportHelper exportHelper, AppConfigManager appConfigManager, ScannedImageRenderer scannedImageRenderer, KeyboardShortcutManager ksm, UserConfigManager userConfigManager) { this.changeTracker = changeTracker; this.operationFactory = operationFactory; this.exportHelper = exportHelper; this.appConfigManager = appConfigManager; this.scannedImageRenderer = scannedImageRenderer; this.ksm = ksm; this.userConfigManager = userConfigManager; InitializeComponent(); }
public MainPage() { m_model = new ViewModel.ApplicationViewModel(); InitializeComponent(); KeyboardShortcutManager.Initialize(); Application.Current.Suspending += App_Suspending; m_model.PropertyChanged += OnAppPropertyChanged; m_accessibilitySettings = new AccessibilitySettings(); if (Utilities.GetIntegratedDisplaySize(out var sizeInInches)) { if (sizeInInches < 7.0) // If device's display size (diagonal length) is less than 7 inches then keep the calc always in Portrait mode only { DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped; } } }
public Task HandleViewRelease() { TaskCompletionSource <object> tsource = new TaskCompletionSource <object>(); _ = m_coreDispatcher.RunAsync(CoreDispatcherPriority.Low, new DispatchedHandler(() => { KeyboardShortcutManager.OnWindowClosed(this.m_viewId); Window.Current.Content = null; this.InvokeWindowClosingHandlers(); // This is to ensure InvokeWindowClosingHandlers is be done before RemoveWindowFromMap // If InvokeWindowClosingHandlers throws any exception we want it to crash the application // so we are OK not setting closingHandlersCompletedEvent in that case tsource.SetResult(new object()); this.m_coreDispatcher.StopProcessEvents(); Window.Current.Close(); })); return(tsource.Task); }
public override async Task <IWorkbook> ConfigureAsync(Frame rootFrame) { if (rootFrame == null) { throw new ArgumentNullException(nameof(rootFrame)); } bool sendAnalytics = WinSettings.Instance.GetValue <bool>(CoreSettings.SendAnalytics); string deviceId = "n/a"; try { var settings = WinSettings.Instance; if (!settings.HasValue(CoreSettings.DeviceId) || settings.GetValue <string>(CoreSettings.DeviceId) == "N/A") { string id = this.ComputeDeviceId(); settings.SetValue(CoreSettings.DeviceId, id); } deviceId = settings.GetValue <string>(CoreSettings.DeviceId); } catch (Exception ex) { TrackingManagerHelper.Exception(ex, "Error while setting device id"); } var platformService = new PlatformService(this.version, deviceId, () => CrashHandler.GetDiagnosticsInformation()); Ioc.RegisterInstance <IPlatformService, PlatformService>(platformService); TrackingManager trackingManager = new TrackingManager(sendAnalytics, platformService.DeviceFamily); Ioc.RegisterInstance <ITrackingManager, TrackingManager>(trackingManager); HttpClientHandler.Setup(); ResourcesLocator.Initialize("ms-appx://", UriKind.Absolute); if (!WinSettings.Instance.GetValue <bool>(CoreSettings.UseDarkTheme)) { ResourcesLocator.UpdateTheme(true); } var persistence = Ioc.RegisterInstance <IPersistenceLayer, WinPersistenceLayer>(new WinPersistenceLayer(automaticSave: true)); LogService.Log("Bootstraper", string.Format("Version: {0}", ApplicationVersion.GetAppVersion())); var navigationService = new NavigationService(rootFrame, platformService); Ioc.RegisterInstance <INavigationService, NavigationService>(navigationService); var messageBoxService = new MessageBoxService(navigationService); Ioc.RegisterInstance <IMessageBoxService, MessageBoxService>(messageBoxService); Ioc.RegisterInstance <ISpeechService, SpeechService>(new SpeechService(messageBoxService)); var workbook = this.InitializeWorkbook(persistence, platformService); // we just read the latest value of data from the DB, so even if there was a background sync // we now have the latest version, so we remove the background sync flag here workbook.Settings.SetValue(CoreSettings.SyncBackgroundOccured, false); this.keyboardShortcutManager = new KeyboardShortcutManager(workbook, rootFrame, navigationService, trackingManager); var backgroundTaskManager = new BackgroundTaskManager(workbook); backgroundTaskManager.InitializeAsync(); Ioc.RegisterInstance <IBackgroundTaskManager, BackgroundTaskManager>(backgroundTaskManager); var notificationService = new NotificationService(); Ioc.RegisterInstance <INotificationService, NotificationService>(notificationService); var startupManager = Ioc.Build <StartupManager>(); Ioc.RegisterInstance <IStartupManager, StartupManager>(startupManager); Ioc.RegisterInstance <IAlarmManager, AlarmManager>(new AlarmManager(workbook)); var tileManager = new TileManager(workbook, trackingManager, notificationService, false); tileManager.LoadSecondaryTilesAsync(); Ioc.RegisterInstance <ITileManager, TileManager>(tileManager); var synchronizationManager = await InitializeSyncAsync(workbook, platformService, trackingManager); // it is important to remove old task after sync is initialized otherwise changes would not // tracked and put in the changelog for the next sync workbook.RemoveOldTasks(); var cortanaService = new CortanaRuntimeService(workbook); // no need to await this call because it can runs in the background Task.Run(() => { JumpListManager.SetupJumpListAsync(); cortanaService.SetupDefinitionsAsync(); }); Ioc.RegisterInstance <ICortanaRuntimeService, CortanaRuntimeService>(cortanaService); return(workbook); }
private void Start() { graphManager = FindObjectOfType <GraphManager>(); shortcutManager = FindObjectOfType <KeyboardShortcutManager>(); }
private void UpdateDropDownState(object sender, object e) { ((UnitConverterViewModel)this.DataContext).IsDropDownOpen = (Units1.IsDropDownOpen) || (Units2.IsDropDownOpen); KeyboardShortcutManager.UpdateDropDownState((Units1.IsDropDownOpen) || (Units2.IsDropDownOpen)); }