コード例 #1
0
 private SearchVideoByTemporaryModel() : base(true)
 {
     if (!WpfUtil.IsDesignMode() && !string.IsNullOrWhiteSpace(SettingModel.Instance.MailAddress))
     {
         Reload().ConfigureAwait(false);
     }
 }
 private static void OnSetIsEnabledCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     if (!WpfUtil.IsDesignMode())
     {
         // Window読込時イベント
         BehaviorUtil.Loaded(sender as Window, Window_Loaded);
     }
 }
コード例 #3
0
 public MainViewModel()
 {
     if (!WpfUtil.IsDesignMode() && Instance != null)
     {
         throw new InvalidOperationException("This ViewModel cannot create multiple instances.");
     }
     Instance = this;
 }
コード例 #4
0
        public SearchVideoByMylistModel(string url) : this()
        {
            if (!WpfUtil.IsDesignMode())
            {
                MylistUrl = url;

                Reload().ConfigureAwait(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainViewModel() : base()
        {
            if (!WpfUtil.IsDesignMode() && Instance != null)
            {
                throw new InvalidOperationException("本ViewModelは複数のインスタンスを作成することができません。");
            }
            Instance = this;

            // メッセージサービスの変更
            ServiceFactory.MessageService = new WpfMessageService();

            // 画面終了時イベント
            Disposed += (sender, e) =>
            {
                // カレント破棄
                Current?.Dispose();
            };
        }
コード例 #6
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindowViewModel() : base()
        {
            if (!WpfUtil.IsDesignMode() && Instance != null)
            {
                throw new InvalidOperationException("本ViewModelは複数のインスタンスを作成することができません。");
            }
            Instance = this;

            Disposed += (sender, e) =>
            {
                MylistStatusModel.Instance.Dispose();
                SettingModel.Instance.Dispose();
                VideoStatusModel.Instance.Dispose();
            };

            // 初期表示ワークスペースの設定
            if (!string.IsNullOrWhiteSpace(SettingModel.Instance.MailAddress))
            {
                Current = new SearchVideoByRankingViewModel();
            }
            else
            {
                Current = new SettingViewModel();
            }

            // メッセージサービスの変更
            ServiceFactory.MessageService = new WpfMessageService();

            // テンポラリ数の監視イベントを追加
            SearchVideoByTemporaryModel.Instance.Videos.CollectionChanged += SearchVideoByTemporaryModel_OnCollectionChanged;

            // ダウンロード状況の監視イベントを追加
            DownloadModel.Instance.PropertyChanged += Download_OnPropertyChanged;

            // タイマー起動
            Timer          = new DispatcherTimer(DispatcherPriority.Normal, App.Current.Dispatcher);
            Timer.Interval = new TimeSpan(0, 10, 0);
            Timer.Tick    += Timer_Tick;
            Timer.Start();
        }
コード例 #7
0
        /// <summary>
        /// 短軸チャートを描写します。
        /// </summary>
        private void Draw()
        {
            if (WpfUtil.IsDesignMode())
            {
                return;
            }
            if (Charts == null || !Charts.Any())
            {
                return;
            }
            if (ActualHeight <= 0 || ActualWidth <= 0)
            {
                return;
            }
            if (IsMouseRightClicking)
            {
                return;
            }

            // X軸の文字
            var xheaders = GetXHeaders();

            // X軸をレンダリングする。
            XAxisImage.Source  = DrawXAxis(xheaders);
            PreviousXAxisImage = XAxisImage.Source;

            // 各チャート描写の割合合計
            var percentage = Charts.Sum(c => c.PercentageHeight);

            // 各チャートをレンダリングする。
            foreach (var c in Charts)
            {
                c.Width  = ActualWidth;
                c.Height = (ActualHeight - XAxisImage.Source.Height) / percentage * c.PercentageHeight;
                c.Draw(this, xheaders);
            }
        }