feat: 加载网页时,自动带上版本
This commit is contained in:
parent
37d21446ec
commit
ddf2c5c7e8
Binary file not shown.
@ -52,7 +52,7 @@ namespace AIProofread
|
||||
/// <summary>
|
||||
/// 网页访问地址
|
||||
/// </summary>
|
||||
public static string WEB_PATH = AppServer.GM_FN; //pre-gm-plugin.gachafun.com localhost:5173 gm2-plugin.zverse.group
|
||||
public static string WEB_PATH = AppServer.DEV; //pre-gm-plugin.gachafun.com localhost:5173 gm2-plugin.zverse.group
|
||||
public static bool RUN_IN_DEBUG = true;
|
||||
public static AppEnvironment APP_ENV = AppEnvironment.Dev;
|
||||
#else
|
||||
@ -103,7 +103,7 @@ namespace AIProofread
|
||||
/// <returns></returns>
|
||||
public static string WebPath(string path)
|
||||
{
|
||||
return WEB_PATH + path;
|
||||
return WEB_PATH + path + (path.IndexOf("?") == -1 ? "?" : "&") + "version=" + APP_VERSION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
AIProofread/Controls/FormWebView.Designer.cs
generated
14
AIProofread/Controls/FormWebView.Designer.cs
generated
@ -29,6 +29,7 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.WebView = new Microsoft.Web.WebView2.WinForms.WebView2();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.WebView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -44,23 +45,36 @@
|
||||
this.WebView.TabIndex = 0;
|
||||
this.WebView.ZoomFactor = 1D;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(380, 219);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(41, 12);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "校对王";
|
||||
this.label1.Visible = false;
|
||||
//
|
||||
// FormWebView
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.WebView);
|
||||
this.Name = "FormWebView";
|
||||
this.ShowIcon = false;
|
||||
this.Load += new System.EventHandler(this.FormWebView_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.WebView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Microsoft.Web.WebView2.WinForms.WebView2 WebView;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
@ -16,10 +16,16 @@ namespace AIProofread.Controls
|
||||
public partial class FormWebView : BaseWinForm
|
||||
{
|
||||
public string WebUrl { get; set; }
|
||||
private double dpiScaleFactor;
|
||||
public FormWebView(string url,int width,int height)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WebUrl = url;
|
||||
|
||||
this.dpiScaleFactor = this.label1.Width / 42.0; // 设置的宽度为42,实际渲染宽度 / 42 即为缩放比例
|
||||
|
||||
Screen screen = Screen.FromControl(this);
|
||||
|
||||
this.SetSize(width, height);
|
||||
this.StartPosition = FormStartPosition.CenterScreen;
|
||||
}
|
||||
@ -31,8 +37,8 @@ namespace AIProofread.Controls
|
||||
|
||||
public void SetSize(int width, int height)
|
||||
{
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
this.Width = (int)(width * dpiScaleFactor);
|
||||
this.Height = (int)(height * dpiScaleFactor);
|
||||
}
|
||||
|
||||
private void FormWebView_Load(object sender, EventArgs e)
|
||||
|
@ -97,7 +97,7 @@ namespace AIProofread
|
||||
{
|
||||
if (fromStockQuery == null || fromStockQuery.IsDisposed)
|
||||
{
|
||||
fromStockQuery = new FormWebView(Config.WebPath("stock-query"),500,400);
|
||||
fromStockQuery = new FormWebView(Config.WebPath("stock-query?app_v=101"),500 ,400);
|
||||
}
|
||||
fromStockQuery.Show();
|
||||
// 显示在最前面
|
||||
|
Loading…
x
Reference in New Issue
Block a user