Exemplo n.º 1
0
        public static void LogoutActions()
        {
            // Disable the "camera upload" service if is enabled
            if (MediaService.GetAutoCameraUploadStatus())
            {
                LogService.Log(MLogLevel.LOG_LEVEL_INFO, "Disabling CAMERA UPLOADS service (LOGOUT)");
                MediaService.SetAutoCameraUpload(false);
            }

            // Clear settings, cache, previews, thumbnails, etc.
            SettingsService.ClearSettings();
            SettingsService.ClearMegaLoginData();
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                // Added extra checks preventing null reference exceptions
                if (App.MainPageViewModel == null)
                {
                    return;
                }

                if (App.MainPageViewModel.CloudDrive != null)
                {
                    App.MainPageViewModel.CloudDrive.ChildNodes.Clear();
                }

                if (App.MainPageViewModel.RubbishBin != null)
                {
                    App.MainPageViewModel.RubbishBin.ChildNodes.Clear();
                }
            });
            AppService.ClearAppCache(false);

            // Delete Account Details info
            AccountService.ClearAccountDetails();
        }