2019-12-07 00:13:16 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2020-01-07 05:44:05 +00:00
|
|
|
|
using System.Reactive;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-12-26 23:26:53 +00:00
|
|
|
|
using CefSharp;
|
|
|
|
|
using CefSharp.Wpf;
|
2019-12-07 05:40:57 +00:00
|
|
|
|
using ReactiveUI;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
|
|
|
|
using Wabbajack.Lib;
|
2019-12-19 01:09:45 +00:00
|
|
|
|
using Wabbajack.Lib.LibCefHelpers;
|
2019-12-26 23:26:53 +00:00
|
|
|
|
using Wabbajack.Lib.WebAutomation;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
2020-01-05 03:06:34 +00:00
|
|
|
|
public class WebBrowserVM : ViewModel, IBackNavigatingVM
|
2019-12-07 00:13:16 +00:00
|
|
|
|
{
|
|
|
|
|
[Reactive]
|
|
|
|
|
public string Instructions { get; set; }
|
|
|
|
|
|
2019-12-26 23:26:53 +00:00
|
|
|
|
public IWebBrowser Browser { get; } = new ChromiumWebBrowser();
|
|
|
|
|
public CefSharpWrapper Driver => new CefSharpWrapper(Browser);
|
2019-12-07 00:13:16 +00:00
|
|
|
|
|
2020-01-05 03:06:34 +00:00
|
|
|
|
[Reactive]
|
|
|
|
|
public ViewModel NavigateBackTarget { get; set; }
|
|
|
|
|
|
2019-12-07 05:40:57 +00:00
|
|
|
|
[Reactive]
|
2020-01-07 05:44:05 +00:00
|
|
|
|
public ReactiveCommand<Unit, Unit> BackCommand { get; set; }
|
2019-12-08 19:46:30 +00:00
|
|
|
|
|
2019-12-19 01:09:45 +00:00
|
|
|
|
private WebBrowserVM(string url = "http://www.wabbajack.org")
|
2019-12-07 00:13:16 +00:00
|
|
|
|
{
|
|
|
|
|
Instructions = "Wabbajack Web Browser";
|
|
|
|
|
}
|
2019-12-19 01:09:45 +00:00
|
|
|
|
|
|
|
|
|
public static async Task<WebBrowserVM> GetNew(string url = "http://www.wabbajack.org")
|
|
|
|
|
{
|
|
|
|
|
// Make sure libraries are extracted first
|
|
|
|
|
return new WebBrowserVM(url);
|
|
|
|
|
}
|
2019-12-07 00:13:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|