Пример #1
0
        private void _handleOptionsChanged(GalleryOptions newOptions)
        {
            this.setState(() =>
            {
                if (this._options.timeDilation != newOptions.timeDilation)
                {
                    this._timeDilationTimer?.cancel();
                    this._timeDilationTimer = null;
                    if (newOptions.timeDilation > 1.0f
                        ) // We delay the time dilation change long enough that the user can see
                          // that UI has started reacting and then we slam on the brakes so that
                          // they see that the time is in fact now dilated.
                    {
                        this._timeDilationTimer = Timer.create(new TimeSpan(0, 0, 0, 0, 150),
                                                               () => { scheduler_.timeDilation = newOptions.timeDilation; });
                    }
                    else
                    {
                        scheduler_.timeDilation = newOptions.timeDilation;
                    }
                }

                this._options = newOptions;
            });
        }
Пример #2
0
 public override void initState()
 {
     base.initState();
     this._options = new GalleryOptions(
         theme: GalleryTheme.kLightGalleryTheme,
         textScaleFactor: GalleryTextScaleValue.kAllGalleryTextScaleValues[0],
         timeDilation: SchedulerBinding.instance.timeDilation,
         platform: Application.platform
         );
 }
Пример #3
0
 public GalleryOptionsPage(
     Key key = null,
     GalleryOptions options = null,
     ValueChanged <GalleryOptions> onOptionsChanged = null,
     VoidCallback onSendFeedback = null
     ) : base(key: key)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
     this.onSendFeedback   = onSendFeedback;
 }
Пример #4
0
 public GalleryHome(
     Key key                = null,
     bool testMode          = false,
     Widget optionsPage     = null,
     GalleryOptions options = null
     ) : base(key: key)
 {
     this.testMode    = testMode;
     this.optionsPage = optionsPage;
     this.options     = options;
 }
Пример #5
0
 public override void initState()
 {
     base.initState();
     this._options = new GalleryOptions(
         themeMode: ThemeMode.system,
         textScaleFactor: GalleryTextScaleValue.kAllGalleryTextScaleValues[0],
         visualDensity: GalleryVisualDensityValue.kAllGalleryVisualDensityValues[0],
         timeDilation: scheduler_.timeDilation,
         platform: defaultTargetPlatform
         );
     this.model = new AppStateModel();
     this.model.loadProducts();
 }
Пример #6
0
        void _handleOptionsChanged(GalleryOptions newOptions)
        {
            this.setState(() => {
                if (this._options.timeDilation != newOptions.timeDilation)
                {
                    this._timeDilationTimer?.cancel();
                    this._timeDilationTimer = null;
                    if (newOptions.timeDilation > 1.0f)
                    {
                        this._timeDilationTimer = Window.instance.run(new TimeSpan(0, 0, 0, 0, 150),
                                                                      () => { SchedulerBinding.instance.timeDilation = newOptions.timeDilation; });
                    }
                    else
                    {
                        SchedulerBinding.instance.timeDilation = newOptions.timeDilation;
                    }
                }

                this._options = newOptions;
            });
        }
Пример #7
0
 public _PlatformItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #8
0
 public _TimeDilationItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #9
0
 public _TextDirectionItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #10
0
 public _VisualDensityItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #11
0
 public _TextScaleFactorItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #12
0
 public _ThemeModeItem(GalleryOptions options, ValueChanged <GalleryOptions> onOptionsChanged)
 {
     this.options          = options;
     this.onOptionsChanged = onOptionsChanged;
 }
Пример #13
0
 public override void reassemble()
 {
     this._options = this._options.copyWith(platform: defaultTargetPlatform);
     base.reassemble();
 }