示例#1
0
        private void Invite()
        {
            Client.SendCommand("voice?");
            string rec = Client.Receive(0);

            Dispatcher.BeginInvoke((ThreadStart) delegate()
            {
                if (rec == "OK")
                {
                    key = 1;
                    MessageBox.Show("对方接受语音通话!");
                    threadInvite.Abort();
                    threadReceive.Start();
                }
                else
                {
                    MessageBox.Show("对方拒绝!");
                    threadInvite.Abort();
                }
            });
        }
示例#2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     Client = Connect.Client;
     if (goToto == 0)
     {
         Debug.WriteLine(goToto + "+11111111" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
         Client.SendCommand(@"size?0|");                //发送指令来回收大小
         int size = Client.Receive(@"size?0|");         //接收大小
         Client.SendCommand(@"0|", size);               //发送指令来回收数据
         string re_str = Client.Receive(size);          //接收数据
         Debug.WriteLine("第一" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
         Documents_Items = new List <Documents_Item>(); //初始化
         string[] device = re_str.Split('|');
         for (int i = 0; i < device.Length - 1; i++)
         {
             Documents_Items.Add(new Documents_Item()
             {
                 Name = device[i], size = 40, ImageUrl = imageUrl + "Hard_Disk.png"
             });
         }
         this.top_Text.DataContext  = new Now_Top("我的电脑");
         List_Documents.ItemsSource = Documents_Items;//指定ListBox的数据来源为的数组
     }
     else if (goToto == 1)
     {
         goToto = 0;
         Debug.WriteLine(goToto + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
         Client.SendCommand(@"size?1|" + nowWay);                                //发送指令来回收大小
         int size = Client.Receive(@"size?1|" + nowWay);                         //接收大小
         Client.SendCommand(@"1|" + nowWay, size);                               //发送指令来回收数据
         string re_str = Client.Receive(size);                                   //接收数据
         Debug.WriteLine("第二" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
         this.top_Text.DataContext = new Now_Top(nowName);
         Bind_Data(re_str);
     }
 }
示例#3
0
 private void Show_Image()
 {
     while (true)
     {
         System.Threading.Thread.Sleep(380);
         Dispatcher.BeginInvoke((ThreadStart) delegate()
         {
             Client.SendCommand(@"size?12|"); //发送指令来回收大小
             //int size = Client.Receive(@"size?12|");                                   //接收大小
             int size = 60000;
             //System.Threading.Thread.Sleep(200);
             Debug.WriteLine("一百" + size.ToString(), DateTime.Now.ToShortTimeString());
             //Client.SendCommand(@"12|", size);                                     //发送指令来回收数据
             byte[] re_str         = Client.Receive(size, size);                           //接收数据
             BitmapImage cutImage  = ChangeImageWithByte.ByteArrayToBitmapImage(re_str);
             this.ShowImage.Source = cutImage;
         });
     }
 }
示例#4
0
        private void Invite()
        {
            Client.SendCommand("play?");
            string rec = Client.Receive(0); Debug.WriteLine("string" + rec, DateTime.Now.ToShortTimeString());

            Dispatcher.BeginInvoke((ThreadStart) delegate(){
                if (rec == "OK")
                {
                    key = 1;
                    threadShare.IsBackground = true;
                    threadShare.Start();
                    threadInvite.Abort();
                    this.closeShare.IsEnabled = true;
                }
                else
                {
                    MessageBox.Show("对方拒绝!");
                    threadInvite.Abort();
                    this.Share.IsEnabled      = true;
                    this.closeShare.IsEnabled = true;
                }
            });
        }
示例#5
0
        private void Go_Back_Click(object sender, EventArgs e)                               //虚拟返回键
        {
            if (nowWay == "")
            {
                NavigationService.GoBack();                                                    //返回上一页面
                return;
            }
            if (lastWay == "")
            {
                nowWay  = "";
                nowName = "";
                Client.SendCommand(@"size?0|");                //发送指令来回收大小
                int size = Client.Receive(@"size?0|");         //接收大小
                Client.SendCommand(@"0|", size);               //发送指令来回收数据
                string re_str = Client.Receive(size);          //接收数据
                Debug.WriteLine("第三" + re_str + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
                Documents_Items = new List <Documents_Item>(); //初始化
                string[] device = re_str.Split('|');
                for (int i = 0; i < device.Length - 1; i++)
                {
                    Documents_Items.Add(new Documents_Item()
                    {
                        Name = device[i], size = 40, ImageUrl = imageUrl + "Hard_Disk.png"
                    });
                }
                this.top_Text.DataContext  = new Now_Top("我的电脑");
                List_Documents.ItemsSource = Documents_Items;//指定ListBox的数据来源为的数组
                return;
            }
            Debug.WriteLine("fanhui+" + nowWay + "+" + lastWay + "+" + nowName, DateTime.Now.ToShortTimeString());
            nowWay = lastWay;
            string[] name = nowWay.Split('\\');
            nowName = name[name.Length - 2];
            if (nowName == @"C:" || nowName == @"D:" || nowName == @"E:" || nowName == @"F:" || nowName == @"G:" || nowName == @"H:" || nowName == @"I:")
            {
                nowName += @"\";
            }
            if (name.Length == 2)
            {
                lastWay = "";
            }
            else
            {
                lastWay = this.Get_Last(nowWay, name[name.Length - 2] + "\\");
            }
            Client.SendCommand(@"size?1|" + nowWay);                                  //发送指令来回收大小
            int size1 = Client.Receive(@"size?1|" + nowWay);                          //接收大小

            Client.SendCommand(@"1|" + nowWay, size1);                                //发送指令来回收数据
            string re_str1 = Client.Receive(size1);                                   //接收数据

            Debug.WriteLine("第四" + re_str1 + "+" + nowName + "+" + nowWay + "+" + lastWay, DateTime.Now.ToShortTimeString());
            this.top_Text.DataContext = new Now_Top(nowName);
            Bind_Data(re_str1);
        }