Esempio n. 1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            AppService.SetAppViewBackButtonVisibility(true);
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            UiService.HideStatusBar();

            var parameters = NavigateService.GetNavigationObject(e.Parameter).Parameters;

            _parentFolder = parameters[NavigationParamType.Data] as FolderViewModel;

            if (_parentFolder == null)
            {
                // If something went wrong, disables the command bars
                this.TopCommandBar.IsEnabled    = false;
                this.BottomCommandBar.IsEnabled = false;

                await DialogService.ShowAlertAsync(
                    ResourceService.AppMessages.GetString("AM_PreviewImageFailed_Title"),
                    ResourceService.AppMessages.GetString("AM_PreviewImageInitFailed"));

                return;
            }

            this.ViewModel.Initialize(_parentFolder);

            base.OnNavigatedTo(e);
        }
Esempio n. 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var navObject = NavigateService.GetNavigationObject(e.Parameter);

            if (navObject == null)
            {
                return;
            }
            this.ViewModel.ConfirmLink = navObject.Parameters[NavigationParamType.Data] as string;
            this.ViewModel.Email       = navObject.Parameters[NavigationParamType.Email] as string;
        }
Esempio n. 3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var navObject = NavigateService.GetNavigationObject(e.Parameter);

            if (navObject == null)
            {
                return;
            }
            this.ViewModel.Email     = navObject.Parameters[NavigationParamType.Email] as string;
            this.ViewModel.Password  = navObject.Parameters[NavigationParamType.Password] as string;
            this.ViewModel.FirstName = navObject.Parameters[NavigationParamType.FirstName] as string;
            this.ViewModel.LastName  = navObject.Parameters[NavigationParamType.LastName] as string;
        }
Esempio n. 4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            this.ViewModel.Initialize();

            SettingsService.ReloadSettingsRequested += OnReloadSettingsRequested;

            var navObj        = NavigateService.GetNavigationObject(e.Parameter) as NavigationObject;
            var navActionType = navObj?.Action ?? NavigationActionType.Default;

            if (navActionType == NavigationActionType.SecuritySettings)
            {
                this.MainPivot.SelectedItem = this.SecurityPivot;
            }
        }
Esempio n. 5
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            this.ViewModel.Initialize();
            this.GeneralView.ViewModel.GoToUpgrade            += GoToUpgrade;
            this.GeneralView.ViewModel.GoToAchievements       += GoToAchievements;
            this.StorageAndTransferView.ViewModel.GoToUpgrade += GoToUpgrade;

            var navObj        = NavigateService.GetNavigationObject(e.Parameter) as NavigationObject;
            var navActionType = navObj?.Action ?? NavigationActionType.Default;

            if (navActionType == NavigationActionType.Upgrade)
            {
                this.MyAccountPivot.SelectedItem = this.UpgradePivot;
            }
        }
Esempio n. 6
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.ViewModel.Initialize(App.GlobalListener);

            this.ViewModel.CloudDrive.FolderNavigatedTo += OnFolderNavigatedTo;
            this.ViewModel.RubbishBin.FolderNavigatedTo += OnFolderNavigatedTo;

            var navObj        = NavigateService.GetNavigationObject(e.Parameter) as NavigationObject;
            var navActionType = navObj?.Action ?? NavigationActionType.Default;

            if (navActionType == NavigationActionType.RubbishBin)
            {
                this.MainPivot.SelectedItem = this.RubbishBinPivot;
            }
        }
Esempio n. 7
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.ContentFrame.Navigated += ContentFrameOnNavigated;

            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            var navObj        = NavigateService.GetNavigationObject(e.Parameter) as NavigationObject;
            var navActionType = navObj?.Action ?? NavigationActionType.Default;

            // Check if the user has an active and online session, because this is the first page loaded
            if (!await AppService.CheckActiveAndOnlineSessionAsync(true))
            {
                return;
            }

            // Check if the user has an active internet connection
            if (!NetworkService.HasInternetAccess())
            {
                // If not active internet connection, navigate to the offline section
                NavigateService.Instance.Navigate(typeof(SavedForOfflinePage));
                return;
            }

            // If user has an active and online session but is not logged in, resume the session
            if (!Convert.ToBoolean(SdkService.MegaSdk.isLoggedIn()))
            {
                if (!await this.ViewModel.FastLoginAsync())
                {
                    return;
                }
            }

            this.ViewModel.Initialize(navActionType);

            if (DebugService.DebugSettings.IsDebugMode && DebugService.DebugSettings.ShowDebugAlert)
            {
                DialogService.ShowDebugModeAlert();
            }
        }
Esempio n. 8
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Do not allow user to go back to any previous page
            NavigateService.CoreFrame.BackStack.Clear();
            AppService.SetAppViewBackButtonVisibility(false);

            // If exists a navigation object
            if (e?.Parameter != null)
            {
                var navObj = NavigateService.GetNavigationObject(e.Parameter);
                NavigationActionType navActionType = navObj.Action;

                // Try to avoid display duplicate alerts
                if (isAlertAlreadyDisplayed)
                {
                    return;
                }
                isAlertAlreadyDisplayed = true;

                switch (navActionType)
                {
                case NavigationActionType.Login:
                    this.ViewModel.LoginViewModel.Email = navObj.Parameters[NavigationParamType.Email] as string;
                    await DialogService.ShowAlertAsync(
                        ResourceService.AppMessages.GetString("AM_AlreadyConfirmedAccount_Title"),
                        ResourceService.AppMessages.GetString("AM_AlreadyConfirmedAccount"));

                    break;

                case NavigationActionType.Recovery:
                    this.ViewModel.LoginViewModel.Email    = navObj.Parameters[NavigationParamType.Email] as string;
                    this.ViewModel.LoginViewModel.Password = navObj.Parameters[NavigationParamType.Password] as string;
                    break;

                case NavigationActionType.API_ESID:
                    // Show a message notifying the error
                    await DialogService.ShowAlertAsync(
                        ResourceService.AppMessages.GetString("AM_SessionIDError_Title"),
                        ResourceService.AppMessages.GetString("AM_SessionIDError"));

                    break;

                case NavigationActionType.API_EBLOCKED:
                    string message;
                    switch ((AccountBlockedReason)navObj.Parameters[NavigationParamType.Number])
                    {
                    case AccountBlockedReason.Copyright:
                        message = ResourceService.AppMessages.GetString("AM_AccountBlockedCopyright");
                        break;

                    case AccountBlockedReason.OtherReason:
                    default:
                        message = ResourceService.AppMessages.GetString("AM_AccountBlocked");
                        break;
                    }

                    // Show a message notifying the error
                    await DialogService.ShowAlertAsync(
                        ResourceService.AppMessages.GetString("AM_AccountBlocked_Title"), message);

                    break;
                }

                isAlertAlreadyDisplayed = false;
            }

            if (DebugService.DebugSettings.IsDebugMode && DebugService.DebugSettings.ShowDebugAlert)
            {
                DialogService.ShowDebugModeAlert();
            }
        }
Esempio n. 9
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     this.ViewModel.RecoveryKey =
         NavigateService.GetNavigationObject(e.Parameter).Parameters[NavigationParamType.Data] as string;
 }