Beispiel #1
0
        private void OSD_Load(object sender, EventArgs e)
        {
            //xmlconfig(false);

            string strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            this.Text = this.Text + " " + strVersion;

            //string lang = Thread.CurrentThread.CurrentUICulture.Name;

            //EnglishUIToolStripMenuItem.Checked =
            bool foundlang = false;
            for (int i = 0; i < langs.Length && !foundlang; i++)
            {
                var cul = Thread.CurrentThread.CurrentUICulture;
                while (!cul.Equals(CultureInfo.InvariantCulture))
                {
                    if (cul.Equals(langs[i]))
                    {
                        langMenus[i].Checked = true;
                        foundlang = true;
                        break;
                    }
                    cul = cul.Parent;
                }
            }

            if (!foundlang)
                EnglishUIToolStripMenuItem.Checked = true;


            //if (lang.StartsWith("zh", StringComparison.CurrentCultureIgnoreCase))
            //    ChineseUIToolStripMenuItem.Checked = true;
            //else if (lang.StartsWith("pl", StringComparison.CurrentCultureIgnoreCase))
            //    PolishUIToolStripMenuItem.Checked = true;
            //else if (lang.StartsWith("es", StringComparison.CurrentCultureIgnoreCase))
            //    SpanishUIToolStripMenuItem.Checked = true;
            //else
            //    EnglishUIToolStripMenuItem.Checked = true;

            CHK_pal.Checked = pal;

            CMB_ComPort.Items.AddRange(GetPortNames());

            if (CMB_ComPort.Items.IndexOf(comPort) >= 0)
                CMB_ComPort.Text = comPort;


            for (int i = 0; i < OSDItemList.Avaliable.Length; i++)
                LIST_items.Items.Add(rmItemNames.GetString(OSDItemList.Avaliable[i].ToString()),
                osd.Setting.IsEnabled(OSDItemList.Avaliable[i]));

            foreach (var ad in ADFunctions)
                cbFunction.Items.Add(rmItemNames.GetString(ad));

            for (int i = 0; i < osd.Setting.ad_setting.Length; i++)
            {
                var r = new ADReading[] { 
                    new ADReading(), 
                    new ADReading()};
                adreadings.Add(r);
            }

            osd.SelectedItemChanged += new EventHandler(osd_SelectedItemChanged);
            osd.ItemPositionChanged += new EventHandler(osd_ItemPositionChanged);

            osdPort.ReadTimeout = 2000;
            osdPort.BaudRate = osdRate;

            osd.Chars = mcm.readMCM2("OSD_Charset.mcm");//"/*OSD_SA_v5.mcm");

            try
            {
                osd.BackgroundImage/*bgpicture*/ = Image.FromFile(bgImage);
            }
            catch { }



            osd.Draw();

            cbFunction.SelectedIndex = 0;

            LoadSetting(new OSDSetting());
        }
Beispiel #2
0
        private void OSD_Load(object sender, EventArgs e)
        {
            //xmlconfig(false);

            string strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.Text = this.Text + " " + strVersion;

            //string lang = Thread.CurrentThread.CurrentUICulture.Name;

            //EnglishUIToolStripMenuItem.Checked =
            bool foundlang = false;

            for (int i = 0; i < langs.Length && !foundlang; i++)
            {
                var cul = Thread.CurrentThread.CurrentUICulture;
                while (!cul.Equals(CultureInfo.InvariantCulture))
                {
                    if (cul.Equals(langs[i]))
                    {
                        langMenus[i].Checked = true;
                        foundlang            = true;
                        break;
                    }
                    cul = cul.Parent;
                }
            }

            if (!foundlang)
            {
                EnglishUIToolStripMenuItem.Checked = true;
            }


            //if (lang.StartsWith("zh", StringComparison.CurrentCultureIgnoreCase))
            //    ChineseUIToolStripMenuItem.Checked = true;
            //else if (lang.StartsWith("pl", StringComparison.CurrentCultureIgnoreCase))
            //    PolishUIToolStripMenuItem.Checked = true;
            //else if (lang.StartsWith("es", StringComparison.CurrentCultureIgnoreCase))
            //    SpanishUIToolStripMenuItem.Checked = true;
            //else
            //    EnglishUIToolStripMenuItem.Checked = true;

            CHK_pal.Checked = pal;

            CMB_ComPort.Items.AddRange(GetPortNames());

            if (CMB_ComPort.Items.IndexOf(comPort) >= 0)
            {
                CMB_ComPort.Text = comPort;
            }


            for (int i = 0; i < OSDItemList.Avaliable.Length; i++)
            {
                LIST_items.Items.Add(rmItemNames.GetString(OSDItemList.Avaliable[i].ToString()),
                                     osd.Setting.IsEnabled(OSDItemList.Avaliable[i]));
            }

            foreach (var ad in ADFunctions)
            {
                cbFunction.Items.Add(rmItemNames.GetString(ad));
            }

            for (int i = 0; i < osd.Setting.ad_setting.Length; i++)
            {
                var r = new ADReading[] {
                    new ADReading(),
                    new ADReading()
                };
                adreadings.Add(r);
            }

            osd.SelectedItemChanged += new EventHandler(osd_SelectedItemChanged);
            osd.ItemPositionChanged += new EventHandler(osd_ItemPositionChanged);

            osdPort.ReadTimeout = 2000;
            osdPort.BaudRate    = osdRate;

            osd.Chars = mcm.readMCM2("OSD_Charset.mcm");//"/*OSD_SA_v5.mcm");

            try
            {
                osd.BackgroundImage /*bgpicture*/ = Image.FromFile(bgImage);
            }
            catch { }



            osd.Draw();

            cbFunction.SelectedIndex = 0;

            LoadSetting(new OSDSetting());
        }