public MainWindowViewModel(Model.MainWindowModel model)
 {
     JobContainer = new JobContainerViewModel(model.Downloader);
     Setting = new SettingViewModel(model.Downloader, model.Setting);
     model.Notify += (sender, e) =>
         App.Current.Dispatcher.BeginInvoke((Action)(() =>
             JobContainer.JobActivityGroups.Insert(0, new NoticeItemBase() { NoticeText = e.Text })));;
 }
 public JobActivityGroupViewModel(JobContainerViewModel container, ActivityInfo activityInfo, Model.ImageDownloader[] imageDownloader)
 {
     NoticeText = activityInfo.PostUser.Name;
     NoticeIcon = new System.Windows.Media.Imaging.BitmapImage();
     NoticeIcon.BeginInit();
     NoticeIcon.DecodePixelWidth = 25;
     NoticeIcon.UriSource = activityInfo.PostUser.IconImageUrl;
     NoticeIcon.EndInit();
     ActivityUrl = activityInfo.PostUrl;
     DownloadImageJobs = imageDownloader.Select(
         downloader => (JobViewModelBase)new JobViewModel(container, downloader)).ToList();
 }
        public JobViewModel(JobContainerViewModel container, ImageDownloader model)
        {
            _model = model;
            _model.ChangedTaskStatus += _model_ChangedTaskStatus;
            _container = container;
            DownloadStatus = model.Status;
            ImageUrl = _model.ImageInfo.ImageUrl;
            OpenImageCommand = new RelayCommand(
                obj => _model.Open(),
                obj =>
                    {
                        if (_model.DownloadedImageFile == null)
                            return false;

                        //OpenImageCommandを呼び出せるかチェックする際にDownloadStatus
                        //を更新することで、画像を落とした後にその画像を削除し、その上
                        //で画像のサムネイルをダブルクリックした時にサムネイルの状態を
                        //更新する用にした。
                        _model.RefreshStatus();
                        DownloadStatus = _model.Status;
                        return _model.Status == Model.DownloadStatus.Loaded;
                    });
        }