private void uiFileDownloadButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (NetworkInterface.GetIsNetworkAvailable()) { IStorageManager storageManager = Switcher.GetCurrentStorage(); if (storageManager.IsSignIn()) { string fileId = ((Button)sender).Tag.ToString(); foreach (FileObjectViewItem fileObjectViewItem in this.PickFileObjectViewModel.Items) { if (fileObjectViewItem.Id == fileId) { this.PickFileAsync(storageManager, fileObjectViewItem); break; } } } else { base.ShowMessageDialog(AppResources.NoCurrentCloudSignInMessage, OK_CANCEL_MODE, async() => { // Show Loading message and save is login true for pivot moving action while sign in. await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { uiPickFileList.Visibility = Visibility.Collapsed; uiPickFileListMessage.Text = AppResources.DoingSignIn; uiPickFileListMessage.Visibility = Visibility.Visible; }); base.SetProgressRing(uiPickPivotFileListProgressRing, true); try { if (!storageManager.IsSigningIn()) { TaskHelper.AddSignInTask(storageManager.GetStorageName(), storageManager.SignIn()); } await TaskHelper.WaitSignInTask(storageManager.GetStorageName()); } catch { base.ShowMessageDialog(AppResources.BadSignInMessage, OK_MODE); } await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { uiPickFileList.Visibility = Visibility.Visible; uiPickFileListMessage.Visibility = Visibility.Collapsed; }); base.SetProgressRing(uiPickPivotFileListProgressRing, false); }); } } else { base.ShowMessageDialog(AppResources.InternetUnavailableMessage, OK_MODE); } }
/// 이 섹션에서 제공되는 메서드는 NavigationHelper에서 /// 페이지의 탐색 메서드에 응답하기 위해 사용됩니다. /// /// 페이지별 논리는 다음에 대한 이벤트 처리기에 있어야 합니다. /// <see cref="GridCS.Common.NavigationHelper.LoadState"/> /// 및 <see cref="GridCS.Common.NavigationHelper.SaveState"/>입니다. /// 탐색 매개 변수는 LoadState 메서드 /// 및 이전 세션 동안 유지된 페이지 상태에서 사용할 수 있습니다. protected override void OnNavigatedTo(NavigationEventArgs e) { this.NavigationHelper.OnNavigatedTo(e); // Check nick name at frist login. if (!App.ApplicationSettings.Contains(Switcher.MAIN_PLATFORM_TYPE_KEY)) { App.ApplicationSettings[Switcher.MAIN_PLATFORM_TYPE_KEY] = AppResources.OneDrive; } // Check nick name at frist login. if (!App.ApplicationSettings.Contains(StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY)) { App.ApplicationSettings[StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY] = AppResources.AtHere; } // Check location access consent at frist login. if (!App.ApplicationSettings.Contains(StorageAccount.LOCATION_ACCESS_CONSENT_KEY)) { App.ApplicationSettings[StorageAccount.LOCATION_ACCESS_CONSENT_KEY] = false; } // For Test this.SettingsForPresentation(); // Do Signin work of each cloud storage. if (App.AccountManager.IsSignIn()) { if (NetworkInterface.GetIsNetworkAvailable()) { TaskHelper.AddTask(App.AccountManager.GetPtcId(), App.AccountManager.SignIn()); using (var itr = StorageHelper.GetStorageEnumerator()) { while (itr.MoveNext()) { if (itr.Current.IsSignIn()) { TaskHelper.AddSignInTask(itr.Current.GetStorageName(), itr.Current.SignIn()); } } } } this.Frame.Navigate(typeof(SpotListPage)); } else { this.Frame.Navigate(typeof(SpotListPage)); } }
private async void uiPinFileSignInButton_Click(object sender, RoutedEventArgs e) { // If Internet available, Set pin list with root folder file list. // Otherwise, show internet bad message if (NetworkInterface.GetIsNetworkAvailable()) { // Show Loading message and save is login true for pivot moving action while sign in. await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { uiPinFileList.Visibility = Visibility.Collapsed; uiPinFileMessage.Text = AppResources.DoingSignIn; uiPinFileMessage.Visibility = Visibility.Visible; uiPinFileListGrid.Visibility = Visibility.Visible; uiPinFileSignInPanel.Visibility = Visibility.Collapsed; }); base.SetProgressRing(uiPinPivotProgressRing, true); try { // Sign in and await that task. // If sign in success, set list. IStorageManager iStorageManager = Switcher.GetCurrentStorage(); if (!iStorageManager.IsSigningIn()) { TaskHelper.AddSignInTask(iStorageManager.GetStorageName(), iStorageManager.SignIn()); } await TaskHelper.WaitSignInTask(iStorageManager.GetStorageName()); this.SetPinFileListAsync(iStorageManager, AppResources.Loading, null); } catch { base.ShowMessageDialog(AppResources.BadSignInMessage, OK_MODE); uiPinFileListGrid.Visibility = Visibility.Collapsed; uiPinFileSignInPanel.Visibility = Visibility.Visible; base.SetProgressRing(uiPinPivotProgressRing, false); } } else { base.ShowMessageDialog(AppResources.InternetUnavailableMessage, OK_MODE); } }
public void TestInit1() { //App.MobileService = new MobileServiceClient( // "https://pinthecloud.azure-mobile.net/", // "yvulzHAGRgNsGnPLHKcEFCPJcuyzKj23" //); App.ApplicationSessions = new WSApplicationSessions(); App.ApplicationSettings = new WSApplicationSettings(); // Manager App.SpotManager = new SpotManager(); App.Geolocator = new Geolocator(); App.BlobStorageManager = new BlobStorageManager(); App.LocalStorageManager = new LocalStorageManager(); IStorageManager OneDriveManager = new OneDriveManager(); IStorageManager DropBoxManager = new DropboxManager(); IStorageManager GoogleDriveManger = new GoogleDriveManager(); ///////////////////////////////////////////////////// // This order will be displayed at every App Pages ///////////////////////////////////////////////////// StorageHelper.AddStorageManager(OneDriveManager.GetStorageName(), OneDriveManager); StorageHelper.AddStorageManager(DropBoxManager.GetStorageName(), DropBoxManager); StorageHelper.AddStorageManager(GoogleDriveManger.GetStorageName(), GoogleDriveManger); Switcher.SetStorageToMainPlatform(); App.AccountManager = new AccountManager(); if (!App.ApplicationSettings.Contains(Switcher.MAIN_PLATFORM_TYPE_KEY)) { App.ApplicationSettings[Switcher.MAIN_PLATFORM_TYPE_KEY] = AppResources.OneDrive; } // Check nick name at frist login. if (!App.ApplicationSettings.Contains(StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY)) { App.ApplicationSettings[StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY] = AppResources.AtHere; } // Check location access consent at frist login. if (!App.ApplicationSettings.Contains(StorageAccount.LOCATION_ACCESS_CONSENT_KEY)) { App.ApplicationSettings[StorageAccount.LOCATION_ACCESS_CONSENT_KEY] = false; } // Do Signin work of each cloud storage. if (App.AccountManager.IsSignIn()) { if (NetworkInterface.GetIsNetworkAvailable()) { TaskHelper.AddTask(App.AccountManager.GetPtcId(), App.AccountManager.SignIn()); using (var itr = StorageHelper.GetStorageEnumerator()) { while (itr.MoveNext()) { if (itr.Current.IsSignIn()) { TaskHelper.AddSignInTask(itr.Current.GetStorageName(), itr.Current.SignIn()); } } } } } }