Inheritance: Windows.UI.Xaml.Controls.Primitives.RangeBase, ISlider
        /// <summary>
        /// Ctor
        /// </summary>
        public LoopItemsPanel()
        {
            orientation = Orientation.Vertical;
            this.ManipulationMode = this.Orientation == Orientation.Vertical
                ? (ManipulationModes.TranslateY | ManipulationModes.TranslateInertia)
                : (ManipulationModes.TranslateX | ManipulationModes.TranslateInertia);
            this.IsHitTestVisible = true;
            this.ManipulationDelta += OnManipulationDelta;
            this.ManipulationCompleted += OnManipulationCompleted;
            this.Tapped += OnTapped;
            this.Loaded += OnLoaded;

            this.internalSlider = new Slider
            {
                SmallChange = 0.0000000001,
                Minimum = double.MinValue,
                Maximum = double.MaxValue,
                StepFrequency = 0.0000000001,
                Orientation = this.Orientation
            };
            internalSlider.ValueChanged += OnOffsetChanged;

            this.CreateStoryboard();
            this.LayoutUpdated += OnLayoutUpdated;
        }
 public PlaybackControl(Grid grid)
 {
     PlaybackControlGrid = grid;
     PlayPauseButton = PlaybackControlGrid.FindName("PlayPauseButtonOnLeft") as AppBarButton;
     ShuffleButton = PlaybackControlGrid.FindName("ShuffleButton") as AppBarButton;
     AlbumArtwork = PlaybackControlGrid.FindName("PlayBackImage") as Image;
     TimeRemainingBlock = PlaybackControlGrid.FindName("TimeRemainingBlock") as TextBlock;
     TimePastBlock = PlaybackControlGrid.FindName("TimeElapsedBlock") as TextBlock;
     ProgressSlider = PlaybackControlGrid.FindName("ProgressSlider") as Slider;
 }
 public LoopingItemsPanel()
 {
     ManipulationMode = ManipulationModes.TranslateX;
     SizeChanged += OnSizeChanged;
     _animationSlider = new Slider
     {
         SmallChange = 0.0000000001,
         Minimum = double.MinValue,
         Maximum = double.MaxValue,
         StepFrequency = 0.0000000001
     };
     _animationSlider.ValueChanged += OnAnimationOffsetChanged;
 }
        public LoopItemsPanel()
        {
            this.ManipulationDelta += OnManipulationDelta;
            this.ManipulationCompleted += LoopItemsPanel_ManipulationCompleted;
            this.Loaded += LoopItemsPanel_Loaded;
            this.Tapped += OnTapped;

            sliderVertical = new Slider
            {
                SmallChange = 0.0000000001,
                Minimum = double.MinValue,
                Maximum = double.MaxValue,
                StepFrequency = 0.0000000001
            };
            sliderVertical.ValueChanged += OnVerticalOffsetChanged;
        }
Esempio n. 5
0
        protected override void OnApplyTemplate()
        {
            this._prevButton = GetTemplateChild(PREV_BUTTON_PARTNAME) as Button;

            if (this._prevButton != null)
            {
                this._prevButton.Click += (_s, _e) =>
                {
                    if (this._scrollViewer == null) { return; }
                    int newPageIndex = this.PageIndex - 1;
                    if (newPageIndex > 0){
                        this.ScrollToPageIndex(newPageIndex, isAnimation: true);
                    }
                };
            }

            this._nextButton = GetTemplateChild(NEXT_BUTTON_PARTNAME) as Button;
            if (this._nextButton != null)
            {
                this._nextButton.Click += (_s, _e) =>
                {
                    if (this._scrollViewer == null) { return; }
                    int newPageIndex = this.PageIndex + 1;
                    if (newPageIndex <= this.NumPages)
                    {
                        this.ScrollToPageIndex(newPageIndex, isAnimation: true);
                    }
                };
            }

            this._slider = GetTemplateChild(SLIDER_PARTNAME) as Slider;
            if (this._slider != null)
            {
                this._slider.ValueChanged += (_s, _e) =>
                {
                    if (this._slider == null || (
                            this.NumPages == this._slider.Maximum &&
                            this.PageIndex == this._slider.Value))
                    {
                        return;
                    }
                    this.ScrollToPageIndex((int)this._slider.Value, isAnimation:false);
                };
            }
            
            base.OnApplyTemplate();
        }
 private void InitializeVideoParamterControl(MediaDeviceControl videoDeviceControl, Slider slider)
 {
     if (videoDeviceControl != null && (videoDeviceControl.Capabilities).Supported)
     {
         slider.IsEnabled = true;
         slider.Maximum = videoDeviceControl.Capabilities.Max;
         slider.Minimum = videoDeviceControl.Capabilities.Min;
         slider.StepFrequency = videoDeviceControl.Capabilities.Step;
         double currentValue;
         if (videoDeviceControl.TryGetValue(out currentValue))
         {
             slider.Value = currentValue;
         }
     }
     else
     {
         slider.IsEnabled = false;
     }
 }
Esempio n. 7
0
        public LoopItemsPanel()
        {
            ManipulationMode = (ManipulationModes.TranslateX | ManipulationModes.TranslateInertia);
            ManipulationDelta += OnManipulationDelta;
            ManipulationCompleted += OnManipulationCompleted;
            Tapped += OnTapped;            
            _sliderHorizontal = new Slider
            {
                SmallChange = 0.0000000001,
                Minimum = double.MinValue,
                Maximum = double.MaxValue,
                StepFrequency = 0.0000000001
            };
            _sliderHorizontal.ValueChanged += OnHorizontalOffsetChanged;

            var waitingTimer = new DispatcherTimer {Interval = new TimeSpan(0, 0, 1)};
            waitingTimer.Tick += WaitingTimerOnTick;
            waitingTimer.Start();
            
        }       
 private void sliderSum_Loaded(object sender, RoutedEventArgs e)
 {
     sliderSum = sender as Slider;
 }
        public void Detach()
        {
            _scrollViewer = null;

            if (_sliderHorizontal != null)
            {
                _sliderHorizontal.ValueChanged -= OnHorizontalOffsetChanged;
                _sliderHorizontal = null;
            }

            if (_sliderVertical != null)
            {
                _sliderVertical.ValueChanged -= OnHorizontalOffsetChanged;
                _sliderVertical = null;
            }
        }
 public void Attach(ScrollViewer scrollViewer)
 {
     _scrollViewer = scrollViewer;
     _sliderHorizontal = new Slider();
     _sliderHorizontal.SmallChange = 0.0000000001;
     _sliderHorizontal.Minimum = double.MinValue;
     _sliderHorizontal.Maximum = double.MaxValue;
     _sliderHorizontal.StepFrequency = 0.0000000001;
     _sliderHorizontal.ValueChanged += OnHorizontalOffsetChanged;
     _sliderVertical = new Slider();
     _sliderVertical.SmallChange = 0.0000000001;
     _sliderVertical.Minimum = double.MinValue;
     _sliderVertical.Maximum = double.MaxValue;
     _sliderVertical.StepFrequency = 0.0000000001;
     _sliderVertical.ValueChanged += OnVerticalOffsetChanged;
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e) {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.
            DevicesListView.Items.Clear();
            if (e.Parameter != null) {
                try {
                    Room room = (Room)e.Parameter;
                    RoomTextBlock.Text = "Room " + room.Name;
                    Rect.Fill = new SolidColorBrush(Color.FromArgb(15,15,23,0));

                    if (App.connected) {

                        App.proxy.Invoke<String>("getDevices",room.ID).ContinueWith(async task => {
                            String result = task.Result;
                            ICollection<Models.Device> devices = JsonConvert.DeserializeObject<ICollection<Models.Device>>(result);
                            App.devices = devices;
                            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => {
                                
                                if (App.devices != null) {
                                    
                                    ChooseAnotherTextBlock.Visibility = Visibility.Visible;
                                    foreach (Device b in App.devices) {

                                        switch (b.DeviceType){
                                            case DeviceType.DIMMER:
                                                Slider slider = new Slider();
                                                slider.MinWidth = 280;
                                                slider.Margin = new Thickness(10, 0, 10, 0);
                                                slider.Header = b.Name;
                                                slider.Minimum = 0;
                                                slider.Maximum = 255;
                                                ControlTag tag = new ControlTag();
                                                tag.deviceID = b.ID;
                                                tag.changing = false;
                                                slider.Tag = tag;
                                                slider.ValueChanged += slider_ValueChanged;
                                                slider.PointerCaptureLost += slider_PointerCaptureLost;
                                                DevicesListView.Items.Add(slider);
                                                App.proxy.Invoke<int>("getDeviceValue", b.ID).ContinueWith(async task2 => {
                                                    int value = task2.Result;
                                                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                                                        slider.Value = value;
                                                        ((ControlTag)slider.Tag).lastValue = value;
                                                    });
                                                });
                                                break;
                                            case DeviceType.POWER_SWITCH:
                                                ToggleSwitch newSwitch = new ToggleSwitch();
                                                newSwitch.Header = b.Name;
                                                newSwitch.MinWidth = 280;
                                                tag = new ControlTag();
                                                tag.deviceID = b.ID;
                                                tag.changing = false;
                                                newSwitch.Tag = tag;
                                                newSwitch.Toggled += newSwitch_Toggled;
                                                DevicesListView.Items.Add(newSwitch);
                                                App.proxy.Invoke<int>("getDeviceValue", b.ID).ContinueWith(async task2 => {
                                                    int value = task2.Result;
                                                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                                                        if (value == 0) {
                                                            newSwitch.IsOn = false;
                                                        } else {
                                                            newSwitch.IsOn = true;
                                                        }
                                                    });
                                                });
                                                break;
                                            case DeviceType.THERMOMETER:
                                                TextBlock NameTextBlock = new TextBlock();
                                                NameTextBlock.FontSize = 24;
                                                NameTextBlock.Text = b.Name;
                                                tag = new ControlTag();
                                                tag.deviceID = -1;
                                                tag.changing = false;
                                                NameTextBlock.Tag = tag;
                                                TextBlock tempTextBlock = new TextBlock();
                                                tempTextBlock.FontSize = 20;
                                                tempTextBlock.Text = "0";
                                                tempTextBlock.MinWidth = 300;
                                                tempTextBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
                                                tempTextBlock.TextAlignment = TextAlignment.Center;
                                                tag = new ControlTag();
                                                tag.deviceID = b.ID;
                                                tag.changing = false;
                                                tempTextBlock.Tag = tag;
                                                DevicesListView.Items.Add(NameTextBlock);
                                                DevicesListView.Items.Add(tempTextBlock);
                                                App.proxy.Invoke<int>("getDeviceValue", b.ID).ContinueWith(async task2 => {
                                                    int value = task2.Result;
                                                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
                                                        tempTextBlock.Text = value.ToString();
                                                    });
                                                });
                                                break;
                                        }
                                    }
                                }
                                if (App.devices == null || App.devices.Count == 0) {
                                    TextBlock textBlock2 = new TextBlock();
                                    textBlock2.FontSize = 24;
                                    textBlock2.Text = "It's empty here";
                                    DevicesListView.IsEnabled = false;
                                    DevicesListView.Items.Add(textBlock2);
                                }
                            });
                        });

                    }
                    ChooseRoomLabel.Visibility = Visibility.Collapsed;
                } catch (InvalidCastException) {
                    ChooseRoomLabel.Visibility = Visibility.Visible;
                    RoomTextBlock.Text = "";
                    ChooseAnotherTextBlock.Visibility = Visibility.Collapsed;
                    Rect.Fill = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

                }

            } else {
                Rect.Fill = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));

                ChooseRoomLabel.Visibility = Visibility.Visible;
                RoomTextBlock.Text = "";
                ChooseAnotherTextBlock.Visibility = Visibility.Collapsed;
            }

        }
        /// <summary>
        /// Adds the necessary analog controls to a StackPanel created for the PWM page. This will only be called on navigation from the Connections page.
        /// </summary>
        private void loadPWMControls()
        {
            //add controls and value sliders for each pwm pin the board supports
            for (byte i = 0; i < numberOfPwmPins; ++i)
            {
                // Container stack to hold all pieces of new row of pins.
                var containerStack = new StackPanel();
                containerStack.Orientation = Orientation.Horizontal;
                containerStack.FlowDirection = FlowDirection.LeftToRight;
                containerStack.HorizontalAlignment = HorizontalAlignment.Stretch;
                containerStack.Margin = new Thickness(8, 0, 0, 20);

                // Set up the pin text.
                var textStack = new StackPanel();
                textStack.Orientation = Orientation.Vertical;
                textStack.FlowDirection = FlowDirection.LeftToRight;
                textStack.HorizontalAlignment = HorizontalAlignment.Stretch;

                var text = new TextBlock();
                text.HorizontalAlignment = HorizontalAlignment.Stretch;
                text.VerticalAlignment = VerticalAlignment.Center;
                text.Margin = new Thickness(0, 0, 0, 0);
                text.Text = "Pin " + pwmPins[i];
                text.FontSize = 14;
                text.FontWeight = FontWeights.SemiBold;

                var text2 = new TextBlock();
                text2.HorizontalAlignment = HorizontalAlignment.Stretch;
                text2.VerticalAlignment = VerticalAlignment.Center;
                text2.Margin = new Thickness(0, 0, 0, 0);
                text2.Text = "PWM";
                text2.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 106, 107, 106));
                text2.FontSize = 14;
                text2.FontWeight = FontWeights.SemiBold;

                textStack.Children.Add(text);
                textStack.Children.Add(text2);
                containerStack.Children.Add(textStack);

                // Set up the mode toggle button.
                var modeStack = new StackPanel();
                modeStack.Orientation = Orientation.Horizontal;
                modeStack.FlowDirection = FlowDirection.LeftToRight;
                modeStack.HorizontalAlignment = HorizontalAlignment.Stretch;
                modeStack.Margin = new Thickness(88, 0, 0, 0);

                var toggleSwitch = new ToggleSwitch();
                toggleSwitch.HorizontalAlignment = HorizontalAlignment.Left;
                toggleSwitch.VerticalAlignment = VerticalAlignment.Center;
                if (pwmPins[i] == 10 || pwmPins[i] == 13) { toggleSwitch.Margin = new Thickness(13, 0, 5, 0); }
                else { toggleSwitch.Margin = new Thickness(15, 0, 5, 0); }
                toggleSwitch.Name = "pwmmode_" + pwmPins[i];
                toggleSwitch.Toggled += OnClick_PwmModeToggleSwitch;

                var onContent = new TextBlock();
                onContent.Text = "Enabled";
                onContent.FontSize = 14;
                toggleSwitch.OnContent = onContent;
                var offContent = new TextBlock();
                offContent.Text = "Disabled";
                offContent.FontSize = 14;
                toggleSwitch.OffContent = offContent;
                pwmModeToggleSwitches.Add(pwmPins[i], toggleSwitch);

                modeStack.Children.Add(toggleSwitch);
                containerStack.Children.Add(modeStack);

                //set up the value change slider
                var slider = new Slider();
                slider.Visibility = Visibility.Collapsed;
                slider.Orientation = Orientation.Horizontal;
                slider.HorizontalAlignment = HorizontalAlignment.Stretch;
                slider.SmallChange = 32;
                slider.StepFrequency = 32;
                slider.TickFrequency = 32;
                slider.ValueChanged += OnValueChanged_PwmSlider;
                slider.PointerReleased += OnPointerReleased_PwmSlider;
                slider.Minimum = 0;
                slider.Maximum = 255;
                slider.Name = "pwmslider_" + pwmPins[i];
                slider.Width = 180;
                slider.Height = 34;
                slider.Margin = new Thickness(3, 0, 0, 0);
                pwmSliders.Add(pwmPins[i], slider);
                containerStack.Children.Add(slider);

                //set up the indication text
                var text3 = new TextBlock();
                text3.HorizontalAlignment = HorizontalAlignment.Stretch;
                text3.VerticalAlignment = VerticalAlignment.Center;
                text3.Margin = new Thickness(3, 0, 0, 0);
                text3.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 106, 107, 106));
                text3.Text = "Enable PWM to write values.";
                text3.FontSize = 14;
                text3.Name = "pwmtext_" + pwmPins[i];
                text3.Visibility = Visibility.Visible;
                pwmTextBlocks.Add(pwmPins[i], text3);
                containerStack.Children.Add(text3);

                PWMPins.Children.Add(containerStack);
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Changes current player position based on audio seeker slider value changes
 /// </summary>
 /// <param name="slider">Slider instance</param>
 public void UpdateProgressFromSlider(Slider slider)
 {
     if (MediaPlayer.CurrentState == Playing && slider != null)
     {
         var newPosition = slider.Value < 0 ? 0 : slider.Value;
         var totalSeconds = Math.Round(MediaPlayer.NaturalDuration.TotalSeconds) - 1;
         newPosition = newPosition > totalSeconds ? totalSeconds : newPosition;
         MediaPlayer.Position = TimeSpan.FromSeconds(newPosition);
         logger.LogMessage($"Foreground playback manager: Player position updated to {newPosition} seconds.");
     }
 }
Esempio n. 14
0
 private async void VolumeSlider_Loaded(object sender, RoutedEventArgs e)
 {
     int volume = await Applikation.GetVolume();
     SetVolumeSliderValue(volume);
     slider = sender as Slider;
     slider.AddHandler(UIElement.PointerReleasedEvent, new PointerEventHandler(slider_PointerReleased), true);
 }
 internal override void CleanupAnimation(DependencyObject target, Storyboard animation)
 {
     base.CleanupAnimation(target, animation);
     _slider.ValueChanged -= OnSliderValueChanged;
     _slider = null;
     _fe = null;
 }
 private void sliderIncome_Loaded(object sender, RoutedEventArgs e)
 {
     sliderIncome = sender as Slider;
 }
Esempio n. 17
0
        public CropControl()
        {
            m_image = new Image();
            m_image.Stretch = Stretch.Uniform;
            m_image.SizeChanged += Image_SizeChanged;
            Children.Add(m_image);

            m_leftBorder = new Border();
            m_leftBorder.Clip = new RectangleGeometry();
            Children.Add(m_leftBorder);

            m_rightBorder = new Border();
            m_rightBorder.Clip = new RectangleGeometry();
            Children.Add(m_rightBorder);

            m_topBorder = new Border();
            m_topBorder.Clip = new RectangleGeometry();
            Children.Add(m_topBorder);

            m_bottomBorder = new Border();
            m_bottomBorder.Clip = new RectangleGeometry();
            Children.Add(m_bottomBorder);

            m_imageBorder = new Border();
            m_imageBorder.BorderThickness = new Thickness(2);
            m_imageBorder.BorderBrush = new SolidColorBrush(Color.FromArgb(0x33, 0xff, 0xff, 0xff));
            Children.Add(m_imageBorder);

            var stackPanel = new StackPanel();
            stackPanel.Margin = new Thickness(12);
            stackPanel.VerticalAlignment = VerticalAlignment.Bottom;
            stackPanel.HorizontalAlignment = HorizontalAlignment.Left;
            stackPanel.Orientation = Orientation.Horizontal;
            Children.Add(stackPanel);

            var textBlock = new TextBlock();
            textBlock.FontFamily = new FontFamily("Segoe MDL2 Assets");
            textBlock.FontSize = 34;
            textBlock.Margin = new Thickness(0, 0, 10, 0);
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            textBlock.Text = "\ue1a4";
            stackPanel.Children.Add(textBlock);

            m_zoomSlider = new Slider();
            m_zoomSlider.Maximum = 1;
            //m_zoomSlider.Margin = new Thickness(12);
            m_zoomSlider.VerticalAlignment = VerticalAlignment.Center;
            //m_zoomSlider.HorizontalAlignment = HorizontalAlignment.Left;
            m_zoomSlider.Width = 300;
            m_zoomSlider.Value = 0;
            m_zoomSlider.ValueChanged += OnSliderValueChanged;
            m_zoomSlider.StepFrequency = 0.0001;
            stackPanel.Children.Add(m_zoomSlider);

            textBlock = new TextBlock();
            textBlock.FontFamily = new FontFamily("Segoe MDL2 Assets");
            textBlock.FontSize = 34;
            textBlock.Margin = new Thickness(10, 0, 0, 0);
            textBlock.VerticalAlignment = VerticalAlignment.Center;
            textBlock.Text = "\ue12e";
            stackPanel.Children.Add(textBlock);

            m_cropButton = new CircleButton();
            m_cropButton.Icon = "\ue123";
            m_cropButton.FontSize = 34;
            m_cropButton.Command = new Mvvm.Command(ExecuteCrop);
            m_cropButton.VerticalAlignment = VerticalAlignment.Bottom;
            m_cropButton.HorizontalAlignment = HorizontalAlignment.Right;
            m_cropButton.Margin = new Thickness(12);
            Children.Add(m_cropButton);

            SizeChanged += OnSizeChanged;
            PointerPressed += OnPointerPressed;
            PointerMoved += OnPointerMoved;
            PointerExited += OnPointerExited;
            PointerReleased += OnPointerReleased;

            Background = new SolidColorBrush(Colors.Black);
            Color = Color.FromArgb(0x33, 0xff, 0xff, 0xff);
        }
Esempio n. 18
0
        public ColorPicker(Slider s1, Slider s2, Slider s3, StackPanel p1, StackPanel p2, StackPanel pe, Rectangle hr, Rectangle or, Canvas c,
            Rectangle sr1, Rectangle sr2, Rectangle vr1, Rectangle vr2,
            MainPage p, Color canvasInitColor, Color panelInitColor, Color gridInitColor,
            double width, double height)
        {
            Slider1 = s1;
            Slider2 = s2;
            Slider3 = s3;
            Slider1.ValueChanged += Slider1_ValueChanged;
            Slider2.ValueChanged += Slider2_ValueChanged;
            Slider3.ValueChanged += Slider3_ValueChanged;
            HueRect = hr;
            OverlayRect = or;
            SatRectBlack = sr1;
            SatRectHue = sr2;
            ValRectWhite = vr1;
            ValRectHue = vr2;
            MPage = p;

            PickerCanvas = c;
            Circle = new Ellipse() {
                Width = 20,
                Height = 20,
                Stroke = new SolidColorBrush(Colors.Black)
            };
            PickerCanvas.Children.Add(Circle);

            PalRects = new PaletteRect[PaletteSize + ExtraSlots];
            for (int i = 0; i < PalRects.Length; i++)
            {
                Rectangle outer, inner;
                if (i < 8)
                {
                    inner = new Rectangle()
                    {
                        Width = 60,
                        Height = 60,
                        Fill = new SolidColorBrush() { }
                    };
                    outer = new Rectangle()
                    {
                        Width = 90,
                        Height = 90,
                        Fill = new SolidColorBrush() { }
                    };
                }
                else
                {
                    inner = new Rectangle()
                    {
                        Width = 20,
                        Height = 20,
                        Fill = new SolidColorBrush() { },
                        Stroke = new SolidColorBrush() { Color = Colors.Black },
                        StrokeThickness = 2
                    };
                    outer = new Rectangle()
                    {
                        Width = 30,
                        Height = 30,
                        Fill = new SolidColorBrush() { },
                        Stroke = new SolidColorBrush() { Color = Colors.Black },
                        StrokeThickness = 2
                    };
                }

                Grid g = new Grid() {
                    Margin = new Windows.UI.Xaml.Thickness() { Left = 5, Right = 5, Top = 5, Bottom = 5 } };
                g.Children.Add(outer);
                g.Children.Add(inner);
                if (i < 4) p1.Children.Add(g);
                else if (i < 8) p2.Children.Add(g);
                else pe.Children.Add(g);

                PalRects[i] = new PaletteRect(outer,inner,i,this);
                if (i < PaletteSize) PalRects[i].Color = Colors.White;
                else if (i == CanvasIndex) PalRects[i].Color = canvasInitColor;
                else if (i == PanelIndex) PalRects[i].Color = panelInitColor;
                else if (i == GridIndex) PalRects[i].Color = gridInitColor;
                PalRects[i].Unselect();
            }
            HueColor = Colors.White;
            ColorSelected(0);
            Random rnd = new Random();
            Slider1.Value = rnd.NextDouble()*360;
            Slider2.Value = 100;
            Slider3.Value = 100;
        }
Esempio n. 19
0
 private void ProgressSlider_Loaded(object sender, RoutedEventArgs e)
 {
     slider = sender as Slider;
     slider.AddHandler(UIElement.PointerReleasedEvent, new PointerEventHandler(slider_PointerReleased), true);
 }
Esempio n. 20
0
        /// <summary>${controls_NavControl_method_onApplyTemplate_D}</summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            rotateRingElement = GetTemplateChild("RotateRingElement") as FrameworkElement;
            transformRotateElement = GetTemplateChild("TransformRotateElement") as RotateTransform;

            panLeftElement = GetTemplateChild("PanLeftElement") as RepeatButton;
            panRightElement = GetTemplateChild("PanRightElement") as RepeatButton;
            panUpElement = GetTemplateChild("PanUpElement") as RepeatButton;
            panDownElement = GetTemplateChild("PanDownElement") as RepeatButton;
            viewEntireElement = GetTemplateChild("ViewEntireElement") as Button;


            zoomSliderElement = GetTemplateChild("ZoomSlider") as Slider;
            zoomInElement = GetTemplateChild("ZoomInElement") as RepeatButton;
            zoomOutElement = GetTemplateChild("ZoomOutElement") as RepeatButton;

            #region 上下左右
            if (this.panLeftElement != null)
            {
                this.panLeftElement.Click += (sender , args) =>
                           {
                               if (( this.Map != null ) && ( sender != null ))
                               {
                                   this.Map.Pan(-this.Map.ViewBounds.Width * Map.PanFactor , 0);
                               }
                           };
            }

            if (this.panRightElement != null)
            {
                this.panRightElement.Click += (sender , args) =>
                {
                    if (( this.Map != null ) && ( sender != null ))
                    {
                        this.Map.Pan(this.Map.ViewBounds.Width * this.Map.PanFactor , 0);
                    }
                };
            }
            if (this.panDownElement != null)
            {
                this.panDownElement.Click += (sender , args) =>
                {
                    if (( this.Map != null ) && ( sender != null ))
                    {
                        this.Map.Pan(0 , -this.Map.ViewBounds.Height * this.Map.PanFactor);
                    }
                };
            }

            if (this.panUpElement != null)
            {
                this.panUpElement.Click += (sender , args) =>
                {
                    if (( this.Map != null ) && ( sender != null ))
                    {
                        this.Map.Pan(0 , this.Map.ViewBounds.Height * this.Map.PanFactor);
                    }
                };
            }
            #endregion

            SetupZoom();

            if (zoomSliderElement != null)
            {
                zoomSliderElement.PointerEntered += zoomSliderElement_PointerEntered;
                zoomSliderElement.PointerExited += zoomSliderElement_PointerExited;
                zoomSliderElement.ValueChanged += ZoomSlider_ValueChanged;
            }
            if (zoomInElement != null)
            {
                zoomInElement.Click += new RoutedEventHandler(this.ZoomInButton_Click);
            }
            if (zoomOutElement != null)
            {
                zoomOutElement.Click += new RoutedEventHandler(this.ZoomOutButton_Click);
            }

            if (rotateRingElement != null && this.transformRotateElement != null)
            {
                rotateRingElement.PointerPressed += _rotateRingPointerPressed;
                rotateRingElement.PointerMoved += _rotateRingPointerMoved;
                rotateRingElement.PointerReleased += _rotateRingPointerReleased;
            }
            if (viewEntireElement != null)
            {
                viewEntireElement.Click += new RoutedEventHandler(this.ZoomViewEntire_Click);
            }

        }
Esempio n. 21
0
 public void SetPenThickness(Slider value)
 {
     strokeThickness = value;
 }
        private Slider CreateSlider(Sensor sensor, SensorData data)
        {
            Slider slider = new Slider();
            slider.Tag = String.Format("{0};{1};{2}",
                sensor.ownerNodeId,
                sensor.sensorId,
                data.dataType.ToString());

            slider.HorizontalAlignment = HorizontalAlignment.Stretch;
            slider.Margin = new Thickness(5, 0, 5, 0);

            slider.Maximum = 100;
            slider.Value = Int32.Parse(data.state);
            slider.ValueChanged += slider_ValueChanged;

            return slider;
        }
        protected override void ApplyTargetProperties(DependencyObject target, Storyboard animation)
        {
            _fe = (FrameworkElement)target;

            if (_fe.Clip == null)
            {
                _fe.Clip = new RectangleGeometry();
            }

            if (this.Mode == AnimationMode.Out)
            {
                _fe.Clip.Rect = new Rect(0, 0, _fe.ActualWidth, _fe.ActualHeight);
            }
            else
            {
                switch (this.Direction)
                {
                    case DirectionOfMotion.TopToBottom:
                        _fe.Clip.Rect = new Rect(0, 0, _fe.ActualWidth, 0);
                        break;
                    case DirectionOfMotion.BottomToTop:
                        _fe.Clip.Rect = new Rect(0, _fe.ActualHeight, _fe.ActualWidth, 0);
                        break;
                    case DirectionOfMotion.LeftToRight:
                        _fe.Clip.Rect = new Rect(0, 0, 0, _fe.ActualHeight);
                        break;
                    case DirectionOfMotion.RightToLeft:
                        _fe.Clip.Rect = new Rect(_fe.ActualHeight, 0, 0, _fe.ActualHeight);
                        break;
                }
            }

            var da = (DoubleAnimation)animation.Children[0];
            da.EnableDependentAnimation = true;

            // Slider is used as animation targets due to problems with custom property animation
            if (_slider == null)
            {
                _slider = new Slider();
                _slider.SmallChange = 0.0000000001;
                _slider.Minimum = double.MinValue;
                _slider.Maximum = double.MaxValue;
                _slider.StepFrequency = 0.0000000001;
                _slider.ValueChanged += OnSliderValueChanged;
            }

            Storyboard.SetTarget(animation, _slider);
            Storyboard.SetTargetProperty(da, "Value");

            da.From = 0;
            da.To = 1.0;
        }
        private List<Slider> CreateRGBWSliders(Sensor sensor, SensorData data)
        {
            List<Slider> list = new List<Slider>();

            int[] rgbw = ColorUtils.ConvertRGBWHexStringToIntArray(data.state);

            for (int i = 0; i < 4; i++)
            {
                Slider slider = new Slider();
                slider.Tag = String.Format("{0};{1};{2};{3}",
                    sensor.ownerNodeId,
                    sensor.sensorId,
                    data.dataType.ToString(),
                    i);

                slider.HorizontalAlignment = HorizontalAlignment.Stretch;
                slider.Margin = new Thickness(5, 0, 5, 0);

                slider.Maximum = 255;
                slider.Value = rgbw[i];
                slider.ValueChanged += sliderRGBW_ValueChanged;

                list.Add(slider);
            }
            return list;
        }
        protected void CreateControl()
        {
            var grid = new Grid();
            int rowIndex = 0;
            int columnIndex;

            var brightnessText = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.Brightness
            };

            Grid.SetRow(brightnessText, rowIndex++);

            var brightnessSlider = new Slider
            {
                StepFrequency = 0.01,
                Minimum = 0.0,
                Maximum = 1.0,
                Value = Filter.Brightness
            };
            brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;

            Grid.SetRow(brightnessSlider, rowIndex++);

            var saturationText = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.Saturation
            };

            Grid.SetRow(saturationText, rowIndex++);

            var saturationSlider = new Slider
            {
                StepFrequency = 0.01,
                Minimum = 0.0,
                Maximum = 1.0,
                Value = Filter.Saturation
            };
            saturationSlider.ValueChanged += saturationSlider_ValueChanged;

            Grid.SetRow(saturationSlider, rowIndex++);

            var margin = new Thickness { Left = 72 };
            rowIndex = 0;
            columnIndex = 1;

            var lomoVignettingText = new TextBlock
            {
                Margin = margin,
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = Strings.LomoVignetting
            };

            Grid.SetRow(lomoVignettingText, rowIndex++);
            Grid.SetColumn(lomoVignettingText, columnIndex);

            var highRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.High }
            };
            highRadioButton.Checked += highRadioButton_Checked;

            Grid.SetRow(highRadioButton, rowIndex++);
            Grid.SetColumn(highRadioButton, columnIndex);

            var medRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.Medium }
            };
            medRadioButton.Checked += medRadioButton_Checked;

            Grid.SetRow(medRadioButton, rowIndex++);
            Grid.SetColumn(medRadioButton, columnIndex);

            var lowRadioButton = new RadioButton
            {
                Margin = margin,
                GroupName = LomoVignettingGroup,
                Content = new TextBlock { Text = Strings.Low }
            };
            lowRadioButton.Checked += lowRadioButton_Checked;

            Grid.SetRow(lowRadioButton, rowIndex++);
            Grid.SetColumn(lowRadioButton, columnIndex);

            switch (Filter.LomoVignetting)
            {
                case LomoVignetting.Low: lowRadioButton.IsChecked = true; break;
                case LomoVignetting.Medium: medRadioButton.IsChecked = true; break;
                case LomoVignetting.High: highRadioButton.IsChecked = true; break;
            }

            for (int i = 0; i < rowIndex; ++i)
            {
                var rowDefinition = new RowDefinition();

                if (i < rowIndex - 1)
                {
                    rowDefinition.MinHeight = GridRowMinimumHeight;
                }
                else
                {
                    rowDefinition.Height = GridLength.Auto;
                }

                grid.RowDefinitions.Add(rowDefinition);
            }

            grid.ColumnDefinitions.Add(new ColumnDefinition { MaxWidth = 500 });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });

            grid.Children.Add(brightnessText);
            grid.Children.Add(brightnessSlider);
            grid.Children.Add(saturationText);
            grid.Children.Add(saturationSlider);
            grid.Children.Add(lomoVignettingText);
            grid.Children.Add(lowRadioButton);
            grid.Children.Add(medRadioButton);
            grid.Children.Add(highRadioButton);

            Control = grid;
        }
 /// <summary>
 /// Attaches to the specified scroll viewer.
 /// </summary>
 /// <param name="scrollViewer">The scroll viewer.</param>
 public void Attach(ScrollViewer scrollViewer)
 {
     this._scrollViewer = scrollViewer;
     this._sliderHorizontal = new Slider
     {
         SmallChange = 0.0000000001,
         Minimum = double.MinValue,
         Maximum = double.MaxValue,
         StepFrequency = 0.0000000001
     };
     this._sliderHorizontal.ValueChanged += OnHorizontalOffsetChanged;
     this._sliderVertical = new Slider
     {
         SmallChange = 0.0000000001,
         Minimum = double.MinValue,
         Maximum = double.MaxValue,
         StepFrequency = 0.0000000001
     };
     this._sliderVertical.ValueChanged += OnVerticalOffsetChanged;
     this._sliderZoom = new Slider
     {
         SmallChange = 0.0000000001,
         Minimum = double.MinValue,
         Maximum = double.MaxValue,
         StepFrequency = 0.0000000001
     };
     this._sliderZoom.ValueChanged += OnZoomFactorChanged;
 }
Esempio n. 27
0
 private void SetupVideoDeviceControl(Windows.Media.Devices.MediaDeviceControl videoDeviceControl, Slider slider)
 {
     try
     {
         if ((videoDeviceControl.Capabilities).Supported)
         {
             slider.IsEnabled = true;
             slider.Maximum = videoDeviceControl.Capabilities.Max;
             slider.Minimum = videoDeviceControl.Capabilities.Min;
             slider.StepFrequency = videoDeviceControl.Capabilities.Step;
             double controlValue = 0;
             if (videoDeviceControl.TryGetValue(out controlValue))
             {
                 slider.Value = controlValue;
             }
         }
         else
         {
             slider.IsEnabled = false;
         }
     }
     catch (Exception e)
     {
         ShowExceptionMessage(e);
     }
 }
 public ScrollViewerAnimatedScrollHandler()
 {
     _sliderHorizontal = new Slider();
     _sliderHorizontal.SmallChange = 0.0000000001;
     _sliderHorizontal.Minimum = double.MinValue;
     _sliderHorizontal.Maximum = double.MaxValue;
     _sliderHorizontal.StepFrequency = 0.0000000001;
     _sliderHorizontal.ValueChanged += OnHorizontalOffsetChanged;
     _sliderVertical = new Slider();
     _sliderVertical.SmallChange = 0.0000000001;
     _sliderVertical.Minimum = double.MinValue;
     _sliderVertical.Maximum = double.MaxValue;
     _sliderVertical.StepFrequency = 0.0000000001;
     _sliderVertical.ValueChanged += OnVerticalOffsetChanged;
 }
        /// <summary>
        /// Detaches this instance.
        /// </summary>
        public void Detach()
        {
            this._scrollViewer = null;

            if (this._sliderHorizontal != null)
            {
                this._sliderHorizontal.ValueChanged -= OnHorizontalOffsetChanged;
                this._sliderHorizontal = null;
            }

            if (this._sliderVertical != null)
            {
                this._sliderVertical.ValueChanged -= OnHorizontalOffsetChanged;
                this._sliderVertical = null;
            }

            if (this._sliderZoom != null)
            {
                this._sliderZoom.ValueChanged -= OnZoomFactorChanged;
                this._sliderZoom = null;
            }
        }
        private void VolumeManager(object sender, RoutedEventArgs e)
        {

            var f = new Flyout();

            Border s = new Border
            {

                Height = 40,
                Width = 150,


            };

            Slide = new Slider
                    {
                        Minimum = 1,
                        Maximum = 100,
                        Value = mediaElement.Volume * 100,


                        Orientation = Orientation.Horizontal,

                    };

            s.Child = Slide;
            Slide.ValueChanged += Slide_ValueChanged;


            f.Content = s;

            f.Placement = PlacementMode.Bottom;
            f.PlacementTarget = sender as UIElement;

            f.IsOpen = true;


        }