Ejemplo n.º 1
0
 private void Frm_Paraanalog2_Load(object sender, EventArgs e)
 {
     foreach (Control ctrl in this.Controls)
     {
         if (ctrl is Parashownew)
         {
             Parashownew ctr2 = ctrl as Parashownew;
             ctr2.timer1.Enabled = true;
         }
         if (ctrl is Gauge)
         {
             Gauge ctr2 = ctrl as Gauge;
             ctr2.timer1.Enabled = true;
         }
     }
     gauge0.timer1.Enabled = true;
     xml_load();
     //语言切换
     if (Form_Main.lan == "Chinese")
     {
         MultiLanguage.LoadLanguage(Application.OpenForms["Frm_Paraanalog2"], "Chinese");
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge2.label1.Text = "井口套压";
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge0.label4.Text = "井口油压";
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge1.label1.Text = "井口排出流量";
     }
     else
     {
         MultiLanguage.LoadLanguage(Application.OpenForms["Frm_Paraanalog2"], "English");
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge2.label1.Text = "Casing Pressure";
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge0.label4.Text = "Tubing Pressure";
         ((Frm_Paraanalog2)Application.OpenForms["Frm_Paraanalog2"]).gauge1.label1.Text = "Discharge Rate";
     }
 }
Ejemplo n.º 2
0
 public Para_choose(Parashownew ctr, string name)
 {
     Frm_name       = name;
     this.ctr_show2 = ctr;
     tag_num        = ctr.Tag.ToString();
     tag_color      = ctr.Color;
     InitializeComponent();
     //如果是数字显示控件,不开放上下限设置
     txb_max.Enabled = false; txb_min.Enabled = false;
 }
Ejemplo n.º 3
0
        private void Frm_Paradigital_Load(object sender, EventArgs e)
        {
            xml_load();

            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is Parashownew)
                {
                    Parashownew ctr2 = ctrl as Parashownew;
                    ctr2.timer1.Enabled = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void Frm_Paradigital2_Load(object sender, EventArgs e)
        {
            xml_load();

            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is Parashownew)
                {
                    Parashownew ctr2 = ctrl as Parashownew;
                    ctr2.timer1.Enabled = true;
                }
            }
            //语言切换
            MultiLanguage.LoadLanguage(Application.OpenForms["Frm_Paradigital2"], Form_Main.lan);
        }
Ejemplo n.º 5
0
 private void Frm_Paraanalog_Load(object sender, EventArgs e)
 {
     foreach (Control ctrl in this.Controls)
     {
         if (ctrl is Parashownew)
         {
             Parashownew ctr2 = ctrl as Parashownew;
             ctr2.timer1.Enabled = true;
         }
         if (ctrl is Gauge)
         {
             Gauge ctr2 = ctrl as Gauge;
             ctr2.timer1.Enabled = true;
         }
     }
     gauge0.timer1.Enabled = true;
     xml_load();
 }
Ejemplo n.º 6
0
        private void pre_refresh(Form frm)
        {
            foreach (Control ctrl in frm.Controls)
            {
                if (ctrl is ParaLine)
                {
                    ParaLine ctr = ctrl as ParaLine;

                    int index = Convert.ToInt16(ctr.Tag);
                    ctr.Tagname    = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                    ctr.Tagname_EN = Form_Main.dt_para.Rows[index - 1]["英文名称"].ToString();
                    ctr.Min        = Form_Main.dt_para.Rows[index - 1]["最小值"].ToString();
                    ctr.Max        = Form_Main.dt_para.Rows[index - 1]["最大值"].ToString();
                    ctr.Unit       = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                    if (Form_Main.Unit == 1)
                    {
                        ctr.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                    }
                    ctr.refresh();
                }
                if (ctrl is Gauge)
                {
                    Gauge ctr = ctrl as Gauge;

                    int index = Convert.ToInt16(ctr.Tag);
                    ctr.Tagname = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                    //ctr.Tagname_EN = Form_Main.dt_para.Rows[index - 1]["英文名称"].ToString();
                    ctr.Min  = Form_Main.dt_para.Rows[index - 1]["最小值"].ToString();
                    ctr.Max  = Form_Main.dt_para.Rows[index - 1]["最大值"].ToString();
                    ctr.Unit = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                    if (Form_Main.Unit == 1)
                    {
                        ctr.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                    }
                }


                if (ctrl is Parashow)
                {
                    Parashow ctrl2 = ctrl as Parashow;

                    int index = Convert.ToInt16(ctrl2.Tag);
                    ctrl2.Tagname    = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                    ctrl2.Tagname_EN = Form_Main.dt_para.Rows[index - 1]["英文名称"].ToString();
                    ctrl2.Unit       = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                    if (Form_Main.Unit == 1)
                    {
                        ctrl2.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                    }
                    ctrl2.refresh();
                }

                if (ctrl is Parashownew)
                {
                    Parashownew ctrl2 = ctrl as Parashownew;

                    int index = Convert.ToInt16(ctrl2.Tag);
                    ctrl2.Tagname    = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                    ctrl2.Tagname_EN = Form_Main.dt_para.Rows[index - 1]["英文名称"].ToString();
                    ctrl2.Unit       = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                    if (Form_Main.Unit == 1)
                    {
                        ctrl2.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                    }
                    ctrl2.refresh();
                }
            }
            //更新坐标轴

            ((Form_Main)Application.OpenForms["Form_Main"]).trend_refresh("0");
            ((Frm_Realtrend)Application.OpenForms["Frm_Realtrend"]).trend_refresh("0");
            ((Frm_Realtrend2)Application.OpenForms["Frm_Realtrend2"]).trend_refresh("1");
        }
Ejemplo n.º 7
0
        private void xml_load()
        {
            try
            {
                string      path = Application.StartupPath + "\\Config\\preference.xml";
                XmlDocument doc  = new XmlDocument();
                doc.Load(path);
                XmlNode root = doc.DocumentElement;
                //现读取paraLine控件的信息
                XmlNodeList nodeList = root.SelectNodes("Form[Name='Frm_Paradigital']//Controlsshow//Control");

                //1115新增
                foreach (Control ctr in this.Controls)
                {
                    if (ctr is Parashownew)
                    {
                        Parashownew ctr2 = ctr as Parashownew;
                        foreach (XmlNode node in nodeList)
                        {
                            if (ctr2.Name == node.SelectSingleNode("@name").InnerText)
                            {
                                ctr2.Tagname = node.SelectSingleNode("@tagname").InnerText;
                                ctr2.Unit    = node.SelectSingleNode("@unit").InnerText;
                                ctr2.Tag     = node.SelectSingleNode("@index").InnerText;
                                ctr2.Color   = Comm.ReadColor.getcolor(node.SelectSingleNode("@color").InnerText);
                                ctr2.refresh();
                            }
                        }
                    }
                }



                //foreach (Control ctrl in this.tabControl1.Controls)
                //{
                //    if (ctrl is TabPage)
                //    {
                //        TabPage ctrl2 = ctrl as TabPage;
                //        foreach (Control ctr in ctrl2.Controls)
                //        {
                //            if (ctr is Parashow)
                //            {
                //                Parashow ctr2 = ctr as Parashow;
                //                foreach (XmlNode node in nodeList)
                //                {
                //                    if (ctr2.Name == node.SelectSingleNode("@name").InnerText)
                //                    {
                //                        ctr2.Tagname = node.SelectSingleNode("@tagname").InnerText;
                //                        ctr2.Unit = node.SelectSingleNode("@unit").InnerText;
                //                        ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                //                        ctr2.refresh();
                //                    }

                //                }
                //            }
                //        }
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 8
0
        public void xml_load()
        {
            try
            {
                string      path = Application.StartupPath + "\\Config\\preference.xml";
                XmlDocument doc  = new XmlDocument();
                doc.Load(path);
                XmlNode root = doc.DocumentElement;
                //现读取paraLine控件的信息
                XmlNodeList nodeList = root.SelectNodes("Form[Name='Frm_Paraanalog2']//Controlsshow//Control");

                //1115新增,parashow控件
                foreach (Control ctr in this.Controls)
                {
                    if (ctr is Parashownew)
                    {
                        Parashownew ctr2 = ctr as Parashownew;
                        foreach (XmlNode node in nodeList)
                        {
                            if (ctr2.Name == node.SelectSingleNode("@name").InnerText)
                            {
                                //ctr2.Tagname = node.SelectSingleNode("@tagname").InnerText;
                                //ctr2.Tagname_EN = node.SelectSingleNode("@tagname_en").InnerText;
                                //ctr2.Unit = node.SelectSingleNode("@unit").InnerText;
                                //ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                                //0513修改,信息从para读取
                                ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                                int index = Convert.ToInt16(ctr2.Tag);
                                ctr2.Tagname    = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                                ctr2.Tagname_EN = Form_Main.dt_para.Rows[index - 1]["英文名称"].ToString();
                                ctr2.Unit       = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                                if (Form_Main.Unit == 1)
                                {
                                    ctr2.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                                }
                                ctr2.Color = Comm.ReadColor.getcolor(node.SelectSingleNode("@color").InnerText);

                                //if (Form_Main.Unit == 1) ctr2.Unit = Form_Main.factor_unit[Convert.ToInt16(ctr2.Tag)];
                                ctr2.refresh();
                            }
                        }
                    }
                }
                //1115新增,gauge控件
                nodeList = root.SelectNodes("Form[Name='Frm_Paraanalog2']//Controlsgauge//Control");
                foreach (Control ctr in this.Controls)
                {
                    if (ctr is Gauge)
                    {
                        Gauge ctr2 = ctr as Gauge;
                        foreach (XmlNode node in nodeList)
                        {
                            if (ctr2.Name == node.SelectSingleNode("@name").InnerText)
                            {
                                //ctr2.Tagname = node.SelectSingleNode("@tagname").InnerText;
                                //ctr2.Unit = node.SelectSingleNode("@unit").InnerText;
                                //ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                                //ctr2.Min = node.SelectSingleNode("@min").InnerText;
                                //ctr2.Max = node.SelectSingleNode("@max").InnerText;
                                ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                                int index = Convert.ToInt16(ctr2.Tag);
                                ctr2.Tagname = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                                ctr2.Unit    = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                                ctr2.Min     = Form_Main.dt_para.Rows[index - 1]["最小值"].ToString();
                                ctr2.Max     = Form_Main.dt_para.Rows[index - 1]["最大值"].ToString();
                                if (Form_Main.Unit == 1)
                                {
                                    ctr2.Unit = Form_Main.dt_para.Rows[index - 1]["英制单位"].ToString();
                                }
                                //if (Form_Main.Unit == 1) ctr2.Unit = Form_Main.factor_unit[Convert.ToInt16(ctr2.Tag)];
                                ctr2.refresh();
                            }
                            //初始化大表盘的参数
                            if (node.SelectSingleNode("@name").InnerText == "gauge0")
                            {
                                //gauge0.Tagname = node.SelectSingleNode("@tagname").InnerText;
                                //gauge0.Unit = node.SelectSingleNode("@unit").InnerText;
                                //gauge0.Tag = node.SelectSingleNode("@index").InnerText;
                                //gauge0.Min = node.SelectSingleNode("@min").InnerText;
                                //gauge0.Max = node.SelectSingleNode("@max").InnerText;
                                //if (Form_Main.Unit == 1) gauge0.Unit = Form_Main.factor_unit[Convert.ToInt16(gauge0.Tag)];
                                gauge0.Tag = node.SelectSingleNode("@index").InnerText;
                                int index = Convert.ToInt16(gauge0.Tag);
                                gauge0.Tagname = Form_Main.dt_para.Rows[index - 1]["中文名称"].ToString();
                                gauge0.Unit    = Form_Main.dt_para.Rows[index - 1]["公制单位"].ToString();
                                gauge0.Min     = Form_Main.dt_para.Rows[index - 1]["最小值"].ToString();
                                gauge0.Max     = Form_Main.dt_para.Rows[index - 1]["最大值"].ToString();
                                gauge0.refresh();
                            }
                        }
                    }
                }


                //foreach (Control ctrl in this.tabControl1.Controls)
                //{
                //    if (ctrl is TabPage)
                //    {
                //        TabPage ctrl2 = ctrl as TabPage;
                //        foreach (Control ctr in ctrl2.Controls)
                //        {
                //            if (ctr is Parashow)
                //            {
                //                Parashow ctr2 = ctr as Parashow;
                //                foreach (XmlNode node in nodeList)
                //                {
                //                    if (ctr2.Name == node.SelectSingleNode("@name").InnerText)
                //                    {
                //                        ctr2.Tagname = node.SelectSingleNode("@tagname").InnerText;
                //                        ctr2.Unit = node.SelectSingleNode("@unit").InnerText;
                //                        ctr2.Tag = node.SelectSingleNode("@index").InnerText;
                //                        ctr2.refresh();
                //                    }

                //                }
                //            }
                //        }
                //    }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 加载语言
        /// </summary>
        /// <param name="form">加载语言的窗口</param>
        public static void LoadLanguage(Form form, string lan)
        {
            //获取当前默认语言
            string language = lan;
            //根据用户选择的语言获得表的显示文字
            Hashtable hashText = ReadXMLText(form.Name, language);

            if (hashText == null)
            {
                return;
            }
            //获取当前窗口的所有控件
            Control.ControlCollection sonControls = form.Controls;
            try
            {
                //遍历所有控件
                foreach (Control control in sonControls)
                {
                    if (control.GetType() == typeof(Panel))     //Panel
                    {
                        GetSetSubControls(control.Controls, hashText);
                    }
                    else if (control.GetType() == typeof(GroupBox))     //GroupBox
                    {
                        GetSetSubControls(control.Controls, hashText);
                    }
                    else if (control.GetType() == typeof(TabControl))       //TabControl
                    {
                        GetSetSubControls(control.Controls, hashText);
                    }
                    else if (control.GetType() == typeof(TabPage))      //TabPage
                    {
                        GetSetSubControls(control.Controls, hashText);
                    }
                    else if (control.GetType() == typeof(Parashow))
                    {
                        Parashow pr = control as Parashow;
                        if (Form_Main.lan == "English")
                        {
                            pr.label1.Text = pr.Tagname_EN;
                        }
                        else if (Form_Main.lan == "Chinese")
                        {
                            pr.label1.Text = pr.Tagname;
                        }
                    }
                    else if (control.GetType() == typeof(ParaLine))
                    {
                        ParaLine pr = control as ParaLine;
                        if (Form_Main.lan == "English")
                        {
                            pr.label1.Text = pr.Tagname_EN;
                            pr.label1.Font = new System.Drawing.Font("宋体", 10F);
                        }
                        else if (Form_Main.lan == "Chinese")
                        {
                            pr.label1.Text = pr.Tagname;
                            pr.label1.Font = new System.Drawing.Font("宋体", 15F);
                        }
                    }
                    else if (control.GetType() == typeof(Parashownew))
                    {
                        Parashownew pr = control as Parashownew;
                        if (Form_Main.lan == "English")
                        {
                            pr.label1.Text = pr.Tagname_EN;
                        }
                        else if (Form_Main.lan == "Chinese")
                        {
                            pr.label1.Text = pr.Tagname;
                        }
                    }
                    else if (control.GetType() == typeof(MenuStrip))   //MenuStrip
                    {
                        MenuStrip ms = control as MenuStrip;
                        foreach (ToolStripMenuItem item in ms.Items)
                        {
                            item.Text = (string)hashText[item.Name];
                            for (int i = 0; i < item.DropDownItems.Count; i++)
                            {
                                item.DropDownItems[i].Text = (string)hashText[item.DropDownItems[i].Name];
                            }
                        }
                    }
                    else if (control.GetType() == typeof(StatusStrip))   //StatusStrip
                    {
                        StatusStrip ms = control as StatusStrip;
                        foreach (ToolStripItem item in ms.Items)
                        {
                            if (!string.IsNullOrEmpty((string)hashText[item.Name]))
                            {
                                item.Text = (string)hashText[item.Name];
                            }
                        }
                    }
                    if (hashText.Contains(control.Name))
                    {
                        control.Text = (string)hashText[control.Name];
                    }
                }
                if (hashText.Contains(form.Name))
                {
                    form.Text = (string)hashText[form.Name];
                }
            }
            catch { }
        }