Exemplo n.º 1
0
        // Get the current values from the parameter and display them.
        private void UpdateValues()
        {
            try
            {
                if (parameter != null)
                {
                    if (parameter.IsReadable)  // Check if parameter is accessible.
                    {
                        // Get values.
                        int min = checked ((int)parameter.GetMinimum());
                        int max = checked ((int)parameter.GetMaximum());
                        int val = checked ((int)parameter.GetValue());
                        int inc = checked ((int)parameter.GetIncrement());

                        // Update the slider.
                        MinVal        = min;
                        MaxVal        = max;
                        Val           = val;
                        SmallChange   = inc;
                        TickFrequency = (max - min + 5) / 10d;

                        // Update accessibility.
                        IsWriteable = parameter.IsWritable;
                        IsUseable   = true;

                        return;
                    }
                }
            }
            catch
            {
                // If errors occurred disable the control.
            }
            Reset();
        }
Exemplo n.º 2
0
        // Get the current values from the parameter and display them.
        private void UpdateValues()
        {
            try
            {
                if (parameter != null)
                {
                    if (parameter.IsReadable)  // Check if parameter is accessible.
                    {
                        // Get values.
                        int min = checked ((int)parameter.GetMinimum());
                        int max = checked ((int)parameter.GetMaximum());
                        int val = checked ((int)parameter.GetValue());
                        int inc = checked ((int)parameter.GetIncrement());

                        // Update the slider.
                        slider.Minimum       = min;
                        slider.Maximum       = max;
                        slider.Value         = val;
                        slider.SmallChange   = inc;
                        slider.TickFrequency = (max - min + 5) / 10;

                        // Update the displayed values.
                        labelMin.Text          = "" + min;
                        labelMax.Text          = "" + max;
                        labelCurrentValue.Text = "" + val;

                        // Update accessibility.
                        slider.Enabled            = parameter.IsWritable;
                        labelMin.Enabled          = true;
                        labelMax.Enabled          = true;
                        labelName.Enabled         = true;
                        labelCurrentValue.Enabled = true;

                        return;
                    }
                }
            }
            catch
            {
                // If errors occurred disable the control.
            }
            Reset();
        }