コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public object Convert(object value, Type targetType, object parameter, string language)
 {
     return(LocaleHelper.FormatAutoLock(System.Convert.ToInt32(value)));
 }