public FeedbackDataSource(IDataSourceListener dataSource)
 {
     this.DataSourceListener = DataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Sound",
                 () => SettingsManager.Instance.Feedback.Sound != null,
                 value =>
             {
                 Sound sound  = value ? Sound.DefaultSound : null;
                 var feedback = new Feedback(SettingsManager.Instance.Feedback.Vibration, sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 ),
             SwitchRow.Create(
                 "Vibration",
                 () => SettingsManager.Instance.Feedback.Vibration != null,
                 value =>
             {
                 Vibration vibration = value ? Vibration.DefaultVibration : null;
                 var feedback        = new Feedback(vibration, SettingsManager.Instance.Feedback.Sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 )
         })
     };
 }
 public FeedbackDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new Row[]
         {
             SwitchRow.Create(
                 "Sound",
                 () => SettingsManager.Instance.Feedback.Sound != null,
                 value =>
             {
                 Sound sound  = value ? Sound.DefaultSound : null;
                 var feedback = new Feedback(SettingsManager.Instance.Feedback.Vibration, sound);
                 SettingsManager.Instance.Feedback = feedback;
             }
                 ),
             ChoiceRow <VibrationType> .Create(
                 "Vibration",
                 Enumeration.GetAll <VibrationType>().ToArray(),
                 () => VibrationType.Create(SettingsManager.Instance.Vibration),
                 type => {
                 SettingsManager.Instance.Vibration = type.Vibration;
                 var feedback = new Feedback(
                     SettingsManager.Instance.Vibration,
                     SettingsManager.Instance.Feedback.Sound);
                 SettingsManager.Instance.Feedback = feedback;
             },
                 this.DataSourceListener
                 )
         })
     };
 }
Пример #3
0
        private Section CreateRectangularAnimation()
        {
            var animationOption = SwitchRow.Create(
                "Animation",
                () => SettingsManager.Instance.RectangularViewfinderAnimation != null,
                enabled =>
            {
                SettingsManager.Instance.RectangularViewfinderAnimation = enabled ?
                                                                          new RectangularViewfinderAnimation(looping: false) : null;
                this.DataSourceListener.OnDataChange();
            });

            var loopingOption = SwitchRow.Create(
                "Looping",
                () => SettingsManager.Instance.RectangularViewfinderAnimation?.Looping ?? false,
                enabled =>
            {
                SettingsManager.Instance.RectangularViewfinderAnimation =
                    new RectangularViewfinderAnimation(looping: enabled);
            });

            if (SettingsManager.Instance.RectangularViewfinderAnimation != null)
            {
                return(new Section(new[] { animationOption, loopingOption }));
            }

            return(new Section(new[] { animationOption }));
        }
Пример #4
0
        public ScanAreaDataSource(IDataSourceListener dataSourceListener)
        {
            this.DataSourceListener = dataSourceListener;

            this.Sections = new[]
            {
                new Section(new []
                {
                    FloatWithUnitRow.Create(
                        "Top",
                        () => SettingsManager.Instance.ScanAreaMargins.Top,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins =
                            SettingsManager.Instance.ScanAreaMargins.NewWithTop(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Right",
                        () => SettingsManager.Instance.ScanAreaMargins.Right,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithRight(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Bottom",
                        () => SettingsManager.Instance.ScanAreaMargins.Bottom,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithBottom(value);
                    },
                        this.DataSourceListener
                        ),
                    FloatWithUnitRow.Create(
                        "Left",
                        () => SettingsManager.Instance.ScanAreaMargins.Left,
                        value =>
                    {
                        SettingsManager.Instance.ScanAreaMargins = SettingsManager.Instance.ScanAreaMargins.NewWithLeft(value);
                    },
                        this.DataSourceListener
                        )
                }, "Margins"),
                new Section(new Row[]
                {
                    SwitchRow.Create(
                        "Should Show Scan Area Guides",
                        () => SettingsManager.Instance.ShouldShowScanAreaGuides,
                        value => SettingsManager.Instance.ShouldShowScanAreaGuides = value
                        )
                })
            };
        }
 private Section CreateTorchSection()
 {
     return(new Section(new[]
     {
         SwitchRow.Create(
             "Desired Torch State",
             () => SettingsManager.Instance.TorchState == TorchState.On,
             value => SettingsManager.Instance.TorchState = value ? TorchState.On : TorchState.Off
             )
     }));
 }
Пример #6
0
 public ResultDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Continuous Scanning",
                 () => SettingsManager.Instance.ContinuousModeEnabled,
                 value => SettingsManager.Instance.ContinuousModeEnabled = value
                 )
         })
     };
 }
 public ControlsDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Torch Button",
                 () => SettingsManager.Instance.TorchSwitchShown,
                 value => SettingsManager.Instance.TorchSwitchShown = value
                 )
         })
     };
 }
 public GesturesDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             SwitchRow.Create(
                 "Tap to Focus",
                 () => SettingsManager.Instance.TapToFocus != null,
                 enabled => SettingsManager.Instance.TapToFocus = enabled ? TapToFocus.Create() : null
                 ),
             SwitchRow.Create(
                 "Swipe to Zoom",
                 () => SettingsManager.Instance.SwipeToZoom != null,
                 enabled => SettingsManager.Instance.SwipeToZoom = enabled ? SwipeToZoom.Create(): null
                 )
         })
     };
 }
        private Section CreateGeneralSection()
        {
            var enabled = SwitchRow.Create(
                "Enabled",
                () => this.symbologySettings.Enabled,
                enabled => this.symbologySettings.Enabled = enabled
                );
            var rows = new List <Row>()
            {
                enabled
            };

            if (this.symbologyDescription.ColorInvertible)
            {
                rows.Add(SwitchRow.Create(
                             "Color Inverted",
                             () => this.symbologySettings.ColorInvertedEnabled,
                             enabled => this.symbologySettings.ColorInvertedEnabled = enabled
                             ));
            }

            return(new Section(rows.ToArray()));
        }