public async void addGoogle(string unparsedConfig) { var options = JsonHelper.Deserialize <string[]>(unparsedConfig)[0]; var config = JsonHelper.Deserialize <Config>(options); GoogleConfig googleConfig = GoogleConfig.Create(config.clientId, config.scopes, config.accountId); await AccountManager.AddAccount(googleConfig); }
private async void Button_Click(object sender, RoutedEventArgs e) { if (file == null) { var openPicker = new FileOpenPicker { SuggestedStartLocation = PickerLocationId.PicturesLibrary, ViewMode = PickerViewMode.Thumbnail }; openPicker.FileTypeFilter.Add(".jpg"); openPicker.PickSingleFileAndContinue(); button.Content = "Upload"; } else { var config = await GoogleConfig.Create( "517285908032-12332132132131321312.apps.googleusercontent.com", new List <string>(new string[] { "https://www.googleapis.com/auth/drive" }), "google" ); //var config = await KeycloakConfig.Create("shoot-third-party", "https://localhost:8443", "shoot-realm"); //var config = FacebookConfig.Create("1654557457742519", "9cab3cb953d3194908f44f1764b5b921", // new List<string>(new string[] { "photo_upload, publish_actions" }), "facebook"); var module = await AccountManager.AddAccount(config); if (await module.RequestAccessAndContinue()) { Upload(module); } } }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { // TODO: Prepare page for display here. // TODO: If your application contains multiple pages, ensure that you are // handling the hardware Back button by registering for the // Windows.Phone.UI.Input.HardwareButtons.BackPressed event. // If you are using the NavigationHelper provided by some templates, // this event is handled for you. captureMgr = new MediaCapture(); await captureMgr.InitializeAsync(); capturePreview.Source = captureMgr; await captureMgr.StartPreviewAsync(); IsPreviewing = true; uploadLocation = new Dictionary <string, Uri>(); DisplayInformation displayInfo = DisplayInformation.GetForCurrentView(); displayInfo.OrientationChanged += DisplayInfo_OrientationChanged; DisplayInfo_OrientationChanged(displayInfo, null); var config = await GoogleConfig.Create( "517285908032-11moj33qbn01m7sem6g7gmfco2tp252v.apps.googleusercontent.com", new List <string>(new string[] { "https://www.googleapis.com/auth/drive" }), "google" ); uploadLocation.Add("google", new Uri("https://www.googleapis.com/upload/drive/v2/files")); await AccountManager.AddAccount(config); var keyCloak = await KeycloakConfig.Create("shoot-third-party", "https://localhost:8443", "shoot-realm"); uploadLocation.Add("shoot-third-party", new Uri("https://localhost:8443/shoot/rest/photos")); await AccountManager.AddKeyCloak(keyCloak); var facebook = FacebookConfig.Create("YYY", "XXX", new List <string>(new string[] { "photo_upload, publish_actions" }), "facebook"); uploadLocation.Add("facebook", new Uri("https://graph.facebook.com/me/photos")); await AccountManager.AddFacebook(facebook); }