Example #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!NetworkService.IsNetworkAvailable())
            {
                UpdateGUI(false);
                return;
            }

            if (PhoneApplicationService.Current.StartupMode == StartupMode.Activate)
            {
                // Needed on every UI interaction
                SdkService.MegaSdk.retryPendingConnections();

                #if WINDOWS_PHONE_81
                // Check to see if any folder has been picked
                var app = Application.Current as App;
                if (app != null && app.FolderPickerContinuationArgs != null)
                {
                    FolderService.ContinueFolderOpenPicker(app.FolderPickerContinuationArgs,
                                                           this._sharedItemsViewModel.ActiveSharedFolderView);
                }
                #endif
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (App.AppInformation.IsStartupModeActivate)
            {
                // Needed on every UI interaction
                SdkService.MegaSdk.retryPendingConnections();

                if (!App.AppInformation.HasPinLockIntroduced && SettingsService.LoadSetting <bool>(SettingsResources.UserPinLockIsEnabled))
                {
                    NavigateService.NavigateTo(typeof(PasswordPage), NavigationParameter.Normal, this.GetType());
                    return;
                }

                App.AppInformation.IsStartupModeActivate = false;

                #if WINDOWS_PHONE_81
                // Check to see if any files have been picked
                var app = Application.Current as App;
                if (app != null && app.FolderPickerContinuationArgs != null)
                {
                    FolderService.ContinueFolderOpenPicker(app.FolderPickerContinuationArgs,
                                                           this._folderViewModel);
                }
                return;
                #endif
            }

            base.OnNavigatedTo(e);
        }
Example #3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!NetworkService.IsNetworkAvailable())
            {
                UpdateGUI(false);
                return;
            }

            _nodeDetailsViewModel.Initialize(App.GlobalListener);

            if (App.AppInformation.IsStartupModeActivate)
            {
                // Needed on every UI interaction
                SdkService.MegaSdk.retryPendingConnections();

                if (!App.AppInformation.HasPinLockIntroduced && SettingsService.LoadSetting <bool>(SettingsResources.UserPinLockIsEnabled))
                {
                    NavigateService.NavigateTo(typeof(PasswordPage), NavigationParameter.Normal, this.GetType());
                    return;
                }

                App.AppInformation.IsStartupModeActivate = false;

#if WINDOWS_PHONE_81
                // Check to see if any files have been picked
                var app = Application.Current as App;
                if (app != null && app.FolderPickerContinuationArgs != null)
                {
                    FolderService.ContinueFolderOpenPicker(app.FolderPickerContinuationArgs,
                                                           new FolderViewModel(SdkService.MegaSdk, App.AppInformation, _nodeViewModel.ParentContainerType));
                }
#endif
                return;
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Subscribe to the NetworkAvailabilityChanged event
            DeviceNetworkInformation.NetworkAvailabilityChanged +=
                new EventHandler <NetworkNotificationEventArgs>(NetworkAvailabilityChanged);

            if (App.AppInformation.IsStartupModeActivate)
            {
                // Needed on every UI interaction
                SdkService.MegaSdkFolderLinks.retryPendingConnections();

                if (!App.AppInformation.HasPinLockIntroduced && SettingsService.LoadSetting <bool>(SettingsResources.UserPinLockIsEnabled))
                {
                    NavigateService.NavigateTo(typeof(PasswordPage), NavigationParameter.Normal, this.GetType());
                    return;
                }

                App.AppInformation.IsStartupModeActivate = false;

                #if WINDOWS_PHONE_81
                // Check to see if some folder has been picked
                var app = Application.Current as App;
                if (app != null && app.FolderPickerContinuationArgs != null)
                {
                    FolderService.ContinueFolderOpenPicker(app.FolderPickerContinuationArgs,
                                                           _folderLinkViewModel.FolderLink);
                }
                #endif
            }

            if (!NetworkService.IsNetworkAvailable())
            {
                UpdateGUI(false);
                return;
            }

            // Initialize the application bar of this page
            SetApplicationBarData();

            if (!App.LinkInformation.HasFetchedNodesFolderLink)
            {
                if (!String.IsNullOrWhiteSpace(App.LinkInformation.ActiveLink))
                {
                    SdkService.MegaSdkFolderLinks.loginToFolder(App.LinkInformation.ActiveLink,
                                                                new LoginToFolderRequestListener(_folderLinkViewModel));
                }
                else
                {
                    var customMessageDialog = new CustomMessageDialog(
                        AppMessages.AM_OpenLinkFailed_Title,
                        AppMessages.AM_InvalidLink,
                        App.AppInformation,
                        MessageDialogButtons.Ok);

                    customMessageDialog.OkOrYesButtonTapped += (sender, args) => CancelAction();

                    customMessageDialog.ShowDialog();
                    return;
                }
            }
            else
            {
                if (e.NavigationMode != NavigationMode.Back)
                {
                    _folderLinkViewModel.LoadFolders();

                    if (App.LinkInformation.LinkAction == LinkAction.Download)
                    {
                        _folderLinkViewModel.FolderLink.MultipleDownload(App.LinkInformation.DownloadPath);
                    }
                }
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!NetworkService.IsNetworkAvailable())
            {
                UpdateGUI(false);
                return;
            }

            if (e.NavigationMode == NavigationMode.Reset)
            {
                return;
            }

            _cameraUploadsPageViewModel.Initialize(App.GlobalListener);

            NavigationParameter navParam = NavigateService.ProcessQueryString(NavigationContext.QueryString);

            if (PhoneApplicationService.Current.StartupMode == StartupMode.Activate)
            {
                // Needed on every UI interaction
                SdkService.MegaSdk.retryPendingConnections();

#if WINDOWS_PHONE_81
                // Check to see if any files have been picked
                var app = Application.Current as App;
                if (app != null && app.FilePickerContinuationArgs != null)
                {
                    this.ContinueFileOpenPicker(app.FilePickerContinuationArgs);
                    return;
                }

                if (app != null && app.FolderPickerContinuationArgs != null)
                {
                    FolderService.ContinueFolderOpenPicker(app.FolderPickerContinuationArgs,
                                                           _cameraUploadsPageViewModel.CameraUploads);
                }
#endif
            }

            // Initialize the application bar of this page
            SetApplicationBarData();

            if (e.NavigationMode == NavigationMode.Back)
            {
                navParam = NavigationParameter.Browsing;
            }


            switch (navParam)
            {
            case NavigationParameter.Normal:
                // Check if nodes has been fetched. Because when starting app from OS photo setting to go to
                // Auto Camera Upload settings fetching has been skipped in the mainpage
                if (Convert.ToBoolean(SdkService.MegaSdk.isLoggedIn()) && !App.AppInformation.HasFetchedNodes)
                {
                    _cameraUploadsPageViewModel.FetchNodes();
                }
                else
                {
                    _cameraUploadsPageViewModel.LoadFolders();
                }
                break;

            case NavigationParameter.Login:
                break;

            case NavigationParameter.PasswordLogin:
                break;

            case NavigationParameter.UriLaunch:
                break;

            case NavigationParameter.Browsing:
                // Check if nodes has been fetched. Because when starting app from OS photo setting to go to
                // Auto Camera Upload settings fetching has been skipped in the mainpage
                if (Convert.ToBoolean(SdkService.MegaSdk.isLoggedIn()) && !App.AppInformation.HasFetchedNodes)
                {
                    _cameraUploadsPageViewModel.FetchNodes();
                }
                break;

            case NavigationParameter.BreadCrumb:
                break;

            case NavigationParameter.Uploads:
                break;

            case NavigationParameter.Downloads:
                break;

            case NavigationParameter.DisablePassword:
                break;

            case NavigationParameter.FileLinkLaunch:
            case NavigationParameter.FolderLinkLaunch:
            case NavigationParameter.None:
            {
                if (!App.AppInformation.HasPinLockIntroduced && SettingsService.LoadSetting <bool>(SettingsResources.UserPinLockIsEnabled))
                {
                    NavigateService.NavigateTo(typeof(PasswordPage), NavigationParameter.Normal, this.GetType());
                    return;
                }
                break;
            }
            }
        }