public FileUploader UploadFile(string path, bool singleUse = false, string Filename = null) { ThrowIfDisposed(); try { var up = new FileUploader(mes, this, path, singleUse, Filename); up.Start(); return(up); } catch (SequenceBreakException e) { mes.SendMessage(new Message(Message.MessageType.Sequence, true)); log.Info(e); throw new AggregateException(e); } catch (Exception e) { log.Info(e); throw new AggregateException(e); } }
private async void UploadButton_Click(object sender, EventArgs e) { if (File.Exists(PathText.Text) && !Uploading) { FileUploader u = await Client.UploadFile(PathText.Text, FilenameText.Text); var c = new UploadContract { Uploader = u, Path = PathText.Text, Filename = FilenameText.Text, Share = ShareBox.Checked, FirstView = FirstViewBox.Checked, Public = PublicBox.Checked, PublicRegistered = PublicRegisteredBox.Checked, Whitelisted = WhitelistedBox.Checked, Whitelist = WhitelistText.Text }; StartUpload(c); } }