Example #1
0
        protected override async void OnInitialActivate()
        {
            var leagues = await _exileEngine.TradeLeaguesAsync();

            var tradeStatic = await _exileEngine.TradeStaticAsync();

            if (leagues == null || tradeStatic == null)
            {
                MessageBox.Show("Loading error. Please try again later.");
                RequestClose();
                return;
            }

            _eventAggregator.Publish(new LeaguesLoadedEvent(leagues.Result));

            ImageCacheService.CreateDirectories();
            foreach (var currency in tradeStatic.Result.SelectMany(s => s.Entries).Where(w => !string.IsNullOrWhiteSpace(w.Image)))
            {
                if (ImageCacheService.Exist(currency.Id))
                {
                    continue;
                }
                InitText = $"[Image] {currency.Text}";
                await _exileEngine.DownloadImageAsync(currency.Image, ImageCacheService.Get(currency.Id));
            }

            IsInitDone = true;

            _eventAggregator.Publish(new AppLoadedEvent());

            base.OnInitialActivate();
        }
Example #2
0
 public ImageResultHolder(ImageRequest request, ImageCacheService service, XamlUICommand uiCommand)
 {
     _request     = request;
     _service     = service;
     _copyCommand = uiCommand;
     LoadAsync(false);
 }
Example #3
0
        void imageService_ReadFinished(object sender, EventArgs e)
        {
            ImageSource img = ImageCacheService.GetImage();

            if (img != null)
            {
                MainImage.Source = img;
            }
        }
 public FormSettings(BookmarkService bookmarkService, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService)
 {
     applicationSettingsService.LoadSettings();
     _originalSettings           = applicationSettingsService.Settings;
     _bookmarkService            = bookmarkService;
     _applicationSettingsService = applicationSettingsService;
     _imageCacheService          = imageCacheService;
     _selectedCacheSize          = _imageCacheService.CacheSize;
     InitializeComponent();
 }
Example #5
0
 public DownloadPackagesPage()
 {
     SwappedOut += Dispose;
     InitializeComponent();
     _cacheService = Lib.IoC.GetConstant <ImageCacheService>();
     ViewModel     = Lib.IoC.Get <DownloadPackagesViewModel>();
     ViewModel.SelectNextItem.AfterExecute += o => OpenPackagePreviewPage(SlideDirection.Right, SlideDirection.Left);
     ViewModel.SelectLastItem.AfterExecute += o => OpenPackagePreviewPage(SlideDirection.Left, SlideDirection.Right);
     ControllerSupport.SubscribeCustomInputs(ProcessEvents);
 }
Example #6
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string currency)
     {
         return(ImageCacheService.Exist(currency) ? new Uri(ImageCacheService.Get(currency)) : Binding.DoNothing);
     }
     else
     {
         return(Binding.DoNothing);
     }
 }
Example #7
0
    /// <summary>
    /// Creates a viewmodel used to download a package.
    /// </summary>
    /// <param name="parent">The parent to create this viewmodel from. Copies currently selected package.</param>
    public DownloadPackagePreviewViewModel(DownloadPackagesViewModel parent)
    {
        Package = parent.SelectedResult;
        DownloadPackageStatus = parent.DownloadPackageStatus;
        DownloadModCommand    = parent.DownloadModCommand;
        SelectNextItem        = parent.SelectNextItem;
        SelectLastItem        = parent.SelectLastItem;
        _cacheService         = IoC.GetConstant <ImageCacheService>();

        // Select default image
        if (Package.Images is { Length : > 0 })
Example #8
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;
        }
Example #9
0
 public FormThumbnailView(FormAddBookmark formAddBookmark, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService, ThumbnailService thumbnailService, ImageLoaderService imageLoaderService)
 {
     _formAddBookmark            = formAddBookmark;
     _applicationSettingsService = applicationSettingsService;
     _imageCacheService          = imageCacheService;
     _thumbnailService           = thumbnailService;
     _imageLoaderService         = imageLoaderService;
     _thumbnailSize = ValidateThumbnailSize(_applicationSettingsService.Settings.ThumbnailSize);
     _maxThumbnails = _applicationSettingsService.Settings.MaxThumbnails;
     _applicationSettingsService.OnSettingsSaved += _applicationSettingsService_OnSettingsSaved;
     _thumbnailService.LoadThumbnailDatabase();
     InitializeComponent();
 }
Example #10
0
        public FormImageView(int id, FormAddBookmark formAddBookmark, BookmarkManager bookmarkManager, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCache, ImageLoaderService imageLoaderService)
        {
            InitializeComponent();
            _imageViewFormInfo          = new ImageViewFormImageInfo(this, null, 0);
            _observers                  = new List <IObserver <ImageViewFormInfoBase> >();
            pictureBox.Paint           += pictureBox_Paint;
            FormId                      = id;
            _formAddBookmark            = formAddBookmark;
            _bookmarkManager            = bookmarkManager;
            _applicationSettingsService = applicationSettingsService;
            _imageCache                 = imageCache;
            _imageLoaderService         = imageLoaderService;
            _lastFormState              = WindowState;

            ReloadSettings();
        }
Example #11
0
        public FormMain(FormAddBookmark formAddBookmark, BookmarkService bookmarkService, FormSettings formSettings, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService, ImageLoaderService imageLoaderService,
                        ILifetimeScope scope, UserInteractionService interactionService)
        {
            _formAddBookmark            = formAddBookmark;
            _bookmarkService            = bookmarkService;
            _formSettings               = formSettings;
            _applicationSettingsService = applicationSettingsService;
            _applicationSettingsService.LoadSettings();

            _imageCacheService  = imageCacheService;
            _imageLoaderService = imageLoaderService;
            _scope = scope;
            _interactionService = interactionService;

            InitializeComponent();
            _imageViewFormList = new List <FormImageView>();
            _windowTitle       = "Image Viewer - " + Application.ProductVersion;
        }
Example #12
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;
            }
        }
Example #13
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;
        }