public async void EditVideoAsync(VideoSubmition v) { try { using (EnsureCredentialsUseContext context = new EnsureCredentialsUseContext( this.Username, this.Password, this.AccessKey, _client.InnerChannel)) { await this._client.EditVideoAsync(v, null, null); } } catch (FaultException faultException) { MessageFault messageFault = faultException.CreateMessageFault(); if (messageFault.HasDetail) { string innerErrorXml; using (var xmlReader = messageFault.GetReaderAtDetailContents()) { innerErrorXml = xmlReader.ReadInnerXml(); } if (innerErrorXml != null) { throw new Exception(innerErrorXml); } throw; } } }
public async Task <string> CreateVideoAsync(IStorageFile file, Video v) { VideoSubmition videoSubmition = new VideoSubmition { Tags = v.Tags, Title = v.Title, Synopse = v.Synopse }; Video createdVideo = null; try { using (EnsureCredentialsUseContext context = new EnsureCredentialsUseContext( this.Username, this.Password, this.AccessKey, _client.InnerChannel)) { createdVideo = await this._client.AddVideoPostAsync(videoSubmition, null); } } catch (FaultException faultException) { MessageFault messageFault = faultException.CreateMessageFault(); if (messageFault.HasDetail) { string innerErrorXml; using (var xmlReader = messageFault.GetReaderAtDetailContents()) { innerErrorXml = xmlReader.ReadInnerXml(); } if (innerErrorXml != null) { throw new Exception(innerErrorXml); } throw; } } string token = createdVideo.Token; BackgroundUploader uploader = new BackgroundUploader(); UploadOperation uploadOperation = await VideosServiceClient.CreateUploadOperationForCreateVideo(file, token, uploader); await uploadOperation.StartAsync(); return(await GetResponseMessage(uploadOperation)); }
private void BtEditVideoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) return; var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); //Title and randname are mandatory. VideoSubmition v = new VideoSubmition { Randname = this.tb_VideoRandnameForEditVideo.Text, Synopse = this.tb_VideoSynopseForEditVideo.Text, Title = this.tb_VideoTitleForEditVideo.Text }; client.EditVideoAsync(v); this.tblock_Result.Text = "SUCCESS"; }
private void BtEditVideoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); //Title and randname are mandatory. VideoSubmition v = new VideoSubmition { Randname = this.tb_VideoRandnameForEditVideo.Text, Synopse = this.tb_VideoSynopseForEditVideo.Text, Title = this.tb_VideoTitleForEditVideo.Text }; client.EditVideoAsync(v); this.tblock_Result.Text = "SUCCESS"; }
public async Task<string> CreateVideoAsync(IStorageFile file, Video v) { VideoSubmition videoSubmition = new VideoSubmition { Tags = v.Tags, Title = v.Title, Synopse = v.Synopse }; Video createdVideo = null; try { using (EnsureCredentialsUseContext context = new EnsureCredentialsUseContext( this.Username, this.Password, this.AccessKey, _client.InnerChannel)) { createdVideo = await this._client.AddVideoPostAsync(videoSubmition, null); } } catch (FaultException faultException) { MessageFault messageFault = faultException.CreateMessageFault(); if (messageFault.HasDetail) { string innerErrorXml; using (var xmlReader = messageFault.GetReaderAtDetailContents()) { innerErrorXml = xmlReader.ReadInnerXml(); } if (innerErrorXml != null) throw new Exception(innerErrorXml); throw; } } string token = createdVideo.Token; BackgroundUploader uploader = new BackgroundUploader(); UploadOperation uploadOperation = await VideosServiceClient.CreateUploadOperationForCreateVideo(file, token, uploader); await uploadOperation.StartAsync(); return await GetResponseMessage(uploadOperation); }
public async void EditVideoAsync(VideoSubmition v) { try { using (EnsureCredentialsUseContext context = new EnsureCredentialsUseContext( this.Username, this.Password, this.AccessKey, _client.InnerChannel)) { await this._client.EditVideoAsync(v, null, null); } } catch (FaultException faultException) { MessageFault messageFault = faultException.CreateMessageFault(); if (messageFault.HasDetail) { string innerErrorXml; using (var xmlReader = messageFault.GetReaderAtDetailContents()) { innerErrorXml = xmlReader.ReadInnerXml(); } if (innerErrorXml != null) throw new Exception(innerErrorXml); throw; } } }