Пример #1
0
        private void CloudForm_Load(object sender, EventArgs e)
        {
            string [] files = Directory.GetFiles(clientDir);

            foreach (string f in files)
            {
                cbClient.Items.Add(f);
            }

            var cloudProxy = new CryptoService.CryptoServiceClient();

            files = cloudProxy.GetFilesNames();

            foreach (string f in files)
            {
                cbCloud.Items.Add(f);
            }
        }
Пример #2
0
        private void btnDeleteCloud_Click(object sender, EventArgs e)
        {
            // ok, its working
            string[] checkedFiles = cbCloud.CheckedItems.Cast <string>().ToArray();

            var cloudProxy = new CryptoService.CryptoServiceClient();

            foreach (string s in checkedFiles)
            {
                cloudProxy.DeleteFile(s);
            }

            string[] files = cloudProxy.GetFilesNames();
            cbCloud.Items.Clear();
            foreach (string f in files)
            {
                cbCloud.Items.Add(f);
            }
        }
Пример #3
0
        private void btnUpload_Click(object sender, EventArgs e)
        {
            // ok, its working
            string[] checkedFiles = cbClient.CheckedItems.Cast <string>().ToArray();
            var      cloudProxy   = new CryptoService.CryptoServiceClient();

            foreach (string s in checkedFiles)
            {
                string fileName = Path.GetFileName(s);

                using (var stream = new FileStream(s, FileMode.Open, FileAccess.Read))
                {
                    bool resultOfUpload = cloudProxy.Upload(fileName, stream);
                }
            }

            string [] files = cloudProxy.GetFilesNames();
            cbCloud.Items.Clear();
            foreach (string f in files)
            {
                cbCloud.Items.Add(f);
            }
        }