/// <summary> /// The Test. /// </summary> /// <param name="testWindow">The testWindow<see cref="Window"/>.</param> protected override void Test(Window testWindow) { var globalBrowserData = new GlobalBrowserData(); var viewModel = new DownloadQueueViewModel(globalBrowserData.DownloadItemModels); var view = new DownloadQueueView { DataContext = viewModel }; WindowFactory.CreateAndShow(view, testWindow); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> /// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param> internal MainWindow(GlobalBrowserData globalBrowserData) { // This constructor is intended to create new window after dragging the browser tab. Logger.Info($"Start {nameof(VideoBrowser)}"); this.GlobalBrowserData = globalBrowserData; this.MainWindowViewModel = new MainWindowViewModel(globalBrowserData); this.MainWindowViewModel.CefWindowData.PropertyChanged += this.CefWindowData_PropertyChanged; this.GlobalBrowserData.WindowViewModels.Add(this.MainWindowViewModel); this.DataContext = this.MainWindowViewModel; this.InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="WebBrowserTabControlViewModel"/> class. /// </summary> /// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param> public WebBrowserTabControlViewModel(GlobalBrowserData globalBrowserData) { this.GlobalBrowserData = globalBrowserData; this.CefWindowData = new CefWindowData(); this.TabItems = new ObservableCollection <TabItem>(); this.TabItems.CollectionChanged += this.OnTabItems_CollectionChanged; this.CreateBrowserFunc = this.CreateBrowser; this.CefWindowData.CefRequestHandler.OpenUrlFromTabAction = this.OnOpenUrlFromTab; this.CefWindowData.CefContextMenuHandler.OpenInNewTabAction = this.OnOpenUrlFromTab; this.CefWindowData.CefContextMenuHandler.OpenInNewWindowAction = this.OnOpenUrlFromWindow; this.LoadedCommand = new RelayCommand(this.OnLoaded, nameof(this.LoadedCommand)); }
public void Show_DownloadQueueView() { var globalBrowserData = new GlobalBrowserData(); var viewModel = new DownloadQueueViewModel(globalBrowserData.DownloadItemModels); this.CreateDummyOperations(viewModel.DownloadItemModels, viewModel.OnPauseDownloadCalled); var view = new DownloadQueueView { DataContext = viewModel }; WindowFactory.CreateAndShow(view); }
/// <summary> /// The Test. /// </summary> /// <param name="testWindow">The testWindow<see cref="Window"/>.</param> protected override void Test(Window testWindow) { var globalBrowserData = new GlobalBrowserData(); var viewModel = new WebBrowserTabControlViewModel(globalBrowserData); var cefWindowData = viewModel.CefWindowData; var view = new WebBrowserTabControlView { DataContext = viewModel }; var window = WindowFactory.Create(view, testWindow); viewModel.TabItems.Add(new WebBrowserHeaderedItemViewModel(globalBrowserData, cefWindowData, null)); cefWindowData.MainWindow = window;; window.ShowDialog(); }
/// <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; }); }
/// <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="MainWindowViewModel"/> class. /// </summary> /// <param name="globalData">The globalData<see cref="GlobalData"/>.</param> /// <param name="globalBrowserData">The globalBrowserData<see cref="GlobalBrowserData"/>.</param> public MainWindowViewModel(GlobalBrowserData globalBrowserData) { this.ClosingCommand = new RelayCommand(this.OnClosing); this.LoadedCommand = new RelayCommand(this.OnLoaded); this.PressEscCommand = new RelayCommand(this.OnPressEsc); this.PressF2Command = new RelayCommand(this.OnPressF2); this.About = new AboutViewModel(); var downloadItemModels = globalBrowserData.DownloadItemModels; this.DownloadQueueViewModel = new DownloadQueueViewModel(downloadItemModels) { ShowMessageAsync = this.ShowMessageAsync }; this.DownloadFlyoutViewModel = new DownloadFlyoutViewModel(downloadItemModels) { ShowDownloadTabAction = this.ShowDownloadTabAction }; this.WebBrowserTabControlViewModel = new WebBrowserTabControlViewModel(globalBrowserData) { CreateBrowserFunc = this.CreateBrowser }; this.Initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultTabHostViewModel"/> class. /// </summary> /// <param name="globalData">The globalData<see cref="GlobalBrowserData"/>.</param> public DefaultTabHostViewModel(GlobalBrowserData globalData) { this.WebBrowserTabControlViewModel = new WebBrowserTabControlViewModel(globalData); }