public static FloatWithUnitRow Create(
     string title, Func <FloatWithUnit> getter, Action <FloatWithUnit> setter,
     IDataSourceListener dataSourceListener)
 {
     getter.RequireNotNull(nameof(getter));
     setter.RequireNotNull(nameof(setter));
     dataSourceListener.RequireNotNull(nameof(dataSourceListener));
     return(new FloatWithUnitRow(
                title,
                () =>
     {
         var floatWithUnit = getter();
         return $"{NumberFormatter.Instance.FormatNFloat(floatWithUnit.Value)} ({floatWithUnit.Unit})";
     },
                getter,
                newValue =>
     {
         setter(newValue);
         dataSourceListener.OnDataChange();
     },
                rowIndexPathPair =>
     {
         var row = rowIndexPathPair.Item1;
         dataSourceListener.GetFloatWithUnit(row.Title, getter(), newValue => row.Setter(newValue));
     }));
 }
 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
                 )
         })
     };
 }
 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;
             }
                 )
         })
     };
 }
Beispiel #4
0
        public CompositeTypesDataSource(IDataSourceListener dataSourceListener)
        {
            this.DataSourceListener = dataSourceListener;

            List <Row> options = new List <Row>();

            foreach (CompositeType type in Enum.GetValues(typeof(CompositeType)))
            {
                options.Add(BoolOptionRow.Create(
                                title: type.ToString(),
                                getter: () => SettingsManager.Instance.EnabledCompositeTypes.HasFlag(type),
                                setter: selected =>
                {
                    CompositeType compositeTypes = SettingsManager.Instance.EnabledCompositeTypes;
                    if (selected)
                    {
                        compositeTypes |= type;
                    }
                    else
                    {
                        compositeTypes &= ~type;
                    }
                    SettingsManager.Instance.EnabledCompositeTypes = compositeTypes;
                },
                                this.DataSourceListener));
            }

            this.Sections = new[] { new Section(options.ToArray(), "Type") };
        }
Beispiel #5
0
 public SymbologiesDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             ActionRow.Create(
                 "Enable All",
                 tuple =>
             {
                 SettingsManager.Instance.EnableAllSymbologyies();
                 this.DataSourceListener.OnDataChange();
             }
                 ),
             ActionRow.Create(
                 "Disable All",
                 tuple =>
             {
                 SettingsManager.Instance.DisableAllSymbologies();
                 this.DataSourceListener.OnDataChange();
             }
                 )
         }),
         new Section(SymbologyExtensions.AllValues.Select(symbology =>
         {
             return(SymbologyRow.Create(
                        () => SettingsManager.Instance.GetSymbologySettings(symbology),
                        _ => SettingsManager.Instance.SymbologySettingsChanged(),
                        this.DataSourceListener
                        ));
         }).ToArray())
     };
 }
Beispiel #6
0
 public LogoDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new []
         {
             ChoiceRow <NamedAnchor> .Create(
                 "Anchor",
                 Enumeration.GetAll <NamedAnchor>().ToArray(),
                 () => SettingsManager.Instance.LogoAnchor,
                 anchor => SettingsManager.Instance.LogoAnchor = anchor,
                 this.DataSourceListener
                 )
         }),
         new Section(new[]
         {
             FloatWithUnitRow.Create(
                 "X",
                 () => SettingsManager.Instance.LogoOffset.X,
                 value => SettingsManager.Instance.LogoOffset = SettingsManager.Instance.LogoOffset.NewWithX(value),
                 this.DataSourceListener
                 ),
             FloatWithUnitRow.Create(
                 "Y",
                 () => SettingsManager.Instance.LogoOffset.Y,
                 value => SettingsManager.Instance.LogoOffset = SettingsManager.Instance.LogoOffset.NewWithY(value),
                 this.DataSourceListener
                 )
         }, "Offset")
     };
 }
Beispiel #7
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
                        )
                })
            };
        }
Beispiel #8
0
        public ViewfinderDataSource(IDataSourceListener dataSourceListener)
        {
            this.DataSourceListener = dataSourceListener;

            this.rectangularWidth = FloatWithUnitRow.Create(
                "Width",
                () => SettingsManager.Instance.RectangularWidth,
                unit => SettingsManager.Instance.RectangularWidth = unit,
                this.DataSourceListener
                );

            this.rectangularHeight = FloatWithUnitRow.Create(
                "Height",
                () => SettingsManager.Instance.RectangularHeight,
                unit => SettingsManager.Instance.RectangularHeight = unit,
                this.DataSourceListener
                );

            this.rectangularShorterDimension = FloatRow.Create(
                "Shorter Dimension",
                () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.RectangularShorterDimension),
                () => SettingsManager.Instance.RectangularShorterDimension,
                aspect => SettingsManager.Instance.RectangularShorterDimension = aspect
                );

            this.rectangularWidthAspect = FloatRow.Create(
                "Width Aspect",
                () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.RectangularWidthAspect),
                () => SettingsManager.Instance.RectangularWidthAspect,
                aspect => SettingsManager.Instance.RectangularWidthAspect = aspect
                );

            this.rectangularHeightAspect = FloatRow.Create(
                "Height Aspect",
                () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.RectangularHeightAspect),
                () => SettingsManager.Instance.RectangularHeightAspect,
                aspect => SettingsManager.Instance.RectangularHeightAspect = aspect
                );

            this.rectangularLongerDimensioApsect = FloatRow.Create(
                "Longer Dimension Aspect",
                () => NumberFormatter.Instance.FormatNFloat(SettingsManager.Instance.RectangularLongerDimensionAspect),
                () => SettingsManager.Instance.RectangularLongerDimensionAspect,
                aspect => SettingsManager.Instance.RectangularLongerDimensionAspect = aspect
                );

            this.rectangularSettings = this.CreateRectangularSettings();
            this.rectangularSizeType = this.CreateRectangularSizeType();
            this.laserlineSettings   = this.CreateLaserlineSettings();
            this.aimerSettings       = this.CreateAimerSettings();
            this.viewfinderType      = this.CreateTypeSection();
        }
Beispiel #9
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 DuplicateFilterDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             FloatRow.Create(
                 title: "Code Duplicate Filter (s)",
                 () => NumberFormatter.Instance.FormatTimeSpanToSeconds(SettingsManager.Instance.DuplicateFilter),
                 () => (nfloat)SettingsManager.Instance.DuplicateFilter.TotalSeconds,
                 value => SettingsManager.Instance.DuplicateFilter = TimeSpan.FromSeconds(value)
                 )
         })
     };
 }
 public OverlayDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             ChoiceRow <NamedBrush> .Create("Brush",
                                            Enumeration.GetAll <NamedBrush>().ToArray(),
                                            () => NamedBrush.Create(SettingsManager.Instance.Brush),
                                            brush => SettingsManager.Instance.Brush = brush.Brush,
                                            this.DataSourceListener
                                            )
         }),
     };
 }
Beispiel #13
0
 public static BoolOptionRow Create(string title,
                                    Func <bool> getter,
                                    Action <bool> setter,
                                    IDataSourceListener dataSourceListener)
 {
     getter.RequireNotNull(nameof(getter));
     setter.RequireNotNull(nameof(setter));
     dataSourceListener.RequireNotNull(nameof(dataSourceListener));
     return(new BoolOptionRow(title, getter, b =>
     {
         setter(b);
         dataSourceListener.OnDataChange();
     }, tuple =>
     {
         var row = tuple.Item1;
         row.Setter(!row.Getter());
     }));
 }
 public PointOfInterestDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
     this.Sections           = new[]
     {
         new Section(new[]
         {
             FloatWithUnitRow.Create("X",
                                     () => SettingsManager.Instance.PointOfInterest.X,
                                     unit => SettingsManager.Instance.PointOfInterest.NewWithX(unit),
                                     this.DataSourceListener),
             FloatWithUnitRow.Create("Y",
                                     () => SettingsManager.Instance.PointOfInterest.Y,
                                     unit => SettingsManager.Instance.PointOfInterest.NewWithY(unit),
                                     this.DataSourceListener)
         })
     };
 }
 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
                 )
         })
     };
 }
Beispiel #16
0
 public static SymbologyRow Create(Func <SymbologySettings> getter,
                                   Action <SymbologySettings> setter, IDataSourceListener dataSourceListener)
 {
     getter.RequireNotNull(nameof(getter));
     setter.RequireNotNull(nameof(setter));
     return(new SymbologyRow(
                getter().Symbology.ReadableName(),
                getter,
                settings =>
     {
         setter(settings);
         dataSourceListener.OnDataChange();
     },
                tuple =>
     {
         var row = tuple.Item1;
         dataSourceListener.PresentSymbologySettings(
             row.Getter(),
             settings => row.Setter(settings)
             );
     }
                ));
 }
 public static ChoiceRow <TEnumeration> Create(string title, TEnumeration[] options,
                                               Func <TEnumeration> getter, Action <TEnumeration> setter, IDataSourceListener dataSourceListener)
 {
     getter.RequireNotNull(nameof(getter));
     setter.RequireNotNull(nameof(setter));
     dataSourceListener.RequireNotNull(nameof(dataSourceListener));
     return(new ChoiceRow <TEnumeration>(title, getter, value =>
     {
         setter(value);
         dataSourceListener.OnDataChange();
     }, tuple =>
     {
         var row = tuple.Item1;
         dataSourceListener.PresentChoice(
             row.Title,
             options,
             getter(),
             value => row.Setter(value)
             );
     }));
 }
 public CameraDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
 }
 public static OptionRow <TValue> Create(string title, Func <TValue> getter,
                                         Action <Tuple <OptionRow <TValue>, NSIndexPath> > onSelect, IDataSourceListener dataSourceListener)
 {
     getter.RequireNotNull(nameof(getter));
     onSelect.RequireNotNull(nameof(onSelect));
     dataSourceListener.RequireNotNull(nameof(dataSourceListener));
     return(new OptionRow <TValue>(title, getter, null, tuple =>
     {
         onSelect(tuple);
         dataSourceListener.OnDataChange();
     }));
 }
 public LocationSelectionDataSource(IDataSourceListener dataSourceListener)
 {
     this.DataSourceListener = dataSourceListener;
 }
 public SymbologySettingsDataSource(IDataSourceListener dataSourceListener, SymbologySettings symbologySettings)
 {
     this.DataSourceListener   = dataSourceListener;
     this.symbologySettings    = symbologySettings;
     this.symbologyDescription = SymbologyDescription.Create(symbologySettings.Symbology);
 }