|
@@ -389,14 +389,13 @@ background-position: right top;
|
|
|
if (uri.StartsWith("http://"))
|
|
|
{
|
|
|
string httpsUri = "https://" + uri.Substring("http://".Length);
|
|
|
- e.Cancel = true; // 取消当前的http导航
|
|
|
- webView21.CoreWebView2.Navigate(httpsUri); // 尝试https导航
|
|
|
+ e.Cancel = true;
|
|
|
+ webView21.CoreWebView2.Navigate(httpsUri);
|
|
|
}
|
|
|
string currentUrl = webView21.Source.ToString();
|
|
|
if (!comboBox1.Items.Contains(currentUrl))
|
|
|
- {
|
|
|
comboBox1.Items.Add(currentUrl);
|
|
|
- }
|
|
|
+
|
|
|
comboBox1.Text = currentUrl;
|
|
|
progressBar.Value = 0;
|
|
|
progressLabel.Text = "0%";
|
|
@@ -407,19 +406,15 @@ background-position: right top;
|
|
|
{
|
|
|
if (!e.IsSuccess && isHttpsFallback)
|
|
|
{
|
|
|
- isHttpsFallback = false; // 重置标志
|
|
|
+ isHttpsFallback = false;
|
|
|
string originalUri = webView21.CoreWebView2.Source.Replace("https://", "http://");
|
|
|
- webView21.CoreWebView2.Navigate(originalUri); // 重新导航到http地址
|
|
|
+ webView21.CoreWebView2.Navigate(originalUri);
|
|
|
}
|
|
|
else if (e.IsSuccess && webView21.CoreWebView2.Source.StartsWith("https://"))
|
|
|
- {
|
|
|
- isHttpsFallback = false; // 如果https导航成功,重置标志
|
|
|
- }
|
|
|
+ isHttpsFallback = false;
|
|
|
string currentUrl = webView21.Source.ToString();
|
|
|
if (!comboBox1.Items.Contains(currentUrl))
|
|
|
- {
|
|
|
comboBox1.Items.Add(currentUrl);
|
|
|
- }
|
|
|
comboBox1.Text = currentUrl;
|
|
|
progressBar.Value = 100;
|
|
|
progressLabel.Text = "100%";
|
|
@@ -447,13 +442,9 @@ background-position: right top;
|
|
|
using (var img = Image.FromStream(ms))
|
|
|
{
|
|
|
if (img is Bitmap bitmap)
|
|
|
- {
|
|
|
- this.Icon = Icon.FromHandle(bitmap.GetHicon());
|
|
|
- }
|
|
|
+ Icon = Icon.FromHandle(bitmap.GetHicon());
|
|
|
else
|
|
|
- {
|
|
|
- this.Icon = Icon.FromHandle(((Bitmap)img.Clone()).GetHicon());
|
|
|
- }
|
|
|
+ Icon = Icon.FromHandle(((Bitmap)img.Clone()).GetHicon());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -477,18 +468,14 @@ background-position: right top;
|
|
|
}
|
|
|
string url = comboBox1.Text;
|
|
|
if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
|
|
- {
|
|
|
webView21.CoreWebView2.Navigate(url);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- if(MessageBox.Show("确认关闭 LYKNS EdgeVoyager 所有窗口?", "退出确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
- {
|
|
|
+ if (MessageBox.Show("确认关闭 LYKNS EdgeVoyager 所有窗口?", "退出确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
Environment.Exit(0);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void webView21_ContentLoading(object sender, CoreWebView2ContentLoadingEventArgs e)
|
|
@@ -606,17 +593,11 @@ background-position: right top;
|
|
|
{
|
|
|
CoreWebView2PrintStatus printStatus = await webView21.CoreWebView2.PrintAsync(null);
|
|
|
if (printStatus == CoreWebView2PrintStatus.Succeeded)
|
|
|
- {
|
|
|
MessageBox.Show(this, "打印 " + title + " 文档到打印机成功", "打印到默认打印机");
|
|
|
- }
|
|
|
else if (printStatus == CoreWebView2PrintStatus.PrinterUnavailable)
|
|
|
- {
|
|
|
MessageBox.Show(this, "打印机不可用,离线或错误状态", "打印到默认打印机");
|
|
|
- }
|
|
|
else
|
|
|
- {
|
|
|
MessageBox.Show(this, "打印 " + title + " 文档到打印机失败", "打印到默认打印机");
|
|
|
- }
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
@@ -736,9 +717,7 @@ background-position: right top;
|
|
|
{
|
|
|
var headers = response.Headers;
|
|
|
if (headers.Contains("Strict-Transport-Security"))
|
|
|
- {
|
|
|
return "HSTS已开启";
|
|
|
- }
|
|
|
}
|
|
|
return "无HSTS";
|
|
|
}
|
|
@@ -774,16 +753,12 @@ background-position: right top;
|
|
|
if (comboBox1.Focused)
|
|
|
{
|
|
|
if (comboBox1.SelectedText != "")
|
|
|
- {
|
|
|
Clipboard.SetText(comboBox1.SelectedText);
|
|
|
- }
|
|
|
}
|
|
|
else if (textBox1.Focused)
|
|
|
{
|
|
|
if (textBox1.SelectedText != "")
|
|
|
- {
|
|
|
Clipboard.SetText(textBox1.SelectedText);
|
|
|
- }
|
|
|
}
|
|
|
else if (isWebView2Focused)
|
|
|
{
|
|
@@ -870,11 +845,7 @@ background-position: right top;
|
|
|
resources.Add(entry.Key, entry.Value);
|
|
|
}
|
|
|
reader.Close();
|
|
|
-
|
|
|
- // 添加新的资源项
|
|
|
resources.Add(pageTitle, pageUrl);
|
|
|
-
|
|
|
- // 写入到资源文件
|
|
|
using (ResXResourceWriter writer = new ResXResourceWriter(resxFilePath))
|
|
|
{
|
|
|
foreach (DictionaryEntry entry in resources)
|
|
@@ -885,16 +856,14 @@ background-position: right top;
|
|
|
}
|
|
|
for (int i = 0; i < 收藏夹AToolStripMenuItem.DropDownItems.Count; i++)
|
|
|
{
|
|
|
- // 如果找到了toolStripSeparator10
|
|
|
if (收藏夹AToolStripMenuItem.DropDownItems[i] is ToolStripSeparator &&
|
|
|
收藏夹AToolStripMenuItem.DropDownItems[i].Name == "toolStripSeparator10")
|
|
|
{
|
|
|
- // 从toolStripSeparator10下方开始,删除所有按钮
|
|
|
for (int j = 收藏夹AToolStripMenuItem.DropDownItems.Count - 1; j > i; j--)
|
|
|
{
|
|
|
收藏夹AToolStripMenuItem.DropDownItems.RemoveAt(j);
|
|
|
}
|
|
|
- break; // 找到并处理完毕后退出循环
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
using (ResXResourceReader reader1 = new ResXResourceReader(resxFilePath))
|
|
@@ -989,5 +958,20 @@ background-position: right top;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void Form1_Load(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ if (Settings1.Default.windows_num != 1)
|
|
|
+ {
|
|
|
+ Settings1.Default.windows_num++;
|
|
|
+ Settings1.Default.Save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Form1_FormClosed(object sender, FormClosedEventArgs e)
|
|
|
+ {
|
|
|
+ Settings1.Default.windows_num--;
|
|
|
+ Settings1.Default.Save();
|
|
|
+ }
|
|
|
}
|
|
|
}
|