Beispiel #1
0
        public bool SendTimerMessage(Form1 f1, AppIF appif)
        {
            try
            {
                string str = id.ToString();
                byte[] msg = Encoding.UTF8.GetBytes(str);
                timerSocket.Send(msg);

                //受信用のバイト列作成
                byte[] bytes = new byte[1024];
                //送信後受信待機
                int byteRec = timerSocket.Receive(bytes);
                //受信データをデシリアライズする
                XmlSerializer xs  = new XmlSerializer(typeof(TimerSender));
                MemoryStream  mem = new MemoryStream(bytes);
                TimerSender   ts  = xs.Deserialize(mem) as TimerSender;

                f1.Invoke(new Action <TimerSender>(appif.DisplayWord), ts);
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     appif = new AppIF();
     if (!(appif.Initialize(this)))
     {
         return;
     }
 }