using System; using System.Reactive; using System.Reactive.Subjects; using Microsoft.Extensions.Logging; using ReactiveUI; using ReactiveUI.Fody.Helpers; using Wabbajack.Messages; using Wabbajack.Models; namespace Wabbajack { public class WebBrowserVM : ViewModel, IBackNavigatingVM, IDisposable { private readonly ILogger _logger; private readonly CefService _cefService; [Reactive] public string Instructions { get; set; } public dynamic Browser { get; } public dynamic Driver { get; set; } [Reactive] public ViewModel NavigateBackTarget { get; set; } [Reactive] public ReactiveCommand BackCommand { get; set; } public Subject IsBackEnabledSubject { get; } = new Subject(); public IObservable IsBackEnabled { get; } public WebBrowserVM(ILogger logger, CefService cefService) { // CefService is required so that Cef is initalized _logger = logger; _cefService = cefService; Instructions = "Wabbajack Web Browser"; BackCommand = ReactiveCommand.Create(NavigateBack.Send); //Browser = cefService.CreateBrowser(); //Driver = new CefSharpWrapper(_logger, Browser, cefService); } public override void Dispose() { Browser.Dispose(); base.Dispose(); } } }