Ejemplo n.º 1
0
        private void button_Download_Click(object sender, EventArgs e)
        {
            if (listBox_Files.SelectedItem is Gett.Sharing.GettFile)
            {
                var file = (Gett.Sharing.GettFile)listBox_Files.SelectedItem;

                var saveDialog = new SaveFileDialog {
                    OverwritePrompt = true, FileName = file.Info.FileName
                };

                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    var download = new UploadDownloadProgress(false, saveDialog.FileName, file);
                    download.Show();
                }
            }
        }
Ejemplo n.º 2
0
        private async void button_Upload_Click(object sender, EventArgs e)
        {
            if (listBox_Shares.SelectedItem is Gett.Sharing.GettShare)
            {
                var openDialog = new OpenFileDialog { CheckFileExists = true };

                if (openDialog.ShowDialog() == DialogResult.OK)
                {
                    var share = (Gett.Sharing.GettShare)listBox_Shares.SelectedItem;

                    try
                    {
                        Gett.Sharing.GettFile file = await share.CreateFileAsync(System.IO.Path.GetFileName(openDialog.FileName), Properties.Settings.Default.LiveSessionId);
                        var upload = new UploadDownloadProgress(true, openDialog.FileName, file);
                        upload.Show();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(@"Failed to upload new file '" + openDialog.FileName + @"' to Ge.tt" + Environment.NewLine + @"Exception of type " + ex.GetType() + Environment.NewLine + ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void button_Download_Click(object sender, EventArgs e)
        {
            if (listBox_Files.SelectedItem is Gett.Sharing.GettFile)
            {
                var file = (Gett.Sharing.GettFile)listBox_Files.SelectedItem;

                var saveDialog = new SaveFileDialog { OverwritePrompt = true, FileName = file.Info.FileName };

                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    var download = new UploadDownloadProgress(false, saveDialog.FileName, file);
                    download.Show();
                }
            }
        }
Ejemplo n.º 4
0
        private async void button_RefreshShares_Click(object sender, EventArgs e)
        {
            try
            {
                UseWaitCursor = true;

                await _gettUser.RefreshMeAsync();

                label_GettMe.Text      = string.Format("Email:{0} ({1})", _gettUser.Me.Email, _gettUser.Me.FullName);
                label_UserStorage.Text = string.Format("You are using {0} of {1}, free {2}.", UploadDownloadProgress.FormatSizeDisplay(_gettUser.Me.Storage.Used), UploadDownloadProgress.FormatSizeDisplay(_gettUser.Me.Storage.Total), UploadDownloadProgress.FormatSizeDisplay(_gettUser.Me.Storage.Free));

                listBox_Files.Items.Clear();
                listBox_Shares.Items.Clear();
                // ReSharper disable once CoVariantArrayConversion
                listBox_Shares.Items.AddRange(_gettUser.Shares.GetShares());
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"Failed to refresh shares from Ge.tt" + Environment.NewLine + @"Exception of type " + ex.GetType() + Environment.NewLine + ex.Message);
            }
            finally
            {
                UseWaitCursor = false;
            }
        }