mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-21 15:53:50 +02:00
Initial commit
This commit is contained in:
60
MainForm.cs
Normal file
60
MainForm.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user