Commit 8afe8a66 authored by 段廷瑞's avatar 段廷瑞

feat: 日志查看器优化

parent 41b668f8
......@@ -317,6 +317,9 @@
<Compile Include="UI\wLoginPwd.Designer.cs">
<DependentUpon>wLoginPwd.cs</DependentUpon>
</Compile>
<Compile Include="UI\wLogPathDetector.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\wLogViewer.cs">
<SubType>Form</SubType>
</Compile>
......
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace Tools.UI
{
/// <summary>
/// 日志路径探测器 — 选择搜索根目录
/// </summary>
public partial class wLogPathDetector : Form
{
public string SelectedPath { get; private set; }
TextBox txtPath;
Button btnBrowse;
Button btnConfirm;
Button btnCancel;
Label lblInfo;
public wLogPathDetector()
{
InitializeComponent();
SetDefaultPath();
}
void SetDefaultPath()
{
// 优先 D:\, 否则 E:\, 否则第一个可用驱动器
var drives = DriveInfo.GetDrives().Where(d => d.IsReady).ToList();
foreach (var drive in drives)
{
if (drive.Name.StartsWith("D:", StringComparison.OrdinalIgnoreCase))
{
txtPath.Text = drive.RootDirectory.FullName;
return;
}
}
foreach (var drive in drives)
{
if (drive.Name.StartsWith("E:", StringComparison.OrdinalIgnoreCase))
{
txtPath.Text = drive.RootDirectory.FullName;
return;
}
}
var first = drives.FirstOrDefault();
if (first != null)
txtPath.Text = first.RootDirectory.FullName;
}
void InitializeComponent()
{
this.Text = "探测日志路径";
this.Size = new System.Drawing.Size(500, 150);
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.StartPosition = FormStartPosition.CenterParent;
lblInfo = new Label
{
Text = "选择搜索根目录:",
Location = new System.Drawing.Point(12, 15),
AutoSize = true
};
txtPath = new TextBox
{
Location = new System.Drawing.Point(12, 40),
Width = 370
};
btnBrowse = new Button
{
Text = "浏览...",
Location = new System.Drawing.Point(390, 38),
Width = 80
};
btnBrowse.Click += (s, e) =>
{
using (var dlg = new FolderBrowserDialog
{
Description = "选择搜索根目录",
RootFolder = Environment.SpecialFolder.MyComputer,
SelectedPath = txtPath.Text
})
{
if (dlg.ShowDialog() == DialogResult.OK)
txtPath.Text = dlg.SelectedPath;
}
};
btnConfirm = new Button
{
Text = "开始探测",
Location = new System.Drawing.Point(310, 75),
Width = 80
};
btnConfirm.Click += (s, e) =>
{
if (!Directory.Exists(txtPath.Text))
{
MessageBox.Show("目录不存在,请重新选择。", "提示",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
SelectedPath = txtPath.Text;
this.DialogResult = DialogResult.OK;
this.Close();
};
btnCancel = new Button
{
Text = "取消",
Location = new System.Drawing.Point(398, 75),
Width = 72
};
btnCancel.Click += (s, e) =>
{
this.DialogResult = DialogResult.Cancel;
this.Close();
};
this.Controls.AddRange(new Control[] { lblInfo, txtPath, btnBrowse, btnConfirm, btnCancel });
}
}
}
......@@ -34,6 +34,8 @@
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tsbSelectPath = new System.Windows.Forms.ToolStripButton();
this.tsbDetectPath = new System.Windows.Forms.ToolStripButton();
this.tsbRemovePath = new System.Windows.Forms.ToolStripButton();
this.listBox1 = new System.Windows.Forms.ListBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
......@@ -54,7 +56,9 @@
this.toolStripSeparator1,
this.toolStripLabel1,
this.tscbLogPath,
this.tsbSelectPath});
this.tsbSelectPath,
this.tsbDetectPath,
this.tsbRemovePath});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(695, 25);
......@@ -85,13 +89,28 @@
this.toolStripLabel1.Text = "日志路径:";
//
// tsbSelectPath
//
//
this.tsbSelectPath.Image = global::Tools.Properties.Resources.文件夹;
this.tsbSelectPath.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSelectPath.Name = "tsbSelectPath";
this.tsbSelectPath.Size = new System.Drawing.Size(76, 22);
this.tsbSelectPath.Text = "选择路径";
//
//
// tsbDetectPath
//
this.tsbDetectPath.Image = global::Tools.Properties.Resources.文件夹;
this.tsbDetectPath.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbDetectPath.Name = "tsbDetectPath";
this.tsbDetectPath.Size = new System.Drawing.Size(76, 22);
this.tsbDetectPath.Text = "探测路径";
//
// tsbRemovePath
//
this.tsbRemovePath.Name = "tsbRemovePath";
this.tsbRemovePath.Size = new System.Drawing.Size(28, 22);
this.tsbRemovePath.Text = "×";
this.tsbRemovePath.ToolTipText = "移除当前路径";
//
// listBox1
//
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
......@@ -173,6 +192,8 @@
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripButton tsbSelectPath;
private System.Windows.Forms.ToolStripButton tsbDetectPath;
private System.Windows.Forms.ToolStripButton tsbRemovePath;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.SplitContainer splitContainer1;
......
This diff is collapsed.
......@@ -400,7 +400,7 @@ namespace Tools.UI
this.Controls.Add(this.tabControl);
this.MinimumSize = new System.Drawing.Size(640, 420);
this.Name = "wTextFormatter";
this.Text = "文本格式化";
this.Text = "格式化工具";
this.tabControl.ResumeLayout(false);
this.tabSql.ResumeLayout(false);
this.tlpSql.ResumeLayout(false);
......
......@@ -45,12 +45,11 @@ namespace Tools
this.CreateModule(Tools_uni, typeof(UI.wTaskBoard), "任务看板", "tr:任务看板的简易化工具,免除翻页困扰"),
this.CreateModule(Tools_uni, typeof(UI.wLoginPwd), "密码解析", "tr:用于登陆密码的解密加密"),
this.CreateModule(Tools_uni, typeof(WindowsSearch.FrmSearch), "文件搜索", "lxj:用于搜索文件内容"),
this.CreateModule(Tools_uni, typeof(UI.wTextFormatter), "文本格式化", "tr:SQL和JSON文本格式化工具"),
//-------------------------------
this.CreateModule(Tools_imp, typeof(UpdateExecuter.frmMain), "更新执行工具", "lxj:用于客户更新和执行SQL脚本"),
this.CreateModule(Tools_imp, typeof(UI.wEmptyTable), "清空表", "tr:输入主表、自动清空关联表的工具"),
this.CreateModule(Tools_imp, typeof(UI.wExcelExportSetting), "Excel导出设置", "tr:Excel导出配置图形化版本"),
this.CreateModule(Tools_imp, typeof(UI.wLogViewer), "日志查看器", "tr:可以方便的查看系统日志"),
this.CreateModule(Tools_imp, typeof(UI.wTextFormatter), "格式化工具", "tr:SQL和JSON文本格式化工具"),
this.CreateModule(Tools_imp, typeof(DotNetVersionChecker.FrmVersion), "系统检测", "lxj:检测操作系统运行环境"),
//-------------------------------
this.CreateModule(Tools_dev, typeof(Ftt.PatchPack.FrmMain), "自动打包工具", "lxj:用于CS后端程序自动打包成压缩包"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment