コード例 #1
0
 public void ReverseAnimation(Action callback)
 {
     EnterAnimation.Stop();
     EnterAnimation
     .SetScale(Vector3.one, new Vector3(0, 1, 1))
     .SetDuration(0.25f)
     .SetEaseType(Ease.Type.InBack);
     EnterAnimation.Play(callback);
 }
コード例 #2
0
        public void PlayAnimation(Action callback)
        {
            gameObject.SetActive(true);

            EnterAnimation.Stop();
            EnterAnimation
            .SetScale(new Vector3(0, 1, 1), Vector3.one)
            .SetDuration(0.4f)
            .SetEaseType(Ease.Type.OutElastic);
            EnterAnimation.Play(callback);
        }
コード例 #3
0
        private async Task Initialize()
        {
            try
            {
                ExitLocker   = new ManualResetEvent(false);
                Cancellation = new CancellationTokenSource();
                LoadQueue    = new Queue <int>();

                MainPage.ThisPage.IsAnyTaskRunning = true;

                Behavior.Attach(Flip);

                List <FileSystemStorageItemBase> FileList = FileSystemStorageItemBase.Open(Path.GetDirectoryName(SelectedPhotoPath), ItemFilters.Folder).GetChildrenItems(SettingControl.IsDisplayHiddenItem, ItemFilters.File).Where((Item) => Item.Type.Equals(".png", StringComparison.OrdinalIgnoreCase) || Item.Type.Equals(".jpg", StringComparison.OrdinalIgnoreCase) || Item.Type.Equals(".bmp", StringComparison.OrdinalIgnoreCase)).ToList();

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

                    Frame.GoBack();
                }
                else
                {
                    int LastSelectIndex = FileList.FindIndex((Photo) => Photo.Path.Equals(SelectedPhotoPath, StringComparison.OrdinalIgnoreCase));
                    if (LastSelectIndex < 0 || LastSelectIndex >= FileList.Count)
                    {
                        LastSelectIndex = 0;
                    }

                    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)
            {
                CouldnotLoadTip.Visibility = Visibility.Visible;
                LogTracer.Log(ex, "An error was threw when initialize PhotoViewer");
            }
            finally
            {
                MainPage.ThisPage.IsAnyTaskRunning = false;
                ExitLocker.Set();
            }
        }
コード例 #4
0
 private void AboutPage_Loaded(object sender, RoutedEventArgs e)
 {
     EnterAnimation.Begin();
 }
コード例 #5
0
        private async Task Initialize()
        {
            try
            {
                ExitLocker   = new ManualResetEvent(false);
                Cancellation = new CancellationTokenSource();
                LoadQueue    = new Queue <int>();

                Behavior.Attach(Flip);

                if (await FileSystemStorageItemBase.OpenAsync(Path.GetDirectoryName(SelectedPhotoFile.Path)) is FileSystemStorageFolder Item)
                {
                    FileSystemStorageFile[] PictureFileList = (await Item.GetChildItemsAsync(SettingControl.IsDisplayHiddenItem, SettingControl.IsDisplayProtectedSystemItems, Filter: ItemFilters.File, AdvanceFilter: (Name) =>
                    {
                        string Extension = Path.GetExtension(Name);
                        return(Extension.Equals(".png", StringComparison.OrdinalIgnoreCase) || Extension.Equals(".jpg", StringComparison.OrdinalIgnoreCase) || Extension.Equals(".bmp", StringComparison.OrdinalIgnoreCase));
                    })).Cast <FileSystemStorageFile>().ToArray();

                    if (PictureFileList.Length == 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();

                        Frame.GoBack();
                    }
                    else
                    {
                        int LastSelectIndex = Array.FindIndex(PictureFileList, (Photo) => Photo.Path.Equals(SelectedPhotoFile.Path, StringComparison.OrdinalIgnoreCase));

                        if (LastSelectIndex < 0 || LastSelectIndex >= PictureFileList.Length)
                        {
                            LastSelectIndex = 0;
                        }

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

                        if (!await PhotoCollection[LastSelectIndex].ReplaceThumbnailBitmapAsync())
                        {
                            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();
                        }

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

                            EnterAnimation.Begin();
                        }
                    }
                }
                else
                {
                    throw new FileNotFoundException();
                }
            }
            catch (Exception ex)
            {
                CouldnotLoadTip.Visibility = Visibility.Visible;
                LogTracer.Log(ex, "An error was threw when initialize PhotoViewer");
            }
            finally
            {
                ExitLocker.Set();
            }
        }
コード例 #6
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();
            }
        }