コード例 #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.ConPPT.IsEnabled = false;
            Client = Connect.Client;
            changlanguage();
            Client.SendCommand("data?");
            if (e.NavigationMode == NavigationMode.Back && PickFiles.PickedFiles.Count > 0)
            {
                StorageFile         file       = PickFiles.PickedFiles[0];
                IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

                Stream stream = WindowsRuntimeStreamExtensions.AsStreamForRead(fileStream.GetInputStreamAt(0));
                byte[] bt     = ConvertStreamTobyte(stream);

                Client.SendCommand("FileName|" + file.Name);
                Thread.Sleep(1000);
                Client.SendCommand(bt);

                string[] type = file.Name.Split('.');
                if (type[type.Length - 1] == "ppt")
                {
                    this.ConPPT.IsEnabled = true;
                }
            }
        }
コード例 #2
0
 protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
 {
     if (key == 1)
     {
         microphone.Stop();
         threadVoice.Abort();
         string stop   = "|||***|||";
         byte[] buffer = System.Text.Encoding.UTF8.GetBytes(stop.ToString());
         Client.SendCommand(buffer);
     }
     base.OnNavigatedFrom(e);
 }
コード例 #3
0
 protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
 {
     Debug.WriteLine("3333string", DateTime.Now.ToShortTimeString());
     if (key == 1)
     {
         threadShare.Abort();
         Debug.WriteLine("2222string", DateTime.Now.ToShortTimeString());
         string stop   = "|||***|||";
         byte[] buffer = System.Text.Encoding.UTF8.GetBytes(stop.ToString());
         Client.SendCommand(buffer);
     }
     base.OnNavigatedFrom(e);
 }
コード例 #4
0
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            this.ConPPT.IsEnabled = false;
            string stop = "|||***|||";

            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(stop.ToString());
            Client.SendCommand(buffer);
            base.OnNavigatedFrom(e);
        }
コード例 #5
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);
     }
 }
コード例 #6
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;
         });
     }
 }
コード例 #7
0
 private void CQ_Click(object sender, RoutedEventArgs e)
 {
     Client.SendCommand(@"14|CQ");
 }
コード例 #8
0
 private void On_Off_Click(object sender, System.Windows.Input.MouseEventArgs e)              //打开播放器
 {
     if (key == 0)
     {
         key = 1;
         Client.SendCommand(@"10|O");
     }
     else if (key == 1)
     {
         key = 0;
         Client.SendCommand(@"10|C");
     }
 }
コード例 #9
0
 private void Play_Next_Click(object sender, RoutedEventArgs e)
 {
     Client.SendCommand(@"13|D");
 }
コード例 #10
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);
        }
コード例 #11
0
 private void Voice_Click(object sender, RoutedEventArgs e)
 {
     Client.SendCommand(@"14|YYSB");
 }
コード例 #12
0
 private void Button_Click_0(object sender, RoutedEventArgs e)
 {
     Client.SendCommand(@"15|ESC");
 }