Beispiel #1
0
        /// <summary>
        /// Design mode constructor
        /// </summary>
        public LazyRecordingFolderItemViewModel(RecordingFolderItem item)
        {
            this.showViewModelFactory          = () => new IndividualShowViewModel();
            this.showContainerViewModelFactory = () => new ShowContainerViewModel();

            this.Item = CreateItemViewModel(item);
        }
Beispiel #2
0
        public async void ActivateItem(RecordingFolderItem item)
        {
            var folder = item as Tivo.Connect.Entities.Container;

            if (folder != null)
            {
                try
                {
                    shows.Clear();

                    var connection = await this.tivoConnectionService.GetConnectionAsync();

                    var progress = new Progress <RecordingFolderItem>(child => this.Shows.Add(child));
                    await connection.GetMyShowsList(folder, progress);

                    MessageBox.Show("Shows updated!", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Request Failed\n{0}", ex), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                var show = item as Tivo.Connect.Entities.IndividualShow;

                if (show != null)
                {
                    var connection = await this.tivoConnectionService.GetConnectionAsync();

                    await connection.PlayShow(show.Id);
                }
            }
        }
Beispiel #3
0
        private IRecordingFolderItemViewModel CreateItemViewModel(RecordingFolderItem recordingFolderItem)
        {
            var showContainer = recordingFolderItem as Container;

            if (showContainer != null)
            {
                var result = this.showContainerViewModelFactory();
                result.Source = showContainer;

                return(result);
            }

            var show = recordingFolderItem as IndividualShow;

            if (show != null)
            {
                var result = this.showViewModelFactory();
                result.Source = show;

                return(result);
            }

            return(null);
        }