Beispiel #1
0
        void LoadSetting(OSDSetting setting)
        {
            for (int i = 0; i < OSDItemList.Avaliable.Length; i++)
            {
                /*bool alt = false;
                 * foreach (var a in OSDItemList.Alternates)
                 *  if (OSDItemList.Avaliable[i] == a.Key && setting.IsEnabled(a.Value))
                 *  {
                 *      LIST_items.SetItemChecked(i, false);
                 *      alt = true;
                 *  }
                 *
                 * if (!alt)*/
                LIST_items.SetItemChecked(i, setting.IsEnabled(OSDItemList.Avaliable[i]));
            }

            foreach (var r in adreadings)
            {
                r[0].reading = r[1].reading = 0;
                r[0].value   = r[1].value = 0;
            }
            rbMetric.Checked   = setting.GetOption(OSDOption.M_ISO);
            rbImperial.Checked = !rbMetric.Checked;

            cbFunction_SelectedIndexChanged(this, new EventArgs());

            osd.Setting = setting;
            osd.Draw();
        }
Beispiel #2
0
        private void LIST_items_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            // if (((CheckedListBox)sender).SelectedItem != null && ((CheckedListBox)sender).SelectedItem.ToString() == "Horizon")
            int idx = -1;

            if (((CheckedListBox)sender).SelectedItem != null)
            {
                OSDItem item = OSDItemList.Avaliable[LIST_items.SelectedIndex];//(OSDItem)Array.IndexOf(OSDItemList.Names, ((CheckedListBox)sender).SelectedItem);

                if (e.NewValue == CheckState.Checked)
                {
                    foreach (var conflict in OSDItemList.Conflits)
                    {
                        if (item == conflict.Key && (idx = Array.IndexOf(OSDItemList.Avaliable, conflict.Value)) >= 0)
                        {
                            LIST_items.SetItemChecked(idx, false);
                            osd.SetItemEnabled(conflict.Value, false);
                        }
                        else if (item == conflict.Value && (idx = Array.IndexOf(OSDItemList.Avaliable, conflict.Key)) >= 0)
                        {
                            LIST_items.SetItemChecked(idx, false);
                            osd.SetItemEnabled(conflict.Key, false);
                        }
                    }
                }

                /*
                 *              foreach (var alt in OSDItemList.Alternates)
                 *              {
                 *                  if (item == alt.Key && e.NewValue == CheckState.Checked && (idx = Array.IndexOf(OSDItemList.Avaliable, alt.Value)) >= 0)
                 *                  {
                 *                      LIST_items.SetItemChecked(idx, false);
                 *                      osd.SetItemEnabled(alt.Value, false);
                 *                      break;
                 *                  }
                 *                  else if (item == alt.Value)
                 *                  {
                 *                      if (e.NewValue == CheckState.Checked
                 *                          //&& OSDItemList.Names[(int)alt.Key] != null
                 *                          && (idx = Array.IndexOf(OSDItemList.Avaliable, alt.Key)) >= 0)
                 *                          LIST_items.SetItemChecked(idx, false);
                 *                      osd.SetItemEnabled(alt.Key, e.NewValue == CheckState.Checked);
                 *                      break;
                 *                  }
                 *              }
                 */
                osd.SetItemEnabled(item, e.NewValue == CheckState.Checked);
            }

            // add a delay to this so it runs after the control value has been defined.
            if (this.IsHandleCreated)
            {
                this.BeginInvoke((MethodInvoker) delegate { /*osdDraw();*/ osd.Draw(); });
            }
        }