protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                if (e.Parameter is Tuple <Frame, object> Parameters)
                {
                    FileControlNav = Parameters.Item1;

                    PhotoDisplaySupport Item = Parameters.Item2 as PhotoDisplaySupport;
                    OriginFile  = (await Item.PhotoFile.GetStorageItem().ConfigureAwait(true)) as StorageFile;
                    OriginImage = await Item.GenerateImageWithRotation().ConfigureAwait(true);

                    OriginBackupImage = SoftwareBitmap.Copy(OriginImage);

                    WriteableBitmap WBitmap = new WriteableBitmap(OriginImage.PixelWidth, OriginImage.PixelHeight);
                    OriginImage.CopyToBuffer(WBitmap.PixelBuffer);
                    Cropper.Source = WBitmap;
                    UnchangeRegion = Cropper.CroppedRegion;

                    await AddEffectsToPane().ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 2
0
        protected async override void OnFileActivated(FileActivatedEventArgs args)
        {
            try
            {
                if (args.Verb == "USBArrival")
                {
                    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                    var viewTitleBar = ApplicationView.GetForCurrentView().TitleBar;
                    viewTitleBar.ButtonBackgroundColor         = Colors.Transparent;
                    viewTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                    viewTitleBar.ButtonForegroundColor         = (Color)Resources["SystemBaseHighColor"];

                    if (Window.Current.Content is Frame)
                    {
                        await TabViewContainer.ThisPage.CreateNewTabAndOpenTargetFolder(args.Files[0].Path).ConfigureAwait(true);
                    }
                    else
                    {
                        ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, false, $"USBActivate||{args.Files[0].Path}");
                        Window.Current.Content = extendedSplash;
                    }

                    Window.Current.Activate();
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 3
0
 private void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e)
 {
     if (!e.IsTerminating && e.ExceptionObject is Exception ex)
     {
         ExceptionTracer.RequestBlueScreen(ex);
     }
 }
Esempio n. 4
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ApplicationData.Current.LocalSettings.Values["IsDoubleClickEnable"] is bool IsDoubleClick)
                {
                    SettingControl.IsDoubleClickEnable = IsDoubleClick;
                }
                else
                {
                    ApplicationData.Current.LocalSettings.Values["IsDoubleClickEnable"] = true;
                }

                if (ApplicationData.Current.LocalSettings.Values["DetachTreeViewAndPresenter"] is bool IsDetach)
                {
                    SettingControl.IsDetachTreeViewAndPresenter = IsDetach;
                }
                else
                {
                    ApplicationData.Current.LocalSettings.Values["DetachTreeViewAndPresenter"] = false;
                }

                PageDictionary = new Dictionary <Type, string>()
                {
                    { typeof(TabViewContainer), Globalization.GetString("MainPage_PageDictionary_ThisPC_Label") },
                    { typeof(FileControl), Globalization.GetString("MainPage_PageDictionary_ThisPC_Label") },
                    { typeof(SecureArea), Globalization.GetString("MainPage_PageDictionary_SecureArea_Label") },
                    { typeof(RecycleBin), Globalization.GetString("MainPage_PageDictionary_RecycleBin_Label") }
                };

                await BackgroundController.Current.Initialize().ConfigureAwait(true);

                if (WindowsVersionChecker.IsNewerOrEqual(WindowsVersionChecker.Version.Windows10_1903) && AnimationController.Current.IsEnableAnimation && !IsPathActivate)
                {
                    EntranceEffectProvider.StartEntranceEffect();
                }

                Nav.Navigate(typeof(TabViewContainer), null, new DrillInNavigationTransitionInfo());

                await GetUserInfoAsync().ConfigureAwait(true);

                await ShowReleaseLogDialogAsync().ConfigureAwait(true);

                await RegisterBackgroundTaskAsync().ConfigureAwait(true);

                await PurchaseApplicationAsync().ConfigureAwait(true);

                await Task.Delay(10000).ConfigureAwait(true);

                await PinApplicationToTaskBarAsync().ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 5
0
 private void DismissExtendedSplash()
 {
     try
     {
         Frame rootFrame = new Frame();
         Window.Current.Content = rootFrame;
         rootFrame.Navigate(typeof(MainPage), SplashImageRect);
     }
     catch (Exception ex)
     {
         ExceptionTracer.RequestBlueScreen(ex);
     }
 }
 private static void GoBack()
 {
     try
     {
         MainPage.ThisPage.Nav.Navigate(typeof(TabViewContainer), null, new SlideNavigationTransitionInfo()
         {
             Effect = SlideNavigationTransitionEffect.FromLeft
         });
     }
     catch (Exception ex)
     {
         ExceptionTracer.RequestBlueScreen(ex);
     }
 }
Esempio n. 7
0
        private async void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            try
            {
                if (args.IsSettingsInvoked)
                {
                    _ = FindName(nameof(SettingControl));

                    await SettingControl.Show().ConfigureAwait(true);

                    NavView.IsBackEnabled = true;
                }
                else
                {
                    if ((SettingControl?.IsOpened).GetValueOrDefault())
                    {
                        await SettingControl.Hide().ConfigureAwait(true);
                    }

                    if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_ThisPC_Label"))
                    {
                        NavView.IsBackEnabled = (TabViewContainer.CurrentTabNavigation?.CanGoBack).GetValueOrDefault();
                        Nav.Navigate(typeof(TabViewContainer), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = SlideNavigationTransitionEffect.FromLeft
                        });
                    }
                    else if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_SecureArea_Label"))
                    {
                        NavView.IsBackEnabled = false;
                        Nav.Navigate(typeof(SecureArea), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = SlideNavigationTransitionEffect.FromRight
                        });
                    }
                    else if (args.InvokedItem.ToString() == Globalization.GetString("MainPage_PageDictionary_RecycleBin_Label"))
                    {
                        NavView.IsBackEnabled = false;
                        Nav.Navigate(typeof(RecycleBin), null, new SlideNavigationTransitionInfo()
                        {
                            Effect = Nav.CurrentSourcePageType == typeof(SecureArea) ? SlideNavigationTransitionEffect.FromLeft : SlideNavigationTransitionEffect.FromRight
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
 private void Adjust_Click(object sender, RoutedEventArgs e)
 {
     IsNavigateToCropperPage = true;
     try
     {
         if (AnimationController.Current.IsEnableAnimation)
         {
             FileControlInstance.Nav.Navigate(typeof(CropperPage), new Tuple <Frame, object>(FileControlInstance.Nav, Flip.SelectedItem), new DrillInNavigationTransitionInfo());
         }
         else
         {
             FileControlInstance.Nav.Navigate(typeof(CropperPage), new Tuple <Frame, object>(FileControlInstance.Nav, Flip.SelectedItem), new SuppressNavigationTransitionInfo());
         }
     }
     catch (Exception ex)
     {
         ExceptionTracer.RequestBlueScreen(ex);
     }
 }
Esempio n. 9
0
 private void LibraryGrid_DoubleTapped(object sender, Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
 {
     try
     {
         if (SettingControl.IsInputFromPrimaryButton && (e.OriginalSource as FrameworkElement)?.DataContext is LibraryFolder Library)
         {
             if (AnimationController.Current.IsEnableAnimation)
             {
                 Nav.Navigate(typeof(FileControl), new Tuple <TabViewItem, StorageFolder, ThisPC>(TabItem, Library.Folder, this), new DrillInNavigationTransitionInfo());
             }
             else
             {
                 Nav.Navigate(typeof(FileControl), new Tuple <TabViewItem, StorageFolder, ThisPC>(TabItem, Library.Folder, this), new SuppressNavigationTransitionInfo());
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionTracer.RequestBlueScreen(ex);
     }
 }
Esempio n. 10
0
        private async void DeviceGrid_DoubleTapped(object sender, Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
        {
            try
            {
                if (SettingControl.IsInputFromPrimaryButton && (e.OriginalSource as FrameworkElement)?.DataContext is HardDeviceInfo Device)
                {
                    if (string.IsNullOrEmpty(Device.Folder.Path))
                    {
                        QueueContentDialog Dialog = new QueueContentDialog
                        {
                            Title             = Globalization.GetString("Common_Dialog_TipTitle"),
                            Content           = Globalization.GetString("QueueDialog_MTP_CouldNotAccess_Content"),
                            PrimaryButtonText = Globalization.GetString("Common_Dialog_ContinueButton"),
                            CloseButtonText   = Globalization.GetString("Common_Dialog_CancelButton")
                        };

                        if ((await Dialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary)
                        {
                            await Launcher.LaunchFolderAsync(Device.Folder);
                        }
                    }
                    else
                    {
                        if (AnimationController.Current.IsEnableAnimation)
                        {
                            Nav.Navigate(typeof(FileControl), new Tuple <TabViewItem, StorageFolder, ThisPC>(TabItem, Device.Folder, this), new DrillInNavigationTransitionInfo());
                        }
                        else
                        {
                            Nav.Navigate(typeof(FileControl), new Tuple <TabViewItem, StorageFolder, ThisPC>(TabItem, Device.Folder, this), new SuppressNavigationTransitionInfo());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 11
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            try
            {
                if (args.Verb == "USBArrival")
                {
                    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                    var viewTitleBar = ApplicationView.GetForCurrentView().TitleBar;
                    viewTitleBar.ButtonBackgroundColor         = Colors.Transparent;
                    viewTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                    viewTitleBar.ButtonForegroundColor         = (Color)Resources["SystemBaseHighColor"];

                    ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, false, $"PathActivate||{args.Files[0].Path}");
                    Window.Current.Content = extendedSplash;

                    Window.Current.Activate();
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 12
0
        private async Task DismissExtendedSplashAsync()
        {
            try
            {
                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    Frame rootFrame        = new Frame();
                    Window.Current.Content = rootFrame;

                    if (string.IsNullOrEmpty(ActivateParameter))
                    {
                        rootFrame.Navigate(typeof(MainPage), SplashImageRect);
                    }
                    else
                    {
                        rootFrame.Navigate(typeof(MainPage), new Tuple <string, Rect>(ActivateParameter, SplashImageRect));
                    }
                });
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 13
0
 private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
 {
     ExceptionTracer.RequestBlueScreen(e.Exception);
     e.Handled = true;
 }
Esempio n. 14
0
        private async void SecureArea_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ApplicationData.Current.LocalSettings.Values.ContainsKey("IsFirstEnterSecureArea"))
                {
                    UnlockPassword       = CredentialProtector.GetPasswordFromProtector("SecureAreaPrimaryPassword");
                    FileEncryptionAesKey = KeyGenerator.GetMD5FromKey(UnlockPassword, 16);
                    AESKeySize           = Convert.ToInt32(ApplicationData.Current.LocalSettings.Values["SecureAreaAESKeySize"]);

                    if (!(ApplicationData.Current.LocalSettings.Values["SecureAreaLockMode"] is string LockMode) || LockMode != nameof(CloseLockMode) || IsNewStart)
                    {
                        if (Convert.ToBoolean(ApplicationData.Current.LocalSettings.Values["SecureAreaEnableWindowsHello"]))
                        {
RETRY:
                            switch (await WindowsHelloAuthenticator.VerifyUserAsync().ConfigureAwait(true))
                            {
                            case AuthenticatorState.VerifyPassed:
                            {
                                break;
                            }

                            case AuthenticatorState.UnknownError:
                            case AuthenticatorState.VerifyFailed:
                            {
                                QueueContentDialog Dialog = new QueueContentDialog
                                {
                                    Title               = Globalization.GetString("Common_Dialog_ErrorTitle"),
                                    Content             = Globalization.GetString("QueueDialog_WinHelloAuthFail_Content"),
                                    PrimaryButtonText   = Globalization.GetString("Common_Dialog_TryAgain"),
                                    SecondaryButtonText = Globalization.GetString("Common_Dialog_UsePassword"),
                                    CloseButtonText     = Globalization.GetString("Common_Dialog_GoBack")
                                };

                                ContentDialogResult Result = await Dialog.ShowAsync().ConfigureAwait(true);

                                if (Result == ContentDialogResult.Primary)
                                {
                                    goto RETRY;
                                }
                                else if (Result == ContentDialogResult.Secondary)
                                {
                                    if (!await EnterByPassword().ConfigureAwait(true))
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    GoBack();
                                    return;
                                }
                                break;
                            }

                            case AuthenticatorState.UserNotRegistered:
                            case AuthenticatorState.CredentialNotFound:
                            {
                                QueueContentDialog Dialog = new QueueContentDialog
                                {
                                    Title           = Globalization.GetString("Common_Dialog_ErrorTitle"),
                                    Content         = Globalization.GetString("QueueDialog_WinHelloCredentialLost_Content"),
                                    CloseButtonText = Globalization.GetString("Common_Dialog_CloseButton")
                                };
                                _ = await Dialog.ShowAsync().ConfigureAwait(true);

                                ApplicationData.Current.LocalSettings.Values["SecureAreaEnableWindowsHello"] = false;

                                if (!await EnterByPassword().ConfigureAwait(true))
                                {
                                    return;
                                }
                                break;
                            }

                            case AuthenticatorState.WindowsHelloUnsupport:
                            {
                                QueueContentDialog Dialog = new QueueContentDialog
                                {
                                    Title             = Globalization.GetString("Common_Dialog_WarningTitle"),
                                    Content           = Globalization.GetString("QueueDialog_WinHelloDisable_Content"),
                                    PrimaryButtonText = Globalization.GetString("Common_Dialog_UsePassword"),
                                    CloseButtonText   = Globalization.GetString("Common_Dialog_GoBack")
                                };

                                ApplicationData.Current.LocalSettings.Values["SecureAreaEnableWindowsHello"] = false;

                                if ((await Dialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary)
                                {
                                    if (!await EnterByPassword().ConfigureAwait(true))
                                    {
                                        return;
                                    }
                                }
                                else
                                {
                                    GoBack();
                                    return;
                                }
                                break;
                            }
                            }
                        }
                        else
                        {
                            if (!await EnterByPassword().ConfigureAwait(true))
                            {
                                return;
                            }
                        }
                    }
                }
                else
                {
                    if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("SecureAreaUsePermission"))
                    {
                        try
                        {
                            LoadingText.Text                   = Globalization.GetString("Progress_Tip_CheckingLicense");
                            CancelButton.Visibility            = Visibility.Collapsed;
                            LoadingControl.IsLoading           = true;
                            MainPage.ThisPage.IsAnyTaskRunning = true;

                            if (await CheckPurchaseStatusAsync().ConfigureAwait(true))
                            {
                                if (MainPage.ThisPage.Nav.CurrentSourcePageType.Name != nameof(SecureArea))
                                {
                                    GoBack();
                                    return;
                                }

                                ApplicationData.Current.LocalSettings.Values["SecureAreaUsePermission"] = true;
                                await Task.Delay(500).ConfigureAwait(true);
                            }
                            else
                            {
                                if (MainPage.ThisPage.Nav.CurrentSourcePageType.Name != nameof(SecureArea))
                                {
                                    GoBack();
                                    return;
                                }

                                SecureAreaIntroDialog IntroDialog = new SecureAreaIntroDialog();
                                if ((await IntroDialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary)
                                {
                                    if (await PurchaseAsync().ConfigureAwait(true))
                                    {
                                        ApplicationData.Current.LocalSettings.Values["SecureAreaUsePermission"] = true;

                                        QueueContentDialog SuccessDialog = new QueueContentDialog
                                        {
                                            Title           = Globalization.GetString("Common_Dialog_WarningTitle"),
                                            Content         = Globalization.GetString("QueueDialog_SecureAreaUnlock_Content"),
                                            CloseButtonText = Globalization.GetString("Common_Dialog_CloseButton")
                                        };
                                        _ = await SuccessDialog.ShowAsync().ConfigureAwait(true);
                                    }
                                    else
                                    {
                                        GoBack();
                                        return;
                                    }
                                }
                                else
                                {
                                    GoBack();
                                    return;
                                }
                            }
                        }
                        catch (NetworkException)
                        {
                            QueueContentDialog ErrorDialog = new QueueContentDialog
                            {
                                Title           = Globalization.GetString("Common_Dialog_ErrorTitle"),
                                Content         = Globalization.GetString("QueueDialog_SecureAreaNetworkUnavailable_Content"),
                                CloseButtonText = Globalization.GetString("Common_Dialog_GoBack")
                            };
                            _ = await ErrorDialog.ShowAsync().ConfigureAwait(true);

                            GoBack();
                            return;
                        }
                        finally
                        {
                            await Task.Delay(500).ConfigureAwait(true);

                            LoadingControl.IsLoading           = false;
                            MainPage.ThisPage.IsAnyTaskRunning = false;
                        }
                    }

                    SecureAreaWelcomeDialog Dialog = new SecureAreaWelcomeDialog();
                    if ((await Dialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary)
                    {
                        AESKeySize           = Dialog.AESKeySize;
                        UnlockPassword       = Dialog.Password;
                        FileEncryptionAesKey = KeyGenerator.GetMD5FromKey(UnlockPassword, 16);
                        CredentialProtector.RequestProtectPassword("SecureAreaPrimaryPassword", UnlockPassword);

                        ApplicationData.Current.LocalSettings.Values["SecureAreaAESKeySize"]         = Dialog.AESKeySize;
                        ApplicationData.Current.LocalSettings.Values["SecureAreaEnableWindowsHello"] = Dialog.IsEnableWindowsHello;
                        ApplicationData.Current.LocalSettings.Values["IsFirstEnterSecureArea"]       = false;
                    }
                    else
                    {
                        if (Dialog.IsEnableWindowsHello)
                        {
                            await WindowsHelloAuthenticator.DeleteUserAsync().ConfigureAwait(true);
                        }

                        GoBack();

                        return;
                    }
                }

                await StartLoadFile().ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 15
0
        private async void Screen_Dismissed(SplashScreen sender, object args)
        {
            try
            {
                if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("QuickStartInitialFinished1"))
                {
                    await SQLite.Current.ClearTableAsync("QuickStart").ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_1"), "ms-appx:///QuickStartImage/MicrosoftStore.png", "ms-windows-store://home", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_2"), "ms-appx:///QuickStartImage/Calculator.png", "calculator:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_3"), "ms-appx:///QuickStartImage/Setting.png", "ms-settings:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_4"), "ms-appx:///QuickStartImage/Email.png", "mailto:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_5"), "ms-appx:///QuickStartImage/Calendar.png", "outlookcal:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_6"), "ms-appx:///QuickStartImage/Photos.png", "ms-photos:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_7"), "ms-appx:///QuickStartImage/Weather.png", "msnweather:", QuickStartType.Application).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_9"), "ms-appx:///HotWebImage/Facebook.png", "https://www.facebook.com/", QuickStartType.WebSite).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_10"), "ms-appx:///HotWebImage/Instagram.png", "https://www.instagram.com/", QuickStartType.WebSite).ConfigureAwait(false);

                    await SQLite.Current.SetQuickStartItemAsync(Globalization.GetString("ExtendedSplash_QuickStartItem_Name_11"), "ms-appx:///HotWebImage/Twitter.png", "https://twitter.com", QuickStartType.WebSite).ConfigureAwait(false);

                    ApplicationData.Current.LocalSettings.Values["QuickStartInitialFinished1"] = true;
                }

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/MicrosoftStore.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_1"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Calculator.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_2"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Setting.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_3"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Email.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_4"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Calendar.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_5"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Photos.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_6"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///QuickStartImage/Weather.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_7"), QuickStartType.Application).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///HotWebImage/Facebook.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_9"), QuickStartType.WebSite).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///HotWebImage/Instagram.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_10"), QuickStartType.WebSite).ConfigureAwait(false);

                await SQLite.Current.UpdateQuickStartItemAsync("ms-appx:///HotWebImage/Twitter.png", Globalization.GetString("ExtendedSplash_QuickStartItem_Name_11"), QuickStartType.WebSite).ConfigureAwait(false);

                bool IsFileAccessible = await CheckFileAccessAuthority().ConfigureAwait(false);

                if (IsFileAccessible)
                {
                    await DismissExtendedSplashAsync().ConfigureAwait(false);
                }
                else
                {
                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        Display.Text          = Globalization.GetString("ExtendedSplash_Access_Tips");
                        ButtonPane.Visibility = Visibility.Visible;
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
        }
Esempio n. 16
0
        private async Task Initialize()
        {
            if (IsNavigateToCropperPage)
            {
                IsNavigateToCropperPage = false;
                await PhotoCollection[Flip.SelectedIndex].UpdateImage().ConfigureAwait(true);
                return;
            }

            try
            {
                ExitLocker   = new ManualResetEvent(false);
                Cancellation = new CancellationTokenSource();
                LoadQueue    = new Queue <int>();

                MainPage.ThisPage.IsAnyTaskRunning = true;

                Behavior.Attach(Flip);

                List <FileSystemStorageItemBase> FileList = WIN_Native_API.GetStorageItems(FileControlInstance.CurrentFolder, false, ItemFilters.File).Where((Item) => Item.Type.Equals(".png", StringComparison.OrdinalIgnoreCase) || Item.Type.Equals(".jpg", StringComparison.OrdinalIgnoreCase) || Item.Type.Equals(".bmp", StringComparison.OrdinalIgnoreCase)).ToList();

                int LastSelectIndex = FileList.FindIndex((Photo) => Photo.Name == SelectedPhotoName);
                if (LastSelectIndex < 0 || LastSelectIndex >= FileList.Count)
                {
                    LastSelectIndex = 0;
                }

                if (FileList.Count == 0)
                {
                    QueueContentDialog Dialog = new QueueContentDialog
                    {
                        Title           = Globalization.GetString("Common_Dialog_ErrorTitle"),
                        Content         = Globalization.GetString("Queue_Dialog_ImageReadError_Content"),
                        CloseButtonText = Globalization.GetString("Common_Dialog_GoBack")
                    };
                    _ = await Dialog.ShowAsync().ConfigureAwait(true);

                    FileControlInstance.Nav.GoBack();
                    return;
                }

                PhotoCollection  = new ObservableCollection <PhotoDisplaySupport>(FileList.Select((Item) => new PhotoDisplaySupport(Item)));
                Flip.ItemsSource = PhotoCollection;

                if (!await PhotoCollection[LastSelectIndex].ReplaceThumbnailBitmapAsync().ConfigureAwait(true))
                {
                    CouldnotLoadTip.Visibility = Visibility.Visible;
                }

                for (int i = LastSelectIndex - 5 > 0 ? LastSelectIndex - 5 : 0; i <= (LastSelectIndex + 5 < PhotoCollection.Count - 1 ? LastSelectIndex + 5 : PhotoCollection.Count - 1) && !Cancellation.IsCancellationRequested; i++)
                {
                    await PhotoCollection[i].GenerateThumbnailAsync().ConfigureAwait(true);
                }

                if (!Cancellation.IsCancellationRequested)
                {
                    Flip.SelectedIndex     = LastSelectIndex;
                    Flip.SelectionChanged += Flip_SelectionChanged;
                    Flip.SelectionChanged += Flip_SelectionChanged1;

                    await EnterAnimation.BeginAsync().ConfigureAwait(true);
                }
            }
            catch (Exception ex)
            {
                ExceptionTracer.RequestBlueScreen(ex);
            }
            finally
            {
                MainPage.ThisPage.IsAnyTaskRunning = false;
                ExitLocker.Set();
            }
        }