Exemple #1
0
        /// <summary>
        /// 添加发送队列
        /// </summary>
        /// <param name="m1"></param>
        public void addSendBle(BLE.stringMsg m1)
        {
            BLEData ble1;

            if (m1.name == msgEnum.fileUpload)
            {
                string sendFileFullPath = m1.value["sendFileFullPath"];
                string saveFileFullPath = m1.value["saveFileFullPath"];

                BLE.bleClass.t12 t12 = new BLE.bleClass.t12();

                //  t12.sendFileFullPath = sendFileFullPath;

                //  string fileName = System.IO.Path.GetFileName(sendFileFullPath);

                //  ConfigInfo config = user.GetSave();
                //  string reviced = System.IO.Path.Combine(CurrUser.config.Path + "\\" + CurrUser.currUser.ID, fileName);//d:\\
                //stringMsg sm = new stringMsg();
                //sm.name = msgEnum.fileUpload;
                //sm.value.Add("sendFileFullPath", sendFileFullPath);
                //sm.value.Add("saveFileFullPath", saveFileFullPath);

                //   sm.value.Add("fileDirFullPath", CurrUser.config.Path + "\\" + CurrUser.currUser.ID);//文件存储路径


                t12.ReceiveFullMsg = m1.modelToJson();



                ble1 = t12;
            }
            else
            {
                BLE.bleClass.t11 t11 = new BLE.bleClass.t11();

                t11.msg = m1.modelToJson();

                ble1 = t11;
            }

            addSendBle(ble1);
        }
        private void button7_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                BLE.bleClass.t12 t2 = new BLE.bleClass.t12();
                t2.sendFileFullPath = openFileDialog1.FileName;

                string fileName = System.IO.Path.GetFileName(t2.sendFileFullPath);

                string reviced = System.IO.Path.Combine("d:\\", fileName);


                stringMsg sm = new stringMsg();
                sm.name = msgEnum.fileUpload;
                sm.value.Add("value", reviced);

                t2.ReceiveFullMsg = sm.modelToJson();

                t2.toBleStream(tcpClient1.tcpComm.sendDataGetStream());
                //tcpClient1.tcpComm.sendData(t2.toBleStream());
            }
        }