Exemplo n.º 1
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     ClearAll();
     // send empty image
     //MessengerLib.BGImgChunk data = new MessengerLib.BGImgChunk();
     MessengerLib.ContentData data = new MessengerLib.ContentData();
     data.type = MessengerLib.DataType.BGImgCk;
     data.len = 0;
     data.offset = 0;
     data.total = 0;
     data.data = null;
     data.userid = mUserId;
     data.groupGuid = mGroupSessionGuid;
     //mClient.SendBGImgChunk(data);
     mClient.SendContentData(data);
 }
Exemplo n.º 2
0
 private void Send()
 {
     //MessengerLib.MessageData data = new MessengerLib.MessageData();
     MessengerLib.ContentData data = new MessengerLib.ContentData();
     data.type = MessengerLib.DataType.Message;
     data.groupGuid = mGroupSessionGuid;
     data.message = textSend.Text;
     data.userid = mUserId;
     //mClient.SendMessage(data);
     mClient.SendContentData(data);
     string buf = string.Format("{0}>{1}", data.userid, data.message);
     WriteLine(buf, Color.Blue);
     textSend.Clear();
 }
Exemplo n.º 3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
            mParent.WindowState = FormWindowState.Minimized;
            CopyDesktopScreen cds = new CopyDesktopScreen();
            cds.ShowDialog();
            Bitmap bmp = cds.ScreenShotBmp;
            mInkPicture.Ink.DeleteStrokes();
            mInkPicture.BackgroundImage = bmp;
            mInkPicture.BackgroundImageLayout = ImageLayout.None;
            string fname = string.Format("{0}_screen_send.png", this.mUserId);
            FileStream fsw = File.OpenWrite(fname);
            bmp.Save(fsw, System.Drawing.Imaging.ImageFormat.Png);
            fsw.Close();

            FileStream fsr = File.OpenRead(fname);
            //MessengerLib.BGImgChunk data = new MessengerLib.BGImgChunk();
            MessengerLib.ContentData data = new MessengerLib.ContentData();
            data.type = MessengerLib.DataType.BGImgCk;
            data.len = 0;
            data.offset = 0;
            data.total = (int)fsr.Length;
            data.data = new byte[1024];
            data.userid = mUserId;
            data.groupGuid = mGroupSessionGuid;
            while (data.offset < data.total)
            {
                data.len = fsr.Read(data.data, 0, 1024);
                //mClient.SendBGImgChunk(data);
                mClient.SendContentData(data);
                data.offset += data.len;
            }
            fsr.Close();
        }
Exemplo n.º 4
0
 /*
 public void OnStrokeReceived(object sender, MessegerLib.Message.StrokeReceivedEventArgs e)
 {
     if (e.id == mId)
     {
         AddStroke(e.x, e.y);
     }
 }
  */
 /*
 public void OnBGImgReceived(object sender, MessegerLib.Message.BGImgReceivedEventArgs e)
 {
     if (e.id == mId)
     {
         FileStream fsw = File.OpenWrite("screen_receive.png");
         int len = e.data.Length;
         fsw.Write(e.data, 0, len);
         fsw.Close();
         FileStream fsr = File.OpenRead("screen_receive.png");
         Image pngImage = Image.FromStream(fsr);
         fsr.Close();
         mInkPicture.BackgroundImage = pngImage;
         mInkPicture.BackgroundImageLayout = ImageLayout.None;
     }
 }
  */
 void InkPicture_Stroke(object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
 {
     if (mFittingError >= 0)
     {
         Point[] pt = e.Stroke.GetFlattenedBezierPoints(mFittingError);
         Microsoft.Ink.Stroke st = mInkPicture.Ink.CreateStroke(pt);
         mInkPicture.Ink.DeleteStroke(e.Stroke);
         //mInkPicture.Ink.Strokes.Add(st);
         mInkPicture.Refresh();
         int count = pt.Length;
         //MessengerLib.StrokeData data = new MessengerLib.StrokeData();
         MessengerLib.ContentData data = new MessengerLib.ContentData();
         data.type = MessengerLib.DataType.Stroke;
         data.groupGuid = mGroupSessionGuid;
         data.userid = mUserId;
         data.x = new int[count];
         data.y = new int[count];
         for(int i = 0; i < count; i++)
         {
             data.x[i] = pt[i].X;
             data.y[i] = pt[i].Y;
         }
         //mClient.SendStroke(data);
         mClient.SendContentData(data);
     }
 }