예제 #1
0
        void imageService_ReadFinished(object sender, EventArgs e)
        {
            ImageSource img = ImageCacheService.GetImage();

            if (img != null)
            {
                MainImage.Source = img;
            }
        }
예제 #2
0
        private void ChangeBG()
        {
            ImageBrush imageBrush = new ImageBrush
            {
                ImageSource = ImageCacheService.GetImage(ViewModel.MovieDetail.Images[0].Image),
                Stretch     = Stretch.UniformToFill,
                AlignmentY  = AlignmentY.Top,
            };

            TopPanel.Background = imageBrush;
        }
예제 #3
0
        private void ModelUpdated(RijksDataModel model)
        {
            if (model != null)
            {
                this.DataContext = model;



                if (MainImage.Source == null)
                {
                    ImageSource img = ImageCacheService.GetImage();
                    if (img != null)
                    {
                        MainImage.Source = img;
                    }
                }

                //BitmapImage image = new BitmapImage();
                //image.ImageOpened += new EventHandler<RoutedEventArgs>(image_ImageOpened);
                //image.UriSource = new Uri(url);
                //MainImage.Source = image;
            }
        }
예제 #4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.NavigationMode == NavigationMode.Back)
            {
                // 滚动到之前的地方
                ThreadPoolTimer DelayTimer = ThreadPoolTimer.CreateTimer(async(source) =>
                {
                    await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                    {
                        var transform = gridView.TransformToVisual(ScrollPage);
                        var point     = transform.TransformPoint(new Point(0, 0));
                        if (point.Y != 0)
                        {
                            var y = point.Y + ScrollPage.VerticalOffset;
                            if (y < 200)
                            {
                                y += 200;
                            }
                            ScrollPage.ChangeView(null, y - 200, null, true);
                        }
                    });
                }, TimeSpan.FromSeconds(0.1));
                ChangeBG();
                MovieImage.Source = ImageCacheService.GetImage(TimeAPIService.CurrentDetail.Image);
                await ViewModel.LoadAnimationAsync();
            }
            else
            {
                var data = e.Parameter as MovieItemDetail;
                if (data != null && data.ID == null)
                {
                    DisplayDeleteFileDialog();
                    return;
                }
                if (data == null)
                {
                    data = JsonConvert.DeserializeObject <MovieItemDetail>((e.Parameter as JObject).ToString());
                }
                AddData(data);
                MovieImage.Source = ImageCacheService.GetImage(data.Image); // new BitmapImage(new Uri(data.Image));
                ConnectedAnimation imageAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");
                if (imageAnimation != null)
                {
                    imageAnimation.TryStart(MovieImage);
                }

                // History Add
                string[] types = data.MovieType.Split(new char[] { ' ' });
                foreach (string type in types)
                {
                    if (type.Length != 0)
                    {
                        Singleton <MyCollectViewModel> .Instance.HistoryAdd(type);
                    }
                }
                Singleton <MyCollectViewModel> .Instance.SaveHistory();
            }
            collectionButton();
            Singleton <SuspendAndResumeService> .Instance.OnBackgroundEntering += Instance_OnBackgroundEntering;
        }