private async void BtPickVideoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } FileOpenPicker openPicker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.VideosLibrary }; openPicker.FileTypeFilter.Add(".avi"); openPicker.FileTypeFilter.Add(".mp4"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Video video = new Video { Title = file.DisplayName, Tags = file.DisplayName, Synopse = file.DisplayName }; this.tblock_PostVideoResult.Text = await client.CreateVideoAsync(file, video); } else { this.tblock_PostVideoResult.Text = "Error reading file"; } }
private void BtDeleteVideoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); client.DeleteVideoAsync(this.tb_VideoRandnameForDeleteVideo.Text); this.tblock_Result.Text = "SUCCESS"; }
private async void BtGetUserClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); User u = await client.GetUserAsync(this.tb_UserNameForGetUser.Text); this.tblock_Result.Text = String.Format("Username: {0}\nCreationDate: {1}\nLastLogin: {2}", u.Username, u.CreationDate, u.LastLogin); }
private async void BtGetVideoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Video v = await client.GetVideoAsync(null, null, this.tb_VideoRandnameForGetVideo.Text, null, 0); this.tblock_Result.Text = String.Format("Randname: {0}\nTitle: {1}\nSynopse: {2}\nURI: {3}", v.Randname, v.Title, v.Synopse, v.URL); }
private async void BtGetUserVideosClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new VideosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Video[] videos = await client.GetUserVideos(null, null, null, 50, 1); StringBuilder sb = new StringBuilder(); foreach (Video v in videos) { sb.AppendLine(String.Format("Randname: {0}\nTitle: {1}\nSynopse: {2}\nURI: {3}", v.Randname, v.Title, v.Synopse, v.URL)); } this.tblock_Result.Text = sb.ToString(); }
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"; }