示例#1
0
文件: Form1.cs 项目: ufjl0683/Earth
 //private void txtNormal_DoubleClick(object sender, EventArgs e)
 //{
 //     NotifyMessage[] normals = new NotifyMessage[qNormal.Count];
 //    qNormal.CopyTo(normals,0);
 //    FrmNotifyFinishDialog diallog=new FrmNotifyFinishDialog(normals);
 //     diallog.StartPosition= FormStartPosition.CenterScreen;
 //     if (diallog.ShowDialog() == DialogResult.Cancel)
 //        return;
 //    ShowNormals();
 //}
 private void editToolStripMenuItem_Click(object sender, EventArgs e)
 {
     NotifyMessage[] normals = new NotifyMessage[qNormal.Count];
     qNormal.CopyTo(normals, 0);
     FrmNotifyFinishDialog diallog = new FrmNotifyFinishDialog(normals);
     diallog.StartPosition = FormStartPosition.CenterScreen;
     if (diallog.ShowDialog() == DialogResult.Cancel)
         return;
     ShowNormals();
 }
示例#2
0
文件: Form1.cs 项目: ufjl0683/Earth
        private void timer2_Tick(object sender, EventArgs e)
        {
            (sender as Timer).Stop();
             //   (sender as Timer).Enabled = false;
            IPHostEntry hostEntry;

            hostEntry = Dns.GetHostEntry(Properties.Settings.Default.ServiceIP);
            string DestIP ="";

            foreach( var  entry in hostEntry.AddressList)
            {
                if(!(entry.IsIPv6LinkLocal || entry.IsIPv6Multicast || entry.IsIPv6SiteLocal))
                {
                    DestIP=entry.ToString();
                    NotifyMessage mesg = new NotifyMessage() { TimeStamp = DateTime.Now, title = "SYS", text = "Get Server IP " + DestIP };
                    this.BeginInvoke(new InvokeDelegate(InvokeTask), mesg);
                    break;
                }

            }
             //   = hostEntry.AddressList[0].ToString();
            nClient = new RemoteInterface.EventNotifyClient(
             DestIP, 9091, true
               );
            nClient.OnEvent += new RemoteInterface.NotifyEventHandler(nClient_OnEvent);
            nClient.OnConnect += new RemoteInterface.OnConnectEventHandler(nClient_OnConnect);
            ShowNormals();
        }
示例#3
0
文件: Form1.cs 项目: ufjl0683/Earth
        void ShowOthers()
        {
            string strShow = "";
               int inx = 0;
            NotifyMessage[] others = new NotifyMessage[qOther.Count];

            qOther.CopyTo(others, 0);
            foreach (NotifyMessage m in others)
            {
                inx++;
                strShow +=m.TimeStamp.ToString("yyyyMMdd") + m.title + ":";
                strShow += m.text + "\r\n";

            }
            txtOther.Text = strShow;
        }
示例#4
0
文件: Form1.cs 项目: ufjl0683/Earth
        void ShowNormals()
        {
            NotifyMessage[] normals = new NotifyMessage[qNormal.Count];
            qNormal.CopyTo(normals, 0);
            string strShow = "<html><body bgcolor=\"pink\">";
            int inx = 0;
            foreach (NotifyMessage m in normals)
            {
                inx++;
                if (m.IsFinish)
                {
                    strShow += "<strike><i><font color=\"red\">" + "Next " + inx + " From " + m.title + ":<br>";
                    strShow += m.text.Replace("\r\n", "<br>").Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") + "</font></i></strike>";
                }
                else
                {
                    strShow += "<b>Next " + inx + " From " + m.title + ":<br>";
                    strShow += m.text.Replace("\r\n", "<br>").Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")+"</b>";
                }

            }

            strShow+="</body></html>";
            wb1.DocumentText = strShow;
        }
示例#5
0
文件: Form1.cs 项目: ufjl0683/Earth
 void nClient_OnConnect(object sender)
 {
     nClient.RegistEvent(new RemoteInterface.NotifyEventObject(RemoteInterface.EventEnumType.Message,MachineName,null));
      NotifyMessage mesg=new NotifyMessage(){ TimeStamp=DateTime.Now, title="SYS", text="ORegist "+MachineName };
      this.BeginInvoke(new InvokeDelegate(InvokeTask), mesg);
 }
示例#6
0
文件: Form1.cs 项目: ufjl0683/Earth
        void InvokeTask(NotifyMessage mesg)
        {
            //if (dataSet11.tblMessageLog.Count == 20)
            //    dataSet11.tblMessageLog[0].Delete();
            //dataSet11.tblMessageLog.AddtblMessageLogRow(DateTime.Now, mesg.title, mesg.text);
            //dataSet11.AcceptChanges();
             //   this.dataGridView1.DataSource = dataSet11;
              //  this.dataGridView1.DataMember = "tblMessageLog";
             //   this.dataGridView1.Refresh();
            if(mesg.text.Trim().Length==0)
                return;

            char ctype=mesg.text[0];
             mesg.text=mesg.text.Substring(1);
             if (ctype == 'N')  //normal
             {
                 qNormal.Enqueue(mesg);
                 if (qNormal.Count > 5)
                     qNormal.Dequeue();
             }
             else
             {
                 qOther.Enqueue(mesg);
                 if (qOther.Count > 3)
                     qOther.Dequeue();
             }

            CurrentMessage = mesg;
             //   if(!isVisible)
                HasNewMessage = true;

            ShowTip(mesg.title, mesg.text);

            ShowNormals();
            ShowOthers();
        }