Example #1
0
        private async void OnRetryPDList(object sender, RoutedEventArgs e)
        {
#if !OFFLINE
            imgLoading.Visibility = Visibility.Visible;

            var successPd = await CardPrice.GetOrOpenPDLegalFile(true);

            App.CurrentMainWindow?.ShowPDMessage(successPd);
            ViewModel.RefreshTab();
            UpdatePDRotationTime();

            imgLoading.Visibility = Visibility.Collapsed;
#endif
        }
Example #2
0
        private async void OnInitialized(object sender, EventArgs e)
        {
            var vm = ViewModel;

            imgLoading.Visibility = Visibility.Visible;

            await Task.Run(() =>
            {
#if !OFFLINE
                if (File.Exists(App.GetPath("cards.xml")))
                {
                    App.SetCardInfosFromXml(App.GetPath("cards.xml"));
                }

                if (CardPrice.EnableCardPrice)
                {
                    CardPrice.OpenCacheData();
                }
#else
                App.SetCardInfosFromResource();
#endif
            });

#if !OFFLINE
            if (vm.GetPDList)
            {
                var successPd = await CardPrice.GetOrOpenPDLegalFile(false);

                ShowPDMessage(successPd);
            }
#endif
            imgLoading.Visibility = Visibility.Hidden;
            vm.SetRefreshTimer(Dispatcher);

#if !OFFLINE
            if (vm.AutoVersionCheck && await App.IsOutdatedRelease(vm.AcceptsPrerelease))
            {
                notifier.Visibility = Visibility.Visible;
            }
#endif
        }
Example #3
0
        internal async void OnOption(object sender, RoutedEventArgs e)
        {
            var  vm       = ViewModel;
            bool oldPrice = vm.GetCardPrice;
            bool oldPd    = vm.GetPDList;

            var dlg = new OptionDialog(DataContext)
            {
                Owner = this
            };

            dlg.ShowDialog();

            Topmost = vm.TopMost;

            // Preview Pane の自動探索の設定を反映
            vm.SetRefreshTimer(Dispatcher);

#if !OFFLINE
            notifier.Visibility = vm.AutoVersionCheck &&
                                  await App.IsOutdatedRelease(vm.AcceptsPrerelease) ? Visibility.Visible : Visibility.Collapsed;

            // カード価格関連の変更を反映するために await
            imgLoading.Visibility = Visibility.Visible;

            if (vm.GetCardPrice != oldPrice)
            {
                if (CardPrice.EnableCardPrice)
                {
                    await Task.Run(CardPrice.OpenCacheData);
                }
                else
                {
                    CardPrice.ClearCacheData();
                }
            }

            if (vm.GetPDList != oldPd)
            {
                if (vm.GetPDList)
                {
                    var successPd = await CardPrice.GetOrOpenPDLegalFile(false);

                    ShowPDMessage(successPd);
                }
                else
                {
                    CardPrice.ClearPDLegalList();
                    pdSuccess.Visibility = Visibility.Collapsed;
                    pdError.Visibility   = Visibility.Collapsed;
                }
            }

            if (vm.GetCardPrice != oldPrice || vm.GetPDList != oldPd)
            {
                vm.RefreshTab();
            }

            imgLoading.Visibility = Visibility.Hidden;
#endif
        }