private async Task <bool> GoogleDriveAuth() { if (!File.Exists(textCredPath.Text)) { Log("Unselected JsonFile"); return(false); } var path = textCredPath.Text; var result = await GoogleDriveAPI.Authentication(path, PathHelper.GoogleDriveTokenPath); Log("Google Drive Auth - " + result); var files = Directory.GetFiles(PathHelper.GoogleDriveTokenPath); backupSettingPanel.Enabled = files.Count() > 0; if (backupSetting.authFilePath != path) { backupSetting.authFilePath = path; SaveBackupSettings(); } IsAuthd = true; return(true); }
/// <summary> /// バックアップを開始 /// </summary> /// <param name="paths"></param> private async void StartBackupFile() { try { TabPageBackup.Enabled = false; var infos = getGDriveInfos(); var files = await GoogleDriveAPI.SyncFiles(FOLDER_NAME, infos); } catch { Log("***** バックアップエラー 終了 *****"); } TabPageBackup.Enabled = true; }
/// <summary> /// チェック /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void buttonBackupCheck_Click(object sender, EventArgs e) { try { TabPageBackup.Enabled = false; var infos = getGDriveInfos(); var needSync = await GoogleDriveAPI.SyncFiles(FOLDER_NAME, infos, true); Log("ファイル更新" + ((needSync) ? "あり" : "なし")); } catch { Log("***** バックアップエラー 終了 *****"); } TabPageBackup.Enabled = true; }
public static string UploadWorkBook2([ExcelArgument("Workbook Path")] string myWBPath) { string url = String.Empty; try { GlobalFunctions.SetActiveWorkBookName(myWBPath); GoogleDriveAPI gdrive = new GoogleDriveAPI(); GlobalFunctions.DebugLog($"GoogleDrive API initialized. Uploading file: {GlobalFunctions.activeWBPath}"); url = gdrive.upload(GlobalFunctions.activeWBPath); GlobalFunctions.DebugLog($"File successfully uploaded; public url: {url}"); GlobalFunctions.InfoLog("Finished UploadWorkBook UDF..."); } catch (Exception ex) { GlobalFunctions.WarnLog("Encountered error running UploadWorkBook UDF:" + ex.Message); GlobalFunctions.TraceLog(ex.ToString()); } return(url); }
public async void SignUpButton(object sender, EventArgs e) { String UUIDs = Guid.NewGuid().ToString(); if (CheckTextField()) { activIndicator.IsRunning = true; var deviceIds = CrossDeviceInfo.Current.Id; //Can't find Actual Object of CrossDeviceInfo // string simNumber = ""; // string deviceIdJson = ""; // var content = await _client.GetStringAsync(url); // List<Dictionary<string, object>> posts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(content); // foreach (Dictionary<string, object> i in posts) // { // Dictionary<string, object> post = JsonConvert.DeserializeObject<Dictionary<string, object>>(Convert.ToString(i["properties"])); // deviceIdJson = Convert.ToString(post["deviceId"]); // if (deviceIdJson == deviceId) // { // simNumber = Convert.ToString(post["simNumber"]); // } // } // await Navigation.PushModalAsync(new TermAndService()); try { string oneSignalId = ""; OneSignal.Current.IdsAvailable((playerID, pushToken) => { oneSignalId = playerID; // App.Current.MainPage.DisplayAlert("playerId", id.ToString(), "OK"); }); string names = name; string emailId = email; string subrubs = subrub.Text; var statesPickers = statesPicker.Items[statesPicker.SelectedIndex]; //Can't find actual return type string statess = statesPickers; string postCodee = postCode.Text; string countrys = "Australia"; string userTypes = "C"; string latitude = "45"; string longitude = "45"; var locator = CrossGeolocator.Current; if (!locator.IsGeolocationAvailable || !locator.IsGeolocationEnabled) { await DisplayAlert("", "Trolli app requires access to location services, in order to function properly. If you do not allow location access, some features may not work as expected.", "Ok"); } else { locator.DesiredAccuracy = 100; if (Device.RuntimePlatform == Device.iOS) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } else if (Device.RuntimePlatform == Device.Android) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } string folderID = GoogleDriveAPI.CreateUserFolder("User_" + UUIDs); SignupBean bean = new SignupBean { name = names, email = emailId, subrub = subrubs, states = statess, postCodes = postCodee, country = countrys, userType = userTypes, phoneNumber = phoneNumbers, deviceId = deviceIds, latitude = latitude, longitude = longitude, UUID = UUIDs, folderId = folderID, imageId = "", rewardCard1 = "", rewardCard2 = "", oneSignalId = oneSignalId }; IsJobOnlineSeeker bean2 = new IsJobOnlineSeeker { fullName = name, simNumber = phoneNumbers, isJobSeeker = "true" }; Application.Current.Properties["phoneNumber"] = phoneNumbers; Application.Current.Properties["isOnlineJobSeeker"] = true; Application.Current.Properties["checkTrolli"] = "showAlert"; reloadData.Add("country", countrys); reloadData.Add("UniqueID", UUIDs); reloadData.Add("fullName", names); reloadData.Add("deviceId", deviceIds); reloadData.Add("suburb", subrubs); reloadData.Add("postCode", postCodee); reloadData.Add("state", statess); reloadData.Add("userType", userTypes); reloadData.Add("simNumber", phoneNumbers); reloadData.Add("gdFolderId", folderID); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", emailId); reloadData.Add("gdProfileImageId", ""); reloadData.Add("oneSignalId", oneSignalId); SharedUserData.getUserData = reloadData; ApiCalling callApi = new ApiCalling(); // GlobalVaribles golbalVarible = new GlobalVaribles(); // golbalVarible.setData(bean); callApi.SignupPost(bean); callApi.IsJobOnlineSeeker(bean2); // animationView.Play(); // // string folderID = GoogleDriveAPI.createUserFolder("User_"+UUIDs); userReferral referralObject = new userReferral { userId = phoneNumbers, availReward = true, referredByCode = referred, rewardBalance = 0, referralCode = "Furqan_xw7e" }; callApi.CreateReferralCode(referralObject); await Navigation.PushAsync(new MenuPage()); } } catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } } }
private async Task RunDrive() { var driveApi = new GoogleDriveAPI(); await driveApi.ListFiles(); }
public async void signUp_button(object sender, EventArgs e) { String UUIDs = Guid.NewGuid().ToString(); if (checkTextField()) { var deviceIds = CrossDeviceInfo.Current.Id; // string simNumber = ""; // string deviceIdJson = ""; // var content = await _client.GetStringAsync(url); // List<Dictionary<string, object>> posts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(content); // foreach (Dictionary<string, object> i in posts) // { // Dictionary<string, object> post = JsonConvert.DeserializeObject<Dictionary<string, object>>(Convert.ToString(i["properties"])); // deviceIdJson = Convert.ToString(post["deviceId"]); // if (deviceIdJson == deviceId) // { // simNumber = Convert.ToString(post["simNumber"]); // } // } // await Navigation.PushModalAsync(new TermAndService()); try { string names = name; string emailId = email; string subrubs = subrub.Text; var statesPickers = statesPicker.Items[statesPicker.SelectedIndex]; string statess = statesPickers; string postCodee = postCode.Text; string countrys = "Australia"; string userTypes = "C"; string latitude = "45"; string longitude = "45"; var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 100; if (Device.RuntimePlatform == Device.iOS) { var position = await locator.GetPositionAsync(); latitude = "" + position.Latitude; longitude = "" + position.Longitude; } else if (Device.RuntimePlatform == Device.Android) { var position = await locator.GetPositionAsync(); latitude = "" + position.Latitude; longitude = "" + position.Longitude; } string folderID = GoogleDriveAPI.createUserFolder("User_" + UUIDs); SignupBean bean = new SignupBean { name = names, email = emailId, subrub = subrubs, states = statess, postCodes = postCodee, country = countrys, userType = userTypes, phoneNumber = phoneNumbers, deviceId = deviceIds, latitude = latitude, longitude = longitude, UUID = UUIDs, folderId = folderID, imageId = "", rewardCard1 = "", rewardCard2 = "" }; IsJobOnlineSeeker bean2 = new IsJobOnlineSeeker { fullName = name, simNumber = phoneNumbers, isJobSeeker = "true" }; Application.Current.Properties["phoneNumber"] = phoneNumbers; Application.Current.Properties["isOnlineJobSeeker"] = true; reloadData.Add("country", countrys); reloadData.Add("UniqueID", UUIDs); reloadData.Add("fullName", names); reloadData.Add("deviceId", deviceIds); reloadData.Add("suburb", subrubs); reloadData.Add("postCode", postCodee); reloadData.Add("state", statess); reloadData.Add("userType", userTypes); reloadData.Add("simNumber", phoneNumbers); reloadData.Add("gdFolderId", folderID); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", emailId); reloadData.Add("gdProfileImageId", ""); ShareUserData.getUserData = reloadData; ApiCalling callApi = new ApiCalling(); // GlobalVaribles golbalVarible = new GlobalVaribles(); // golbalVarible.setData(bean); callApi.signupPost(bean); callApi.isJobOnlineSeeker(bean2); // // string folderID = GoogleDriveAPI.createUserFolder("User_"+UUIDs); await Navigation.PushAsync(new MenuPage()); } catch (Exception ex) { await DisplayAlert("Alert", "" + ex, "ok"); } } }