示例#1
0
 public async Task SetLocationSelectionRadiusValueAsync(float value)
 {
     if (this.LocationSelection is RadiusLocationSelection)
     {
         MeasureUnit   currentUnit = ((RadiusLocationSelection)this.LocationSelection).Radius.Unit;
         FloatWithUnit newRadius   = new FloatWithUnit(value, currentUnit);
         this.LocationSelectionRadiusValue = value;
         await this.SetLocationSelectionAsync(RadiusLocationSelection.Create(newRadius));
     }
 }
示例#2
0
 public async Task SetLocationSelectionRadiusMeasureUnitAsync(MeasureUnit value)
 {
     if (this.LocationSelection is RadiusLocationSelection)
     {
         float         currentValue = ((RadiusLocationSelection)this.LocationSelection).Radius.Value;
         FloatWithUnit newRadius    = new FloatWithUnit(currentValue, value);
         this.LocationSelectionRadiusMeasureUnit = value;
         await this.SetLocationSelectionAsync(RadiusLocationSelection.Create(newRadius));
     }
 }
        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());
        }
 public override ILocationSelection BuildLocationSelection()
 {
     return(RadiusLocationSelection.Create(new FloatWithUnit(this.Radius, this.MeasureUnit)));
 }