Ejemplo n.º 1
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")
     };
 }
 private Section CreateLaserlineSettings()
 {
     return(new Section(new Row[]
     {
         FloatWithUnitRow.Create(
             "Width",
             () => (SettingsManager.Instance.Viewfinder as LaserlineViewfinder).Width,
             unit => (SettingsManager.Instance.Viewfinder as LaserlineViewfinder).Width = unit,
             this.DataSourceListener
             ),
         ChoiceRow <LaserlineViewfinderEnabledColor> .Create(
             "Enabled Color",
             Enumeration.GetAll <LaserlineViewfinderEnabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderEnabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderEnabledColor = color,
             this.DataSourceListener
             ),
         ChoiceRow <LaserlineViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <LaserlineViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderDisabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderDisabledColor = color,
             this.DataSourceListener
             )
     }, "Laserline"));
 }
Ejemplo n.º 3
0
 private Section CreateLaserlineSettings()
 {
     return(new Section(new Row[]
     {
         ChoiceRow <LaserlineViewfinderStyleType> .Create(
             "Style",
             Enumeration.GetAll <LaserlineViewfinderStyleType>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderStyleType,
             newStyle =>
         {
             SettingsManager.Instance.LaserlineViewfinderStyleType = newStyle;
             SettingsManager.Instance.ViewfinderKind = ViewfinderKind.UpdateLaserlineStyle(newStyle);
             this.laserlineSettings = this.CreateLaserlineSettings();
         },
             this.DataSourceListener),
         FloatWithUnitRow.Create(
             "Width",
             () => (SettingsManager.Instance.ViewfinderKind.Viewfinder as LaserlineViewfinder).Width,
             unit => (SettingsManager.Instance.ViewfinderKind.Viewfinder as LaserlineViewfinder).Width = unit,
             this.DataSourceListener
             ),
         this.LaserlineViewfinderEnabledColorRow(),
         ChoiceRow <LaserlineViewfinderDisabledColor> .Create(
             "Disabled Color",
             Enumeration.GetAll <LaserlineViewfinderDisabledColor>().ToArray(),
             () => SettingsManager.Instance.LaserlineViewfinderDisabledColor,
             color => SettingsManager.Instance.LaserlineViewfinderDisabledColor = color,
             this.DataSourceListener
             )
     }, "Laserline"));
 }
 private FloatWithUnitRow CreateRectangularHeightRow()
 {
     return(FloatWithUnitRow.Create(
                "Height",
                () => this.GetRectangularHeight(),
                value => this.SetRectangularHeight(value),
                this.DataSourceListener
                ));
 }
 private FloatWithUnitRow CreateRectangularWidthRow()
 {
     return(FloatWithUnitRow.Create(
                "Width",
                () => this.GetRectangularWidth(),
                value => this.SetRectangularWidth(value),
                this.DataSourceListener
                ));
 }
Ejemplo n.º 6
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
                        )
                })
            };
        }
Ejemplo n.º 7
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();
        }
 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)
         })
     };
 }
        private Section[] CreateSections()
        {
            var sections = new List <Section>()
            {
                new Section(new []
                {
                    OptionRow <bool> .Create("None",
                                             () => SettingsManager.Instance.LocationSelection == null,
                                             tuple => SettingsManager.Instance.LocationSelection = null,
                                             this.DataSourceListener
                                             ),
                    OptionRow <bool> .Create("Radius",
                                             () => SettingsManager.Instance.LocationSelection is RadiusLocationSelection,
                                             _ => SettingsManager.Instance.LocationSelection = RadiusLocationSelection.Create(FloatWithUnit.Zero),
                                             this.DataSourceListener
                                             ),
                    OptionRow <bool> .Create("Rectangular",
                                             () => SettingsManager.Instance.LocationSelection is RectangularLocationSelection,
                                             _ => SettingsManager.Instance.LocationSelection = RectangularLocationSelection.Create(SizeWithUnit.Zero),
                                             this.DataSourceListener
                                             )
                }, "Type")
            };

            switch (SettingsManager.Instance.LocationSelection)
            {
            case RadiusLocationSelection radiusLocationSelection:
            {
                var radiusSettings = new Section(new[]
                    {
                        FloatWithUnitRow.Create(
                            "Size",
                            () => radiusLocationSelection.Radius,
                            value => SettingsManager.Instance.LocationSelection = RadiusLocationSelection.Create(value),
                            this.DataSourceListener
                            )
                    }, "Radius");
                sections.Add(radiusSettings);
                break;
            }

            case RectangularLocationSelection rectangularLocationSelection:
            {
                var rectangularSettings = new Section(new []
                    {
                        ChoiceRow <RectangularSizeSpecification> .Create(
                            "Size Specification",
                            Enumeration.GetAll <RectangularSizeSpecification>().ToArray(),
                            () => this.GetCurrentSizeSpecification(),
                            specification => this.SetCurrentSizeSpecification(specification),
                            this.DataSourceListener
                            ),
                    }, "Rectangular");
                sections.Add(rectangularSettings);
                switch (rectangularLocationSelection.SizeWithUnitAndAspect.SizingMode)
                {
                case SizingMode.WidthAndHeight:
                {
                    sections.Add(new Section(new[]
                            {
                                this.CreateRectangularWidthRow(),
                                this.CreateRectangularHeightRow()
                            }));
                    break;
                }

                case SizingMode.WidthAndAspectRatio:
                {
                    sections.Add(new Section(new Row[]
                            {
                                this.CreateRectangularWidthRow(),
                                this.CreateHeightAspectRow()
                            }));
                    break;
                }

                case SizingMode.HeightAndAspectRatio:
                {
                    sections.Add(new Section(new Row[]
                            {
                                this.CreateRectangularHeightRow(),
                                this.CreateWidthAspectRow()
                            }));
                    break;
                }
                }
                break;
            }
            }

            return(sections.ToArray());
        }