forked from vrcx-team/VRCX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainForm.cs
56 lines (53 loc) · 1.94 KB
/
MainForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright(c) 2019 pypy. All rights reserved.
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
namespace VRCX
{
public partial class MainForm : Form
{
public static MainForm Instance { get; private set; }
public static ChromiumWebBrowser Browser { get; private set; }
public MainForm()
{
Instance = this;
InitializeComponent();
try
{
Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
}
catch
{
}
// Application.StartupPath + "/html/index.html"
Browser = new ChromiumWebBrowser(Application.StartupPath + "/html/index.html")
{
BrowserSettings =
{
// UniversalAccessFromFileUrls = CefState.Enabled,
DefaultEncoding = "UTF-8",
},
Dock = DockStyle.Fill,
};
var options = new BindingOptions()
{
CamelCaseJavascriptNames = false
};
Browser.JavascriptObjectRepository.Register("VRCX", new VRCX(), true, options);
Browser.JavascriptObjectRepository.Register("VRCXStorage", new VRCXStorage(), false, options);
Browser.JavascriptObjectRepository.Register("SQLite", new SQLite(), true, options);
Browser.JavascriptObjectRepository.Register("LogWatcher", new LogWatcher(), true, options);
Browser.JavascriptObjectRepository.Register("Discord", new Discord(), true, options);
Browser.IsBrowserInitializedChanged += (A, B) =>
{
// Browser.ShowDevTools();
};
Controls.Add(Browser);
}
}
}