Ejemplo n.º 1
0
 public void Refobj(Myapp_inf app, mpage page, mobj obj)
 {
     if (app == null || page == null || obj == null)
     {
         this.Close();
     }
     else
     {
         if (this.Myapp != null && this.dpage != null && this.dobj != null && this.textBox1.Visible)
         {
             if (this.Myapp == app && this.dpage == page && this.dobj == obj)
             {
                 return;
             }
         }
         if (this.textmsg1 == null)
         {
             this.textmsg1 = new textmsg(this.textBox1, 0);
             this.textBox1.Document.DocumentChanged  += new DocumentEventHandler(this.DocumentChanged);
             this.textBox1.Document.TextArea.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Document_KeyDown);
         }
         this.textmsg1.Myapp = app;
         this.textmsg1.dpage = page;
         this.SaveCodes();
         this.issave = false;
         this.Myapp  = app;
         this.dpage  = page;
         this.dobj   = obj;
         this.refhead();
         if (this.tabControl1.SelectedTab != null && this.tabControl1.SelectedTab.Tag != null)
         {
             this.attload(this.tabControl1.SelectedTab.Tag.ToString().Getint());
         }
         this.issave = true;
     }
 }
Ejemplo n.º 2
0
 private void run_Load(object sender, EventArgs e)
 {
     this.textEditorControl1.Width = this.listBox1.Left - 10 - this.textEditorControl1.Left;
     this.panel2.Location          = this.textEditorControl1.Location;
     this.panel2.Size = this.textEditorControl1.Size;
     this.panel2.BringToFront();
     this.textEditorControl1.Document.autohscroll = true;
     this.textEditorControl1.ShowEOLMarkers       = false;
     this.textEditorControl1.Encoding             = Encoding.Default;
     this.textEditorControl1.ShowSpaces           = false;
     this.textEditorControl1.ShowTabs             = false;
     this.textEditorControl1.ShowVRuler           = false;
     this.textEditorControl1.TabIndent            = 2;
     this.textEditorControl1.ShowLineNumbers      = false;
     this.textEditorControl1.Text = "";
     if (datasize.codemessage[1].codehig == 1)
     {
         this.textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("C#-2");
     }
     else
     {
         this.textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy();
     }
     this.textEditorControl1.Document.TextKeyPress   += new DocumentEventHandler(this.textBox1_KeyPress);
     this.textEditorControl1.Document.TextArea.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyUp);
     this.panel1.panel_init();
     if (this.Myapp != null && this.textmsg1 == null)
     {
         this.textmsg1           = new textmsg(this.textEditorControl1, 1);
         this.textmsg1.Myapp     = this.Myapp;
         this.textmsg1.dpage     = this.Myapp.pages[0];
         this.textmsg1.textevent = true;
     }
     try
     {
         base.Icon = datasize.Myico;
         this.Text = datasize.softname;
         this.quxiantongdaos[0] = 0;
         this.quxiantongdaos[1] = 255;
         this.quxiantongdaos[2] = 255;
         this.quxiantongdaos[3] = 255;
         this.comboBox4.Items.Clear();
         this.comboBox4.Items.Add("2400");
         this.comboBox4.Items.Add("4800");
         this.comboBox4.Items.Add("9600");
         this.comboBox4.Items.Add("19200");
         this.comboBox4.Items.Add("38400");
         this.comboBox4.Items.Add("57600");
         this.comboBox4.Items.Add("115200");
         this.comboBox4.Text          = "9600";
         this.comboBox3.Visible       = false;
         this.Button3.Visible         = false;
         this.toolStripLabel1.Visible = false;
         this.comdata = "";
         this.comboBox1.Items.Clear();
         this.comboBox1.Items.Add("当前模拟器".Language());
         this.comboBox1.Items.Add("本机串口".Language());
         this.comboBox1.Items.Add("模拟器和串口".Language());
         this.comboBox1.SelectedIndex = 0;
         this.comboBoxItem1.Items.Clear();
         int[] encodes_This = datasize.encodes_This;
         for (int i = 0; i < encodes_This.Length; i++)
         {
             int j = encodes_This[i];
             this.comboBoxItem1.Items.Add(datasize.encodes_App[j].encodename);
         }
         if ((int)this.Myapp.myencode >= datasize.encodes_App.Length)
         {
             this.Myapp.myencode = ((datasize.Language == 0) ? "gb2312".GetencodeId() : "iso-8859-1".GetencodeId());
         }
         this.sendencoding = Encoding.GetEncoding(datasize.encodes_App[(int)this.Myapp.myencode].encodename);
         string encodename = datasize.encodes_App[(int)this.Myapp.myencode].encodename;
         for (int j = 0; j < this.comboBoxItem1.Items.Count; j++)
         {
             if (this.comboBoxItem1.Items[j].ToString() == encodename)
             {
                 this.comboBoxItem1.SelectedIndex = j;
                 break;
             }
         }
         this.getports();
         this.mycom1.com1     = this.com1;
         this.runscr1.Visible = false;
     }
     catch (Exception ex)
     {
         MessageOpen.Show(ex.Message);
     }
 }