public override Task OnInitializeAsync(IActivatedEventArgs args) { //Locator.Configure(); //UnigramContainer.Current.ResolveType<IGenerationService>(); var passcode = UnigramContainer.Current.Resolve <IPasscodeService>(); if (passcode != null && passcode.IsEnabled) { passcode.Lock(); InactivityHelper.Initialize(passcode.AutolockTimeout); } if (Window.Current != null) { Execute.Initialize(); Window.Current.Activated -= Window_Activated; Window.Current.Activated += Window_Activated; Window.Current.VisibilityChanged -= Window_VisibilityChanged; Window.Current.VisibilityChanged += Window_VisibilityChanged; WindowContext.GetForCurrentView().UpdateTitleBar(); ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 500)); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; Theme.Current.Update(); NotifyThemeChanged(); } return(base.OnInitializeAsync(args)); }
private async void Enabled_Toggled(object sender, RoutedEventArgs e) { if (Enabled.FocusState == FocusState.Unfocused) { return; } if (ViewModel.Passcode.IsEnabled) { ViewModel.Passcode.Reset(); } else if (Enabled.IsOn) { var timeout = ViewModel.Passcode.AutolockTimeout + 0; var dialog = new SettingsSecurityPasscodeEditView(); var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var passcode = dialog.Passcode; ViewModel.Passcode.Set(passcode, true, timeout); InactivityHelper.Initialize(timeout); } else { Enabled.IsOn = false; } } }
/////// <summary> /////// Initializes the app service on the host process /////// </summary> ////protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args) ////{ //// base.OnBackgroundActivated(args); //// if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails) //// { //// appServiceDeferral = args.TaskInstance.GetDeferral(); //// AppServiceTriggerDetails details = args.TaskInstance.TriggerDetails as AppServiceTriggerDetails; //// Connection = details.AppServiceConnection; //// } //// else if (args.TaskInstance.TriggerDetails is RawNotification) //// { //// var task = new NotificationTask(); //// task.Run(args.TaskInstance); //// } //// else if (args.TaskInstance.TriggerDetails is ToastNotificationActionTriggerDetail) //// { //// // TODO: upgrade the task to take advanges from in-process execution. //// var task = new InteractiveTask(); //// task.Run(args.TaskInstance); //// } ////} public override Task OnInitializeAsync(IActivatedEventArgs args) { //Locator.Configure(); //UnigramContainer.Current.ResolveType<IGenerationService>(); var passcode = TLContainer.Current.Resolve <IPasscodeService>(); if (passcode != null && passcode.IsEnabled) { passcode.Lock(); InactivityHelper.Initialize(passcode.AutolockTimeout); } if (Window.Current != null) { Execute.Initialize(); Window.Current.Activated -= Window_Activated; Window.Current.Activated += Window_Activated; Window.Current.VisibilityChanged -= Window_VisibilityChanged; Window.Current.VisibilityChanged += Window_VisibilityChanged; TLWindowContext.GetForCurrentView().UpdateTitleBar(); Theme.Current.Update(); //NotifyThemeChanged(); } return(base.OnInitializeAsync(args)); }
private async void AutolockExecute() { var timeout = AutolockTimeout + 0; var items = new[] { new SelectRadioItem(0, Locale.FormatAutoLock(0), timeout == 0), new SelectRadioItem(1 * 60, Locale.FormatAutoLock(1 * 60), timeout == 1 * 60), new SelectRadioItem(5 * 60, Locale.FormatAutoLock(5 * 60), timeout == 5 * 60), new SelectRadioItem(1 * 60 * 60, Locale.FormatAutoLock(1 * 60 * 60), timeout == 1 * 60 * 60), new SelectRadioItem(5 * 60 * 60, Locale.FormatAutoLock(5 * 60 * 60), timeout == 5 * 60 * 60) }; var dialog = new SelectRadioPopup(items); dialog.Title = Strings.Resources.AutoLock; dialog.PrimaryButtonText = Strings.Resources.OK; dialog.SecondaryButtonText = Strings.Resources.Cancel; var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary && dialog.SelectedIndex is int mode) { AutolockTimeout = mode; InactivityHelper.Initialize(mode); } }
private async void Edit_Click(object sender, RoutedEventArgs e) { var timeout = ViewModel.Passcode.AutolockTimeout + 0; var dialog = new SettingsSecurityPasscodeEditView(); var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var passcode = dialog.Passcode; ViewModel.Passcode.Set(passcode, true, timeout); InactivityHelper.Initialize(timeout); } }
private async void AutolockExecute() { var timeout = AutolockTimeout + 0; var dialog = new ContentDialog { Style = BootStrapper.Current.Resources["ModernContentDialogStyle"] as Style }; var stack = new StackPanel(); stack.Margin = new Thickness(12, 16, 12, 0); stack.Children.Add(new RadioButton { Tag = 0, Content = LocaleHelper.FormatAutoLock(0), IsChecked = timeout == 0 }); stack.Children.Add(new RadioButton { Tag = 1 * 60, Content = LocaleHelper.FormatAutoLock(1 * 60), IsChecked = timeout == 1 * 60 }); stack.Children.Add(new RadioButton { Tag = 5 * 60, Content = LocaleHelper.FormatAutoLock(5 * 60), IsChecked = timeout == 5 * 60 }); stack.Children.Add(new RadioButton { Tag = 1 * 60 * 60, Content = LocaleHelper.FormatAutoLock(1 * 60 * 60), IsChecked = timeout == 1 * 60 * 60 }); stack.Children.Add(new RadioButton { Tag = 5 * 60 * 60, Content = LocaleHelper.FormatAutoLock(5 * 60 * 60), IsChecked = timeout == 5 * 60 * 60 }); dialog.Title = Strings.Android.AutoLock; dialog.Content = stack; dialog.PrimaryButtonText = Strings.Android.OK; dialog.SecondaryButtonText = Strings.Android.Cancel; var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var mode = 1; foreach (RadioButton current in stack.Children) { if (current.IsChecked == true) { mode = (int)current.Tag; break; } } AutolockTimeout = mode; InactivityHelper.Initialize(mode); } }
private async void EditExecute() { var timeout = _passcodeService.AutolockTimeout + 0; var dialog = new SettingsPasscodeInputPopup(); dialog.IsSimple = _passcodeService.IsSimple; var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var passcode = dialog.Passcode; var simple = dialog.IsSimple; _passcodeService.Set(passcode, simple, timeout); InactivityHelper.Initialize(timeout); } }
public async Task TogglePasscode() { if (_passcodeService.IsEnabled) { _passcodeService.Reset(); } else { var timeout = _passcodeService.AutolockTimeout + 0; var dialog = new SettingsPasscodeInputPopup(); dialog.IsSimple = _passcodeService.IsSimple; var confirm = await dialog.ShowQueuedAsync(); if (confirm == ContentDialogResult.Primary) { var passcode = dialog.Passcode; var simple = dialog.IsSimple; _passcodeService.Set(passcode, simple, timeout); InactivityHelper.Initialize(timeout); } } }