mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
60 lines
2.0 KiB
C#
60 lines
2.0 KiB
C#
// 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("LogWatcher", new VRCX_LogWatcher(), true, options);
|
|
Browser.JavascriptObjectRepository.Register("Discord", new Discord(), true, options);
|
|
Browser.IsBrowserInitializedChanged += (A, B) =>
|
|
{
|
|
// Browser.ShowDevTools();
|
|
};
|
|
Controls.Add(Browser);
|
|
}
|
|
|
|
private void timer_Tick(object sender, System.EventArgs e)
|
|
{
|
|
Discord.Update();
|
|
}
|
|
}
|
|
} |