예제 #1
0
        public DataSourceViewModel(IDataSourceManager sourceManager, DataSourceContentType sourceContent)
            : base(sourceManager)
        {
            try
            {
                this.dataSource = sourceManager.DataSources[sourceContent];
                this.name = this.dataSource.Name;
                this.Downloadable = this.dataSource.Type == DataSourceOrigin.OnlineWithCache;

                this.Download = new RelayCommand(async arg =>
                    {
                        this.Downloading = true;
                        await this.dataSource.LoadAsync();
                        this.Downloading = false;
                    });
            }
            catch(Exception ex)
            {
                // TODO: Surface this error to the UI.
                Debug.WriteLine("Could not find a data source of type " + sourceContent.ToString() + ": " + ex.Message);
            }
        }
예제 #2
0
        public DataSourceViewModel(IDataSourceManager sourceManager, DataSourceContentType sourceContent)
            : base(sourceManager)
        {
            try
            {
                this.dataSource   = sourceManager.DataSources[sourceContent];
                this.name         = this.dataSource.Name;
                this.Downloadable = this.dataSource.Type == DataSourceOrigin.OnlineWithCache;

                this.Download = new RelayCommand(async arg =>
                {
                    this.Downloading = true;
                    await this.dataSource.LoadAsync();
                    this.Downloading = false;
                });
            }
            catch (Exception ex)
            {
                // TODO: Surface this error to the UI.
                Debug.WriteLine("Could not find a data source of type " + sourceContent.ToString() + ": " + ex.Message);
            }
        }