コード例 #1
0
 public static void SetDurationCalculation(DurationCalculation val)
 {
     try
     {
         Application.UserAppDataRegistry.SetValue("Duration Calculation", (int)val);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
        public static DurationCalculation GetDurationCalculation()
        {
            DurationCalculation val = DurationCalculation.Algorithm;

            try
            {
                object obj = Application.UserAppDataRegistry.GetValue("Duration Calculation");

                if (obj != null)
                {
                    val = (DurationCalculation)int.Parse(obj.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(val);
        }
コード例 #3
0
        public DurationForm()
        {
            InitializeComponent();

            try
            {
                // only set these 3 textboxes, don't read back this value
                textBoxDurationConstant.Text = (((double)ConfigForm.GetDurationConstant()) / 1000).ToString();
                textBoxDurationVariable.Text = (((double)ConfigForm.GetDurationVariable()) / 1000).ToString();
                textBoxDurationMin.Text      = (((double)ConfigForm.GetDurationMinimum()) / 1000).ToString();

                textBoxScale.Text = (((double)GetDurationScale()) / 1000).ToString();

                DurationRange       range  = GetDurationRange();
                DurationUpdate      update = GetDurationUpdate();
                DurationCalculation calc   = GetDurationCalculation();

                switch (range)
                {
                case DurationRange.Selected:
                    radioButtonSelcted.Checked = true;
                    break;

                case DurationRange.All:
                    radioButtonAll.Checked = true;
                    break;
                }

                switch (update)
                {
                case DurationUpdate.EmptyOnly:
                    radioButtonOnlyEmpty.Checked = true;
                    break;

                case DurationUpdate.OnlyIncrease:
                    radioButtonOnlyIncrease.Checked = true;
                    break;

                case DurationUpdate.SetToCalculated:
                    radioButtonAllInRange.Checked = true;
                    break;
                }

                switch (calc)
                {
                case DurationCalculation.Algorithm:
                    radioButtonUseAlgorithm.Checked = true;
                    break;

                case DurationCalculation.ScaleFactor:
                    radioButtonScaleFactor.Checked = true;
                    break;
                }

                UpdateUI();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }