CovertFromAPI() public static method

Convert the value get from RevitAPI to the value indicated by DisplayUnitType
public static CovertFromAPI ( DisplayUnitType to, double value ) : double
to DisplayUnitType DisplayUnitType indicates unit of target value
value double value get from RevitAPI
return double
Exemplo n.º 1
0
        /// <summary>
        /// Set state of controls
        /// </summary>
        private void InitializeControls()
        {
            // Set length unit related labels
            String unit = Properties.Resources.ResourceManager.GetString(m_data.Unit.TypeId);

            labelUnitX.Text           = unit;
            labelUnitY.Text           = unit;
            labelUnitFirstRadius.Text = unit;
            labelXCoordUnit.Text      = unit;
            labelYCoordUnit.Text      = unit;

            // Set length values
            textBoxArcSpacing.Text        = Unit.CovertFromAPI(m_data.Unit, 10).ToString();
            textBoxArcFirstRadius.Text    = textBoxArcSpacing.Text;
            textBoxLineFirstDistance.Text = Unit.CovertFromAPI(m_data.Unit, 8).ToString();

            radioButton360.Checked                   = true;
            radioButtonCustomize.Checked             = false;
            labelStartDegree.Enabled                 = false;
            textBoxStartDegree.Enabled               = false;
            labelEndDegree.Enabled                   = false;
            textBoxEndDegree.Enabled                 = false;
            comboBoxArcBubbleLocation.SelectedIndex  = 1;
            comboBoxLineBubbleLocation.SelectedIndex = 1;
        }
        /// <summary>
        /// Set state of controls
        /// </summary>
        private void InitializeControls()
        {
            // Set length unit related labels
            String unit = SamplePropertis.GridCreationResources.ResourceManager.GetString(m_data.Dut.ToString());

            labelUnitX.Text      = unit;
            labelUnitY.Text      = unit;
            labelXCoordUnit.Text = unit;
            labelYCoordUnit.Text = unit;


            // Set spacing values
            textBoxXSpacing.Text = Unit.CovertFromAPI(m_data.Dut, 10).ToString();
            textBoxYSpacing.Text = textBoxXSpacing.Text;

            // Set bubble locations to end point
            comboBoxXBubbleLocation.SelectedIndex = 1;
            comboBoxYBubbleLocation.SelectedIndex = 1;
        }