/// <summary> /// Initializes a new instance of the <see cref="VideoBrowserViewModel"/> class. /// </summary> /// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param> /// <param name="windowData">The windowData<see cref="CefWindowData"/>.</param> internal VideoBrowserViewModel(GlobalBrowserData globalBrowserData, CefWindowData windowData) { this.GlobalBrowserData = globalBrowserData; this.CefWindowData = windowData; // BackwardCommand and ForwardCommand are set by the View. this.DownloadCommand = new RelayCommand(this.OnDownload, "Download", (o) => this.UrlReader.IsDownloadable); this.HomeCommand = new RelayCommand(this.OnHome, "Home"); this.NavigateUrlCommand = new RelayCommand(this.OnNavigateUrl, "NavigateUrl"); this.OpenOutputFolderCommand = new RelayCommand(this.OnOpenOutputFolder, "Open output folder"); this.IndicatorColor = new SolidColorBrush(Colors.DarkBlue); this.UrlEditor = new UrlEditorViewModel(this.UrlReader, this.GlobalBrowserData.Settings) { NavigateUrlCommand = this.NavigateUrlCommand, ShowMessageAsyncAction = this.ShowMessageAsync }; this.UrlEditor.PropertyChanged += this.OnUrlEditor_PropertyChanged; this.PropertyChanged += this.OnPropertyChanged; this.OnHome(null); }
/// <summary> /// Initializes a new instance of the <see cref="WebBrowserHeaderedItemViewModel"/> class. /// </summary> /// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param> /// <param name="cefWindowData">The cefWindowData<see cref="CefWindowData"/>.</param> /// <param name="downloadAction">The downloadAction<see cref="Action{Operation}"/>.</param> internal WebBrowserHeaderedItemViewModel(GlobalBrowserData globalBrowserData, CefWindowData cefWindowData, Action <Operation> downloadAction) { this.VideoBrowserViewModel = new VideoBrowserViewModel(globalBrowserData, cefWindowData) { DownloadAction = downloadAction }; this.VideoBrowserViewModel.PropertyChanged += this.OnVideoBrowserViewModel_PropertyChanged; this.Title = this.VideoBrowserViewModel.Header; UIThreadHelper.Invoke(() => { this.VideoBrowserView = new VideoBrowserView { DataContext = this.VideoBrowserViewModel }; this.Content = this.VideoBrowserView; }); }