示例#1
0
 public MinMaxConfig()
 {
     this.InitializeComponent();
     // Fill in some default colors
     ViewUtility.InitializeColorComboBox(MinColorComboBox);
     ViewUtility.InitializeColorComboBox(MaxColorComboBox);
     MinColorComboBox.SelectedIndex = 0;
     MaxColorComboBox.SelectedIndex = 0;
 }
示例#2
0
        private DisplayMode GetBackgroundRotate()
        {
            ushort?offset = ViewUtility.GetUShort(PixelOffsetTextBox);

            if (!offset.HasValue)
            {
                return(null);
            }

            return(new BackgroundRotateDisplayMode
            {
                Offset = offset.Value
            });
        }
示例#3
0
        private DisplayMode GetMinMax()
        {
            ushort?fadeTime = ViewUtility.GetUShort(FadeDurationTextBox);

            if (!fadeTime.HasValue)
            {
                return(null);
            }

            return(new MinMaxDisplayMode
            {
                NeedleColor = (Color)HotColorComboBox.SelectedValue,
                ResetTime = fadeTime.Value
            });
        }
示例#4
0
        /// <summary>
        /// Set up current lighting modes and default colors
        /// </summary>
        private void InitializeLightingModes()
        {
            LightingModeComboBox.DisplayMemberPath = "Key";
            LightingModeComboBox.SelectedValuePath = "Value";
            LightingModeComboBox.Items.Add(new KeyValuePair <string, DisplayMode.DisplayModeValue>("Hot Needle", DisplayMode.DisplayModeValue.HotNeedle));
            LightingModeComboBox.Items.Add(new KeyValuePair <string, DisplayMode.DisplayModeValue>("Block Needle", DisplayMode.DisplayModeValue.BlockNeedle));
            LightingModeComboBox.Items.Add(new KeyValuePair <string, DisplayMode.DisplayModeValue>("BG Rotate", DisplayMode.DisplayModeValue.BackgroundRotate));
            LightingModeComboBox.Items.Add(new KeyValuePair <string, DisplayMode.DisplayModeValue>("Min Max", DisplayMode.DisplayModeValue.MinMax));
            LightingModeComboBox.SelectedIndex = 0;

            ViewUtility.InitializeColorComboBox(HotColorComboBox);

            // TODO - read current values from FizViz on connect
            HotColorComboBox.SelectedIndex = 0;
        }
        public BackgroundColorConfig()
        {
            this.InitializeComponent();
            ViewUtility.InitializeColorComboBox(Color1ComboBox);
            ViewUtility.InitializeColorComboBox(Color2ComboBox);
            ViewUtility.InitializeColorComboBox(Color3ComboBox);
            ViewUtility.InitializeColorComboBox(Color1ComboBox_Gradient);

            ColorModeComboBox.DisplayMemberPath = "Key";
            ColorModeComboBox.SelectedValuePath = "Value";
            ColorModeComboBox.Items.Add(new KeyValuePair <string, BackgroundColorMode>("Solid", BackgroundColorMode.Solid));
            ColorModeComboBox.Items.Add(new KeyValuePair <string, BackgroundColorMode>("Blended", BackgroundColorMode.Blend));
            ColorModeComboBox.Items.Add(new KeyValuePair <string, BackgroundColorMode>("Segmented", BackgroundColorMode.Segment));
            ColorModeComboBox.SelectedIndex = 0;

            UpdateParameterVisibility();
        }
        private void BackgroundColorButton_Click(object sender, RoutedEventArgs e)
        {
            ViewUtility.ResetControlBorders(ControlGrid);

            BackgroundColor command = new BackgroundColor();

            Color[] colors = new Color[FizVizCommand.NEOPIXEL_COUNT];
            for (int i = 0; i < FizVizCommand.NEOPIXEL_COUNT; i++)
            {
                colors[i] = Color.FromArgb(0, 0, 0, 0);
            }

            switch ((BackgroundColorMode)ColorModeComboBox.SelectedValue)
            {
            case BackgroundColorMode.Solid:
            {
                if (!GetSolid(colors))
                {
                    return;
                }
            }
            break;

            case BackgroundColorMode.Blend:
            {
                if (!GetBlend(colors))
                {
                    return;
                }
            }
            break;

            case BackgroundColorMode.Segment:
            {
                if (!GetSegment(colors))
                {
                    return;
                }
            }
            break;
            }

            command.BackgroundColors = colors;
            App.FizViz.SendCommand(command);
        }
        private void RandomPositionTimerOnTick(object sender, object o)
        {
            int?min = ViewUtility.GetInt(MinRandomTextBox);
            int?max = ViewUtility.GetInt(MaxRandomTextBox);

            if (!min.HasValue || !max.HasValue)
            {
                return;
            }
            int            position        = random.Next(min.Value, max.Value);
            NeedlePosition positionCommand = new NeedlePosition
            {
                Position  = (uint)position,
                Direction = NeedlePosition.NeedleDirectionValue.DoNotPassZero
            };

            App.FizViz.SendCommand(positionCommand);
        }
示例#8
0
        /****************************************************************
        *                       UI Callbacks                           *
        ****************************************************************/

        /// <summary>
        /// Generate and send the display mode to FizViz
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LightingModeButton_Click(object sender, RoutedEventArgs e)
        {
            ViewUtility.ResetControlBorders(ControlGrid);

            DisplayMode displayMode;

            switch ((DisplayMode.DisplayModeValue)LightingModeComboBox.SelectedValue)
            {
            case DisplayMode.DisplayModeValue.HotNeedle:
            {
                displayMode = GetHotNeedle();
            }
            break;

            case DisplayMode.DisplayModeValue.BlockNeedle:
            {
                displayMode = GetBlockNeedle();
            }
            break;

            case DisplayMode.DisplayModeValue.BackgroundRotate:
            {
                displayMode = GetBackgroundRotate();
            }
            break;

            case DisplayMode.DisplayModeValue.MinMax:
            {
                displayMode = GetMinMax();
            }
            break;

            default:
                return;
            }

            if (displayMode == null)
            {
                return;
            }

            App.FizViz.SendCommand(displayMode);
        }
        /****************************************************************
        *                       UI Callbacks                           *
        ****************************************************************/

        /// <summary>
        /// Generate and send a manual needle position command to FizViz
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NeedlePositionButton_Click(object sender, RoutedEventArgs e)
        {
            ViewUtility.ResetControlBorders(ControlGrid);

            ushort?position = ViewUtility.GetUShort(NeedlePositionTextBox);

            if (!position.HasValue)
            {
                return;
            }

            NeedlePosition positionCommand = new NeedlePosition
            {
                Position  = position.Value,
                Direction = (NeedlePosition.NeedleDirectionValue)NeedleDirectionComboBox.SelectedValue
            };

            App.FizViz.SendCommand(positionCommand);
        }
示例#10
0
        /****************************************************************
        *                       UI Callbacks                           *
        ****************************************************************/

        /// <summary>
        /// Generate and send a min max configuration message to FizViz
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MinMaxButton_Click(object sender, RoutedEventArgs e)
        {
            ViewUtility.ResetControlBorders(ControlGrid);

            ushort?reset = ViewUtility.GetUShort(ResetTextBox);

            if (!reset.HasValue)
            {
                return;
            }

            MinMaxCommand command = new MinMaxCommand
            {
                MinColor   = (Color)MinColorComboBox.SelectedValue,
                MaxColor   = (Color)MaxColorComboBox.SelectedValue,
                DisplayMin = DisplayMin.IsChecked.HasValue && DisplayMin.IsChecked.Value,
                DisplayMax = DisplayMax.IsChecked.HasValue && DisplayMax.IsChecked.Value,
                ResetDelay = reset.Value
            };

            App.FizViz.SendCommand(command);
        }
示例#11
0
 public void SetUiEnabled(bool commandsEnabled)
 {
     ViewUtility.SetUiEnabled(ControlGrid, LightingModeButton, commandsEnabled);
 }
 public void SetUiEnabled(bool commandsEnabled)
 {
     ViewUtility.SetUiEnabled(ControlGrid, BackgroundColorButton, commandsEnabled);
 }
        /****************************************************************
        *                  Helper functions                            *
        ****************************************************************/

        public void SetUiEnabled(bool commandsEnabled)
        {
            ViewUtility.SetUiEnabled(ControlGrid, NeedlePositionButton, commandsEnabled);
        }
示例#14
0
 public void SetUiEnabled(bool commandsEnabled)
 {
     ViewUtility.SetUiEnabled(ControlGrid, MinMaxButton, commandsEnabled);
 }