protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            ListViewControl.AddHandler(PointerPressedEvent, PointerPressedHandler, true);
            CoreWindow.GetForCurrentThread().KeyDown += RecycleBin_KeyDown;
            SelectionExtention = new ListViewBaseSelectionExtention(ListViewControl, DrawRectangle);

            await ActivateLoading(true, Globalization.GetString("Progress_Tip_Loading"));

            using (FullTrustProcessController.ExclusiveUsage Exclusive = await FullTrustProcessController.GetAvailableController())
            {
                IReadOnlyList <IRecycleStorageItem> Result = await Exclusive.Controller.GetRecycleBinItemsAsync();

                FileCollection.AddRange(SortCollectionGenerator.GetSortedCollection(Result, SortTarget.Name, SortDirection.Ascending));
            }

            if (FileCollection.Count == 0)
            {
                HasFile.Visibility        = Visibility.Visible;
                ClearRecycleBin.IsEnabled = false;
            }
            else
            {
                HasFile.Visibility        = Visibility.Collapsed;
                ClearRecycleBin.IsEnabled = true;
            }

            await ActivateLoading(false);
        }
Esempio n. 2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            ListViewControl.AddHandler(PointerPressedEvent, PointerPressedHandler, true);
            CoreWindow.GetForCurrentThread().KeyDown += RecycleBin_KeyDown;
            SelectionExtention = new ListViewBaseSelectionExtention(ListViewControl, DrawRectangle);

            using (FullTrustProcessController.ExclusiveUsage Exclusive = await FullTrustProcessController.GetAvailableController())
            {
                List <IRecycleStorageItem> Result = await Exclusive.Controller.GetRecycleBinItemsAsync().ConfigureAwait(true);

                foreach (IRecycleStorageItem Item in SortCollectionGenerator.Current.GetSortedCollection(Result, SortTarget.Name, SortDirection.Ascending))
                {
                    FileCollection.Add(Item);
                }
            }

            if (FileCollection.Count == 0)
            {
                HasFile.Visibility        = Visibility.Visible;
                ClearRecycleBin.IsEnabled = false;
            }
            else
            {
                HasFile.Visibility        = Visibility.Collapsed;
                ClearRecycleBin.IsEnabled = true;
            }
        }
Esempio n. 3
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            CoreWindow.GetForCurrentThread().KeyDown -= SearchPage_KeyDown;
            Cancellation?.Cancel();

            SearchResultList.RemoveHandler(PointerPressedEvent, PointerPressedEventHandler);

            SelectionExtention.Dispose();
            SelectionExtention = null;

            if (e.NavigationMode == NavigationMode.Back)
            {
                SearchResult.Clear();
            }
        }
Esempio n. 4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e?.Parameter is Tuple <FileControl, SearchOptions> Parameters)
            {
                CoreWindow.GetForCurrentThread().KeyDown += SearchPage_KeyDown;

                SearchResultList.AddHandler(PointerPressedEvent, PointerPressedEventHandler, true);
                SelectionExtention = new ListViewBaseSelectionExtention(SearchResultList, DrawRectangle);

                if (e.NavigationMode == NavigationMode.New)
                {
                    WeakToFileControl = new WeakReference <FileControl>(Parameters.Item1);
                    await Initialize(Parameters.Item2).ConfigureAwait(false);
                }
            }
        }
Esempio n. 5
0
        private async void SecureArea_Loaded(object sender, RoutedEventArgs e)
        {
            WholeArea.Visibility = Visibility.Collapsed;

            SecureGridView.AddHandler(PointerPressedEvent, PointerPressedHandler, true);

            ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;

            if (ApplicationData.Current.LocalSettings.Values.ContainsKey("IsFirstEnterSecureArea"))
            {
                AESKeySize = Convert.ToInt32(ApplicationData.Current.LocalSettings.Values["SecureAreaAESKeySize"]);

                if (ApplicationData.Current.LocalSettings.Values["SecureAreaLockMode"] is not string LockMode || LockMode != nameof(CloseLockMode) || IsNewStart)
                {
                    if (Convert.ToBoolean(ApplicationData.Current.LocalSettings.Values["SecureAreaEnableWindowsHello"]))
                    {
RETRY:
                        switch (await WindowsHelloAuthenticator.VerifyUserAsync())
                        {
                        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();

                            if (Result == ContentDialogResult.Primary)
                            {
                                goto RETRY;
                            }
                            else if (Result == ContentDialogResult.Secondary)
                            {
                                if (!await EnterByPassword())
                                {
                                    return;
                                }
                            }
                            else
                            {
                                Frame.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();

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

                            if (!await EnterByPassword())
                            {
                                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()) == ContentDialogResult.Primary)
                            {
                                if (!await EnterByPassword())
                                {
                                    return;
                                }
                            }
                            else
                            {
                                Frame.GoBack();
                                return;
                            }

                            break;
                        }
                        }
                    }
                    else
                    {
                        if (!await EnterByPassword())
                        {
                            return;
                        }
                    }
                }
            }
            else
            {
                try
                {
                    await ActivateLoading(true, false, Globalization.GetString("Progress_Tip_CheckingLicense"));

                    if (await MSStoreHelper.Current.CheckPurchaseStatusAsync())
                    {
                        await Task.Delay(500);
                    }
                    else
                    {
                        SecureAreaIntroDialog IntroDialog = new SecureAreaIntroDialog();

                        if ((await IntroDialog.ShowAsync()) == ContentDialogResult.Primary)
                        {
                            StorePurchaseStatus Status = await MSStoreHelper.Current.PurchaseAsync();

                            if (Status == StorePurchaseStatus.AlreadyPurchased || Status == StorePurchaseStatus.Succeeded)
                            {
                                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();
                            }
                            else
                            {
                                Frame.GoBack();
                                return;
                            }
                        }
                        else
                        {
                            Frame.GoBack();
                            return;
                        }
                    }
                }
                finally
                {
                    await ActivateLoading(false);
                }

                SecureAreaWelcomeDialog Dialog = new SecureAreaWelcomeDialog();

                if ((await Dialog.ShowAsync()) == ContentDialogResult.Primary)
                {
                    AESKeySize     = Dialog.AESKeySize;
                    UnlockPassword = Dialog.Password;

                    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();
                    }

                    Frame.GoBack();
                    return;
                }
            }

            CoreWindow.GetForCurrentThread().KeyDown += SecureArea_KeyDown;

            WholeArea.Visibility = Visibility.Visible;

            SelectionExtention = new ListViewBaseSelectionExtention(SecureGridView, DrawRectangle);

            await LoadSecureFile();
        }
 private void RecycleBin_Loaded(object sender, RoutedEventArgs e)
 {
     CoreWindow.GetForCurrentThread().KeyDown += RecycleBin_KeyDown;
     SelectionExtention = new ListViewBaseSelectionExtention(ListViewControl, DrawRectangle);
 }
Esempio n. 7
0
 private void RecycleBin_Loaded(object sender, RoutedEventArgs e)
 {
     ListViewControl.AddHandler(PointerPressedEvent, PointerPressedHandler, true);
     CoreWindow.GetForCurrentThread().KeyDown += RecycleBin_KeyDown;
     SelectionExtention = new ListViewBaseSelectionExtention(ListViewControl, DrawRectangle);
 }