예제 #1
0
 public void SelectItem(IPlaylistItemViewModel item)
 {
     try
     {
         task.Stop();
         playlist.SelectPlaylistItem(item);
         task.UpdateItem(item.ToTaskItem());
         task.Start();
     }
     catch (Exception ex)
     {
         logger.Error("  PlaylistController.SelectItem", ex);
     }
 }
예제 #2
0
        public void Playlist(PlaylistTaskViewModel taskViewModel, IPlaylistViewModel playlist)
        {
            if (taskViewModel == null)
            {
                throw new ArgumentNullException("taskViewModel");
            }
            if (playlist == null)
            {
                throw new ArgumentNullException("playlist");
            }

            try
            {
                if (!tabMap.ContainsKey(taskViewModel.Id))
                {
                    var playlistController = new PlaylistController(logger, playlist, taskViewModel, videoPlayer);

                    var playlistView = new PlaylistView();
                    playlistView.Initialize(logger, playlistController);

                    var tabItem = new TabItem();

                    //TextBlock header = new TextBlock();
                    //header.Inlines.Add(taskViewModel.Description);
                    //header.ToolTip = string.Format("{0}: {1}", taskViewModel.Name, taskViewModel.Description);
                    tabItem.Header = new TaskHeader(logger, taskViewModel);

                    tabItem.Content = playlistView;
                    resultControl.Items.Add(tabItem);
                    tabItem.IsSelected = true;

                    AddViewModel(taskViewModel, tabItem);

                    if (taskViewModel.Status == TaskStatus.Ready)
                    {
                        taskViewModel.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("  TaskResultView.Playlist", ex);
            }
        }
        public void Playlist(PlaylistTaskViewModel taskViewModel, IPlaylistViewModel playlist)
        {
            if (taskViewModel == null)
                throw new ArgumentNullException("taskViewModel");
            if (playlist == null)
                throw new ArgumentNullException("playlist");

            try
            {
                if (!tabMap.ContainsKey(taskViewModel.Id))
                {
                    var playlistController = new PlaylistController(logger, playlist, taskViewModel, videoPlayer);

                    var playlistView = new PlaylistView();
                    playlistView.Initialize(logger, playlistController);

                    var tabItem = new TabItem();

                    //TextBlock header = new TextBlock();
                    //header.Inlines.Add(taskViewModel.Description);
                    //header.ToolTip = string.Format("{0}: {1}", taskViewModel.Name, taskViewModel.Description);
                    tabItem.Header = new TaskHeader(logger, taskViewModel);

                    tabItem.Content = playlistView;
                    resultControl.Items.Add(tabItem);
                    tabItem.IsSelected = true;

                    AddViewModel(taskViewModel, tabItem);

                    if (taskViewModel.Status == TaskStatus.Ready)
                    {
                        taskViewModel.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("  TaskResultView.Playlist", ex);
            }
        }