-
Notifications
You must be signed in to change notification settings - Fork 0
/
MacroDeckWebViewForm.cs
99 lines (82 loc) · 3.43 KB
/
MacroDeckWebViewForm.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MacroDeckWebView.Properties;
using DarkUI.Forms;
using System.Configuration;
namespace MacroDeckWebView
{
public partial class MacroDeckWebViewForm : DarkForm
{
public MacroDeckWebViewForm()
{
InitializeComponent();
this.Icon = Icon.FromHandle(Resources.ICON.GetHicon());
this.Text = Resources.FORM_TITLE + " v" + Resources.VERSION;
}
private void btnRepository_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Resources.REPOSITORY_URL);
}
private void WebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
}
private async void WebView21_NavigationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e)
{
//string v1 = await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('btn-fullscreen').style.visibility='hidden'; document.getElementById('btn-back').style.visibility='hidden'; document.getElementById('btn-dark').style.visibility='hidden';");
}
private void ExamepleForm_Deactivate(object sender, EventArgs e)
{
//Hide application on Defocus
//Add logic here to prevent reshowing when clicking the taskbar icon?
TrayLockVar = true;
this.Hide();
ResetTrayLock();
}
private static bool _trayLockVar = false;
public static bool TrayLockVar
{
get { return _trayLockVar; }
set { _trayLockVar = value; }
}
public async void ResetTrayLock()
{
await Task.Delay(500);
TrayLockVar = false;
}
private void MacroDeckWebViewForm_Load(object sender, EventArgs e)
{
Int32 widthVar = Int32.Parse(ConfigurationManager.AppSettings["viewWidth"]);
Int32 heightVar = Int32.Parse(ConfigurationManager.AppSettings["viewHeight"]) + 23;
this.Size = new Size(widthVar,heightVar);
this.Left = Screen.FromPoint(Cursor.Position).WorkingArea.Right - widthVar;
this.Top = Screen.FromPoint(Cursor.Position).WorkingArea.Bottom - heightVar;
}
private void MacroDeckWebViewForm_ResizeEnd(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
}
else
{
Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
Int32 widthVar = this.Size.Width;
Int32 heightVar = this.Size.Height - 23;
// ConfigurationManager.AppSettings["viewWidth"] = widthVar.ToString();
// ConfigurationManager.AppSettings["viewHeight"] = heightVar.ToString();
config.AppSettings.Settings["viewWidth"].Value =widthVar.ToString();
config.AppSettings.Settings["viewHeight"].Value = heightVar.ToString();
config.Save(ConfigurationSaveMode.Modified);
}
}
private void MacroDeckWebViewForm_DpiChanged(object sender, DpiChangedEventArgs e)
{
}
}
}