Пример #1
0
        async private void BtnGetFileInfo_Click(object sender, RoutedEventArgs e)
        {
            PacketValue packet = new PacketValue(protocol: Protocols.GET_FILE_LIST, value: 1);

            PacketSerialized result = await this.client.Send(packet).ConfigureAwait(false) as PacketSerialized;

            FileInfoCollection fileInfos = (FileInfoCollection)StreamUtil.DeserializeObject(result.SerializedData);

            UpdateGrid(fileInfos: fileInfos);
        }
Пример #2
0
        async private void BtnAddFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                byte[]           data    = File.ReadAllBytes(openFileDialog.FileName);
                PacketFile       request = new PacketFile(protocol: Protocols.UPLOAD_FILE, desc: Path.GetFileName(openFileDialog.FileName), fileData: data);
                PacketSerialized result  = await this.client.Send(sendPacket : request).ConfigureAwait(false) as PacketSerialized;

                FileInfoCollection fileInfos = (FileInfoCollection)StreamUtil.DeserializeObject(result.SerializedData);

                MessageBox.Show("Upload를 완료했습니다.");

                UpdateGrid(fileInfos: fileInfos);
            }
        }