public void TestDefaultInitialization()
        {
            RangeSlider rangeSlider = new RangeSlider();

            Assert.AreEqual(0d, rangeSlider.Lower);
            Assert.AreEqual(100d, rangeSlider.Upper);
        }
Beispiel #2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Interval sliderRange   = Interval.Unset;
            Interval startingRange = Interval.Unset;

            if (!DA.GetData("Slider Range", ref sliderRange))
            {
                return;
            }
            if (!DA.GetData("Starting Range", ref startingRange))
            {
                return;
            }
            RangeSlider rs = new RangeSlider
            {
                MinRangeWidth        = 0,
                Minimum              = sliderRange.Min,
                Maximum              = sliderRange.Max,
                LowerValue           = startingRange.Min,
                UpperValue           = startingRange.Max,
                AutoToolTipPlacement = AutoToolTipPlacement.BottomRight
            };

            DA.SetData("Range Slider", new UIElement_Goo(rs, "Range Slider", InstanceGuid, DA.Iteration));
        }
Beispiel #3
0
        private void RangeSlider3_DrawLabel(object sender, DrawLabelEventArgs e)
        {
            RangeSlider range = sender as RangeSlider;
            TimeSpan    time  = TimeSpan.FromHours(e.Value);

            e.Handled = true;
            var hours          = time.Hours;
            var minutes        = time.Minutes;
            var amPmDesignator = " AM";

            if (hours == 0)
            {
                hours = 12;
            }
            else if (hours == 12)
            {
                amPmDesignator = " PM";
            }
            else if (hours > 12)
            {
                hours         -= 12;
                amPmDesignator = " PM";
            }
            var formattedTime =
                String.Format("{0}:{1:00}{2}", hours, minutes, amPmDesignator);

            e.Text = formattedTime.ToString();
        }
Beispiel #4
0
 public LinkerBeGone()
 {
     // This is needed to ensure that the linker doesn't remove the control
     var a = new Swiper();
     var b = new CardContentView();
     var c = new RangeSlider();
 }
Beispiel #5
0
        void OnThumbRadiusSwitchToggled(object?sender, ToggledEventArgs e)
        {
            if (sender == LowerUpperThumbRadiusSwitch)
            {
                if (e.Value)
                {
                    RangeSlider.SetBinding(RangeSlider.LowerThumbRadiusProperty, GetSliderValueBinding(LowerThumbRadiusSlider));
                    RangeSlider.SetBinding(RangeSlider.UpperThumbRadiusProperty, GetSliderValueBinding(UpperThumbRadiusSlider));
                    return;
                }

                RangeSlider.LowerThumbRadius = (double)RangeSlider.LowerThumbRadiusProperty.DefaultValue;
                RangeSlider.UpperThumbRadius = (double)RangeSlider.UpperThumbRadiusProperty.DefaultValue;
                return;
            }

            if (sender == ThumbRadiusSwitch)
            {
                if (e.Value)
                {
                    RangeSlider.SetBinding(RangeSlider.ThumbRadiusProperty, GetSliderValueBinding(ThumbRadiusSlider));
                    OnThumbRadiusSwitchToggled(LowerUpperThumbRadiusSwitch, new ToggledEventArgs(LowerUpperThumbRadiusSwitch.IsToggled));
                    return;
                }

                RangeSlider.ThumbRadius = (double)RangeSlider.ThumbRadiusProperty.DefaultValue;
                OnThumbRadiusSwitchToggled(LowerUpperThumbRadiusSwitch, new ToggledEventArgs(false));
                return;
            }
        }
Beispiel #6
0
        private void RangeSlider2_DrawLabel(object sender, DrawLabelEventArgs e)
        {
            RangeSlider range = sender as RangeSlider;

            e.Handled = true;
            e.Text    = e.Value.ToString() + " km";
        }
Beispiel #7
0
        private void RangeSlider1_DrawLabel(object sender, DrawLabelEventArgs e)
        {
            RangeSlider range = sender as RangeSlider;

            e.Handled = true;
            e.Text    = "$" + ((Double)e.Value).ToString() + ".00";
        }
Beispiel #8
0
        // Token: 0x060045FA RID: 17914 RVA: 0x0017CDE8 File Offset: 0x0017B1E8
        private void Start()
        {
            RangeSlider component = base.GetComponent <RangeSlider>();

            component.OnValuesChange.AddListener(new UnityAction <int, int>(this.SliderChanged));
            this.SliderChanged(component.ValueMin, component.ValueMax);
        }
Beispiel #9
0
        private void rangeSlider1_ValueChanged(object sender, EventArgs e)
        {
            RangeSlider range = sender as RangeSlider;

            this.numericUpDownExt1.Value = range.SliderMin;
            this.numericUpDownExt2.Value = range.SliderMax;
        }
Beispiel #10
0
        public void TestUpper()
        {
            RangeSlider rangeSlider = new RangeSlider();

            Assert.AreEqual(100d, rangeSlider.Upper);
            rangeSlider.SetValue(RangeSlider.UpperProperty, 50d);
            Assert.AreEqual(50d, rangeSlider.Upper);
            Assert.AreEqual(50d, rangeSlider.GetValue(RangeSlider.UpperProperty));
        }
 void Start()
 {
     slider = GetComponent <RangeSlider>();
     if (slider != null)
     {
         slider.OnValuesChange.AddListener(SliderChanged);
         SliderChanged(slider.ValueMin, slider.ValueMax);
     }
 }
		void Start()
		{
			slider = GetComponent<RangeSlider>();
			if (slider!=null)
			{
				slider.OnValuesChange.AddListener(SliderChanged);
				SliderChanged(slider.ValueMin, slider.ValueMax);
			}
		}
Beispiel #13
0
 /// <summary>
 /// Init and add listeners.
 /// </summary>
 protected virtual void Init()
 {
     slider = GetComponent <RangeSlider>();
     if (slider != null)
     {
         slider.OnValuesChange.AddListener(ValueChanged);
         ValueChanged(slider.ValueMin, slider.ValueMax);
     }
 }
Beispiel #14
0
        void OnTrackRadiusSwitchToggled(object?sender, ToggledEventArgs e)
        {
            if (e.Value)
            {
                RangeSlider.SetBinding(RangeSlider.TrackRadiusProperty, GetSliderValueBinding(TrackRadiusSlider));
                return;
            }

            RangeSlider.TrackRadius = (double)RangeSlider.TrackRadiusProperty.DefaultValue;
        }
Beispiel #15
0
        public RangeSliderRenderingTests()
        {
            builder = new Mock <IRangeSliderHtmlBuilder>();

            builder.Setup(b => b.Build()).Returns(new HtmlElement("div"));

            textWriter = new Mock <TextWriter>();
            component  = SliderTestHelper.CreateRangeSlider <decimal>(builder.Object, null);

            component.Name = "Slider";
        }
        public RangeSliderRenderingTests()
        {
            builder = new Mock<IRangeSliderHtmlBuilder>();

            builder.Setup(b => b.Build()).Returns(new HtmlElement("div"));

            textWriter = new Mock<TextWriter>();
            component = SliderTestHelper.CreateRangeSlider<decimal>(builder.Object, null);

            component.Name = "Slider";
        }
Beispiel #17
0
 void OnThumbSizeSwitchToggled(object sender, ToggledEventArgs e)
 {
     if (e.Value)
     {
         RangeSlider.SetBinding(RangeSlider.LowerThumbSizeProperty, GetSliderValueBinding(LowerThumbSizeSlider));
         RangeSlider.SetBinding(RangeSlider.UpperThumbSizeProperty, GetSliderValueBinding(UpperThumbSizeSlider));
         return;
     }
     RangeSlider.LowerThumbSize = (double)RangeSlider.LowerThumbSizeProperty.DefaultValue;
     RangeSlider.UpperThumbSize = (double)RangeSlider.UpperThumbSizeProperty.DefaultValue;
 }
    // Innerbar is connected from slider a to slider b.
    private void ConnectToSliders(RangeSlider rangeSlider)
    {
        RectTransform rectTransform = innerBar.GetComponent <RectTransform>();

        float length          = Mathf.Abs(rangeSlider.slider2.GetComponent <RectTransform>().anchoredPosition.x - rangeSlider.slider1.GetComponent <RectTransform>().anchoredPosition.x);
        float middlePositionX = (rangeSlider.slider2.GetComponent <RectTransform>().anchoredPosition.x + rangeSlider.slider1.GetComponent <RectTransform>().anchoredPosition.x) / 2;

        // Keep height, but change the width according to the length between the two sliders.
        rectTransform.sizeDelta = new Vector2(length, rectTransform.rect.height);

        // Center the position between the two sliders.
        rectTransform.anchoredPosition = new Vector3(middlePositionX, rangeSlider.slider1.GetComponent <RectTransform>().anchoredPosition.y, 0);
    }
Beispiel #19
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is Slider)
     {
         string param = parameter.ToString();
         if (param == "0")
         {
             return(RangeSlider.GetThumbWidth(( Slider )value));
         }
         else if (param == "1")
         {
             return(RangeSlider.GetThumbHeight(( Slider )value));
         }
     }
     return(0d);
 }
    /// <param name="hasTwoSliders"> Whether you want two or one slider.</param>
    /// <param name="position"> Position of the slider.</param>
    /// <param name="valueContainerPosition"> Position of the slider value(s).</param>
    /// <param name="sliderWidth"> How wide the slider is.</param>
    /// <param name="sliderHeight"> How tall the slider is.</param>
    /// <param name="minValue"> Lowest value possible in the slider.</param>
    /// <param name="maxValue"> Highest value possible in the slider.</param>
    /// <param name="innerMinValue"> Left slider's starting value.</param>
    /// <param name="innerMaxValue"> Right slider's starting value.</param>
    /// <param name="knobDirectory"> Set different image when the knob directory is given.</param>
    /// <param name="initialHexColor"> Initial colour of the knob.</param>
    /// <param name="changedHexColor"> Colour of the knob when it is dragged.</param>
    /// <param name="innerBarDirectory"> Set different image when the innerBar directory is given.</param>
    /// <param name="minMaxValueType"> What do the values stand for? Is it for AGE? Is it for KM?.</param>
    public void Set(bool hasTwoSliders, int sliderWidth, int sliderHeight, int minValue, int maxValue, int innerMinValue, int innerMaxValue, string knobDirectory, string initialHexColor, string changedHexColor, string innerBarDirectory = "", string minMaxValueType = "Pepernoten", Action <int> onMinValueChanged = null, Action <int> onMaxValueChanged = null, bool useUnlimited = false)
    {
        twoSliders    = hasTwoSliders;
        _minValue     = minValue;
        _valueType    = minMaxValueType;
        _useUnlimited = useUnlimited;

        if (_useUnlimited)
        {
            _maxValue = maxValue + 1;
        }
        else
        {
            _maxValue = maxValue;
        }

        SetSize(sliderWidth, sliderHeight);
        GetMinMax();
        DefineSegments(MinValue, MaxValue);

        sliderContainer = HelperFunctions.GetPrefab2d("Prefabs/Others/SliderContainer", gameObject);
        valueContainer  = HelperFunctions.GetPrefab2d("Prefabs/Others/ValueContainer", gameObject);

        SetAnchoredPosition(sliderContainer, Vector3.zero);

        if (!string.IsNullOrEmpty(innerBarDirectory))
        {
            // Add bar for the min and max sliders.
            // Height should be the same as the height in SetSize!
            innerBar = CreateInnerBar(width: 0, height: 20, innerBarDirectory: innerBarDirectory);
        }

        Vector3 sliderKnobScale = new Vector3(0.5f, 0.5f, 0.5f);

        _rangeSliderObject = SpawnSliderObjects(innerMinValue, innerMaxValue, knobDirectory, initialHexColor, changedHexColor, sliderKnobScale);

        _leftSlider = _rangeSliderObject.slider1.GetComponent <SliderKnob>();
        _leftSlider.OnValueChanged += onMinValueChanged;
        if (hasTwoSliders)
        {
            _rightSlider = _rangeSliderObject.slider2.GetComponent <SliderKnob>();
            _rightSlider.OnValueChanged += onMaxValueChanged;
        }

        _valueContainerSpacing  = 165;
        _valueContainerFontSize = 45;
    }
        /// <summary>
        ///
        /// </summary>
        /// <param name="targetType"></param>
        public SleepSliderView(TargetType targetType)
        {
            SetBinding(ContentView.BackgroundColorProperty, new Binding("BackgroundColor"));
            BindingContext = new
            {
                BackgroundColor = StyledBackground
            };

            TargetType = targetType;

            RangeSlider = new RangeSlider();

            RangeSlider.SetBinding(RangeSlider.BackgroundColorProperty, new Binding("BackgroundColor"));
            RangeSlider.SetBinding(RangeSlider.TextColorProperty, new Binding("TextColor"));
            RangeSlider.BindingContext = new
            {
                BackgroundColor = StyledBackground,
                TextColor       = StyledText
            };

            RangeSlider.MinimumValue        = 0;
            RangeSlider.LowerValue          = DefaultStart;
            RangeSlider.MaximumValue        = 1440;
            RangeSlider.UpperValue          = DefaultStart + DefaultSpan;
            RangeSlider.StepValue           = 1;
            RangeSlider.VerticalOptions     = LayoutOptions.Center;
            RangeSlider.TextSize            = Device.GetNamedSize(NamedSize.Default, typeof(Label));
            RangeSlider.FormatLabel         = ViewTools.FormatDateLabel;
            RangeSlider.ShowTextAboveThumbs = true;

            Content = new StackLayout()
            {
                Spacing         = 0,
                Padding         = new Thickness(10, 0, 0, 0),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    RangeSlider
                }
            };
        }
Beispiel #22
0
        private static void OnRangeSliderPreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (sender is RangeSlider rangeSlider && (rangeSlider.IsFocused || MouseWheelState.MouseHover.Equals(rangeSlider.GetValue(EnableMouseWheelProperty))))
            {
                var changeType = (MouseWheelChange)rangeSlider.GetValue(ChangeValueByProperty);
                var difference = changeType == MouseWheelChange.LargeChange ? rangeSlider.LargeChange : rangeSlider.SmallChange;

                if (e.Delta > 0)
                {
                    rangeSlider.SetCurrentValue(RangeSlider.UpperValueProperty, RangeSlider.CoerceUpperValue(rangeSlider, rangeSlider.UpperValue + difference));
                    rangeSlider.SetCurrentValue(RangeSlider.LowerValueProperty, RangeSlider.CoerceLowerValue(rangeSlider, rangeSlider.LowerValue + difference));
                }
                else
                {
                    rangeSlider.SetCurrentValue(RangeSlider.LowerValueProperty, RangeSlider.CoerceLowerValue(rangeSlider, rangeSlider.LowerValue - difference));
                    rangeSlider.SetCurrentValue(RangeSlider.UpperValueProperty, RangeSlider.CoerceUpperValue(rangeSlider, rangeSlider.UpperValue - difference));
                }

                e.Handled = true;
            }
        }
Beispiel #23
0
        public static RangeSlider <T> CreateRangeSlider <T>(IRangeSliderHtmlBuilder builder, ViewContext viewContext) where T : struct, IComparable
        {
            builder = builder ?? new Mock <IRangeSliderHtmlBuilder>().Object;

            var httpContext = TestHelper.CreateMockedHttpContext();

            httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny <TextWriter>())).Returns(new HtmlTextWriter(TextWriter.Null));

            var builderFactory = new Mock <IRangeSliderHtmlBuilderFactory>();

            builderFactory.Setup(f => f.Create(It.IsAny <RangeSliderRenderingData>())).Returns(builder);

            var writerFactory = new Mock <IClientSideObjectWriterFactory>();
            var objectWriter  = new Mock <IClientSideObjectWriter>();

            viewContext = viewContext ?? TestHelper.CreateViewContext();
            writerFactory.Setup(c => c.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <TextWriter>())).Returns(objectWriter.Object);

            var component = new RangeSlider <T>(viewContext, writerFactory.Object, builderFactory.Object);

            return(component);
        }
Beispiel #24
0
        public pRangeSlider(string InstanceName)
        {
            //Set Element info setup
            Element      = new Grid();
            Element.Name = InstanceName;

            Slide  = new RangeSlider();
            BlockA = new TextBox();
            BlockB = new TextBox();

            Type = "RangeSlider";

            //Set "Clear" appearance to all elements
            Element.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            Slide.ExtendedMode = true;

            BlockA.Background      = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            BlockA.BorderBrush     = new SolidColorBrush(Color.FromArgb(255, 200, 200, 200));
            BlockA.BorderThickness = new Thickness(0);

            BlockB.Background      = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            BlockB.BorderBrush     = new SolidColorBrush(Color.FromArgb(255, 200, 200, 200));
            BlockB.BorderThickness = new Thickness(0);
        }
Beispiel #25
0
 public RangeSliderHtmlBuilder(RangeSlider <T> component)
 {
     Component = component;
 }
Beispiel #26
0
 /// <summary>Initializes a new instance of the <see cref="RangeSliderBuilder{T}"/>class.</summary>
 /// <param name="component">The component.</param>
 public RangeSliderBuilder(RangeSlider <T> component)
     : base(component)
 {
 }
Beispiel #27
0
        private StackLayout MakeContent()
        {
            StackLayout mainLayout = new StackLayout()
            {
                BackgroundColor   = Color.White,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center
            };

            StackLayout innerLayout = new StackLayout()
            {
                Padding           = new Thickness(30),
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Orientation       = StackOrientation.Vertical,
                Spacing           = 20
            };

            innerLayout.Children.Add(new Label()
            {
                Text = "Les catégories:", FontSize = 20, TextColor = Color.Black, FontAttributes = FontAttributes.Bold
            });

            StackLayout categoriesLayout = new StackLayout()
            {
                Spacing = 5
            };

            foreach (var category in categories)
            {
                StackLayout categoryLayout = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, Spacing = 20, Padding = new Thickness(20, 0, 0, 0)
                };
                Switch categorySwitch = new Switch()
                {
                    ClassId = category.ID.ToString(),
                };
                categorySwitch.IsToggled = selectedCategories.Any(sc => sc.CategoryName == category.CategoryName);
                categorySwitch.Toggled  += CategorySwitch_Toggled;
                categoryLayout.Children.Add(categorySwitch);
                categoryLayout.Children.Add(new Label()
                {
                    Text = category.CategoryName, FontSize = 18, TextColor = Color.Black, VerticalTextAlignment = TextAlignment.Center
                });

                categoriesLayout.Children.Add(categoryLayout);
            }
            innerLayout.Children.Add(categoriesLayout);
            innerLayout.Children.Add(new Label()
            {
                Text = "Range de prix:", FontSize = 20, TextColor = Color.Black, FontAttributes = FontAttributes.Bold
            });
            RangeSlider priceRangeSlider = new RangeSlider()
            {
                MinimumValue = (float)(maxPriceRange.MinPriceRange), MaximumValue = (float)maxPriceRange.MaxPriceRange, StepValue = 0, LowerValue = (float)(selectedpriceRange.MinPriceRange), UpperValue = (float)selectedpriceRange.MaxPriceRange, ShowTextAboveThumbs = true, TextSize = 20, FormatLabel = FormaLabel
            };

            priceRangeSlider.DragCompleted += PriceRangeSlider_DragCompleted;
            StackLayout priceRangeLayout = new StackLayout()
            {
                Padding = new Thickness(20, 0, 0, 0)
            };

            priceRangeLayout.Children.Add(priceRangeSlider);
            innerLayout.Children.Add(priceRangeLayout);
            Label aplyLabel = new Label()
            {
                Text = "Appliquer", TextColor = Color.DodgerBlue, FontSize = 20, HorizontalOptions = LayoutOptions.End
            };
            TapGestureRecognizer aplyGestureRecognizer = new TapGestureRecognizer();

            aplyGestureRecognizer.Tapped += AplyGestureRecognizer_Tapped;
            aplyLabel.GestureRecognizers.Add(aplyGestureRecognizer);
            innerLayout.Children.Add(aplyLabel);
            mainLayout.Children.Add(innerLayout);

            return(mainLayout);
        }
 public void SetUp()
 {
     _slider         = new RangeSlider();
     _slider.Minimum = 0d;
     _slider.Maximum = 1d;
 }
 public RangeSliderBuilderTests()
 {
     component = SliderTestHelper.CreateRangeSlider <int>(null, null);
     builder   = new RangeSliderBuilder <int>(component);
 }
        private FrameworkElement OnGeneratingControl(Controllable control, ControlItem item)
        {
            FrameworkElement result = null;

            GeneratingControl?.Invoke(this, control, item, ref result);
            if (result != null)
            {
                return(result);
            }
            if (item.Type == ControlItem.PropType.Enum)
            {
                var cbox = new ComboBox
                {
                    ItemsSource = item.Cookie as string[]
                };
                cbox.SetBinding(ComboBox.SelectedItemProperty, CreateControlItemBinding(control, item));
                return(cbox);
            }
            if (item.ValType == typeof(string))
            {
                if (item.Type == ControlItem.PropType.LongText)
                {
                    var btn = new Button {
                        Content = "查看"
                    };
                    btn.Click += (o, e) =>
                    {
                        control.DoGetMember(item.Id, out object txt);
                        new TextDialog(txt as string, $"{control.ToString()} --- {item.Name}").Show();
                        e.Handled = true;
                    };
                    return(btn);
                }
                {
                    var tbox = new TextBox
                    {
                        VerticalAlignment = VerticalAlignment.Center
                    };
                    tbox.SetBinding(TextBox.TextProperty, CreateControlItemBinding(control, item));
                    tbox.IsReadOnly = !item.Access.HasFlag(ControlItem.PropAccess.Write);
                    return(tbox);
                }
            }
            if (item.ValType == typeof(Vector2))
            {
                var limit  = (Vector2)item.Cookie;
                var slider = new RangeSlider
                {
                    AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                    AutoToolTipPrecision = 3,
                    Minimum = limit.X,
                    Maximum = limit.Y
                };
                slider.SetBinding(RangeSlider.LowerValueProperty,
                                  CreateControlItemBinding(control, item, new TwoWayValueConvertor(
                                                               o => ((Vector2)o).X,
                                                               o => new Vector2(Convert.ToSingle(o), (float)slider.HigherValue))
                                                           ));
                slider.SetBinding(RangeSlider.HigherValueProperty,
                                  CreateControlItemBinding(control, item, new TwoWayValueConvertor(
                                                               o => ((Vector2)o).Y,
                                                               o => new Vector2((float)slider.LowerValue, Convert.ToSingle(o)))
                                                           ));
                return(slider);
            }
            if (item.ValType == typeof(Color))
            {
                var clrPicker = new ColorPicker()
                {
                    ColorMode = ColorMode.ColorCanvas
                };
                clrPicker.SetBinding(ColorPicker.SelectedColorProperty, CreateControlItemBinding(control, item));
                return(clrPicker);
            }
            if (item.ValType == typeof(float))
            {
                if (item.Cookie == null)
                {
                    var spiner = new DoubleUpDown {
                        FormatString = "F2", Increment = 0.1
                    };
                    spiner.SetBinding(DoubleUpDown.ValueProperty, CreateControlItemBinding(control, item, ConvertorForceSingle));
                    return(spiner);
                }
                else
                {
                    var limit  = (Vector2)item.Cookie;
                    var slider = new Slider
                    {
                        AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                        AutoToolTipPrecision = 3,
                        Minimum = limit.X,
                        Maximum = limit.Y
                    };
                    slider.SetBinding(Slider.ValueProperty, CreateControlItemBinding(control, item, ConvertorForceSingle));
                    return(slider);
                }
            }
            if (item.ValType == typeof(ushort))
            {
                if (item.Cookie == null)
                {
                    var spiner = new IntegerUpDown {
                        Increment = 1
                    };
                    spiner.SetBinding(IntegerUpDown.ValueProperty, CreateControlItemBinding(control, item, ConvertorForceUShort));
                    return(spiner);
                }
                else
                {
                    dynamic limit  = item.Cookie;
                    var     slider = new Slider
                    {
                        AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                        Minimum = limit.Item1,
                        Maximum = limit.Item2
                    };
                    slider.SetBinding(Slider.ValueProperty, CreateControlItemBinding(control, item, ConvertorForceUShort));
                    return(slider);
                }
            }
            if (item.ValType == typeof(int))
            {
                if (item.Cookie == null)
                {
                    var spiner = new IntegerUpDown {
                        Increment = 1
                    };
                    spiner.SetBinding(IntegerUpDown.ValueProperty, CreateControlItemBinding(control, item));
                    return(spiner);
                }
                else
                {
                    dynamic limit  = item.Cookie;
                    var     slider = new Slider
                    {
                        AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                        Minimum = limit.Item1,
                        Maximum = limit.Item2
                    };
                    slider.SetBinding(Slider.ValueProperty, CreateControlItemBinding(control, item, ConvertorForceInt));
                    return(slider);
                }
            }
            if (item.ValType == typeof(bool))
            {
                var ckBox = new CheckBox
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                ckBox.SetBinding(CheckBox.IsCheckedProperty, CreateControlItemBinding(control, item));
                return(ckBox);
            }
            {
                var tblock = new TextBlock
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                tblock.SetBinding(TextBlock.TextProperty, CreateControlItemBinding(control, item));
                return(tblock);
            }
        }
Beispiel #31
0
 // Start is called before the first frame update
 void Start()
 {
     timeSpan = gameObject.GetComponent <RangeSlider>();
 }
 internal RangeSelectionChangedEventArgs(RangeSlider slider)
     : this(slider.RangeStartSelected, slider.RangeStopSelected)
 {
 }
    void Start()
    {
        ftrack.eid         = new KeyValuePair <int, int>(132974, 67924813);
        ftrack.frc         = new trackData();
        ftrack.frc.azi_rad = 3.00769365471949f;
        ftrack.frc.dec_rad = 0.016708671281222f;
        ftrack.frc.mjd     = 58714.7322249641;
        ftrack.frc.ra_rad  = 2.59716876080088;
        ftrack.frc.rec_t0  = 10983.2956250753f;
        ftrack.frc.rec_x   = -83.0575967774025f;
        ftrack.frc.rec_y   = 93.7020767723102f;
        ftrack.frc.rec_z   = -46.6655356299309f;
        ftrack.frc.zen_rad = 1.5858330048395f;



        curEvent = new List <eventData>();
        GameObject timeCon = GameObject.Find("timeController");

        if (timeCon != null)
        {
            timeController     = timeCon.GetComponent <Slider>();
            playbackController = timeCon.GetComponent <TimeSlider>();
            if (playbackController != null)
            {
                playbackController.OnStartPlaying.AddListener(delegate { StartedPlaying(); });
                playbackController.OnStopPlaying.AddListener(delegate { StoppedPlaying(); });
            }
        }
        GameObject gapCon = GameObject.Find("deltaController");

        if (gapCon != null)
        {
            deltaController = gapCon.GetComponent <Slider>();
        }
        if (timeController != null)
        {
            timeController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        if (deltaController != null)
        {
            deltaController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        GameObject tspn = GameObject.Find("timeSpan");

        if (tspn != null)
        {
            timeSpan = tspn.GetComponent <RangeSlider>();
            if (timeSpan != null)
            {
                timeSpan.onValueChanged.AddListener(delegate { ValueChange(); });
            }
        }
        GameObject zCon = GameObject.Find("zoomController");

        if (zCon != null)
        {
            zoomControl = zCon.GetComponent <Slider>();
            if (zoomControl != null)
            {
                zoomControl.onValueChanged.AddListener(delegate { zoomChange(); });
            }
        }
        GameObject hCon = GameObject.Find("hairController");

        if (hCon != null)
        {
            hairControl = hCon.GetComponent <Slider>();
            hairCover   = hCon.transform.parent.gameObject;
            if (hairControl != null)
            {
                hairControl.onValueChanged.AddListener(delegate { hairChange(); });
                hairChange();
            }
        }

        GameObject tCon = GameObject.Find("towerToggle");

        if (tCon != null)
        {
            towerControl = tCon.GetComponent <Toggle>();
            if (towerControl != null)
            {
                towerControl.onValueChanged.AddListener(delegate { towerChange(); });
            }
        }
        GameObject czCon = GameObject.Find("zillaToggle");

        if (czCon != null)
        {
            czillaControl = czCon.GetComponent <Toggle>();
            if (czillaControl != null)
            {
                czillaControl.onValueChanged.AddListener(delegate { czillaChange(); });
            }
        }
        foreach (singleBallList lst in ballArray)
        {
            foreach (singleBall bl in lst.balls)
            {
                if (bl != null)
                {
                    bl.setColor(new Color(0.9f, 0.9f, 0.9f));
                    bl.setScale(baseScale);
                }
            }
        }

        bank = new PatchBank(bankSource);
        if (bank == null)
        {
            Debug.LogFormat("Couldn't load music bank: {0}", bankSource);
        }
        else
        {
            int     maxPatch = 0;
            Patch[] arr      = bank.GetBank(0);
            while (maxPatch < arr.Length)
            {
                if (arr[maxPatch] == null)
                {
                    break;
                }
                maxPatch++;
            }
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (stringArray[i] != null)
                {
                    //Debug.Log(ballArray[i].balls.Length);
                    stringArray[i].SetupWithBank(bank, i, maxPatch, 20, 85, ballArray[i + 1].balls.Length, stringArray.Length);
                }
            }
        }
        // size = scale * ( 0.2 * accum ) ** power
        updateToSet(true);
        updateTrackRot();
    }
 public RangeSliderBuilderTests()
 {
     component = SliderTestHelper.CreateRangeSlider<int>(null, null);
     builder = new RangeSliderBuilder<int>(component);
 }