Compare commits

..

3 Commits

Author SHA1 Message Date
zsyg
0e550c746b Add files via upload 2025-06-20 21:02:53 +08:00
zsyg
7fb9b53e62 Add files via upload 2025-06-20 20:59:58 +08:00
zsyg
80ce2c6151 Add files via upload 2025-06-20 20:58:10 +08:00
17 changed files with 134 additions and 98 deletions

View File

@@ -4,14 +4,69 @@ using System.Windows.Forms;
namespace AppStore namespace AppStore
{ {
public class AboutForm : Form public class AboutUserControl : UserControl
{ {
public AboutForm() private PictureBox logo = null!;
private Label infoLabel = null!;
public AboutUserControl()
{ {
InitializeComponent(); InitializeComponent();
} }
private void InitializeComponent() private void InitializeComponent()
{
this.Dock = DockStyle.Fill;
this.BackColor = Color.White;
this.Padding = new Padding(20);
// 创建主布局面板
TableLayoutPanel mainLayout = new TableLayoutPanel();
mainLayout.Dock = DockStyle.Fill;
mainLayout.ColumnCount = 1;
mainLayout.RowCount = 2;
mainLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
mainLayout.Padding = new Padding(0, 20, 0, 20);
// 初始化并添加应用图标
logo = new PictureBox();
try
{
logo.Image = Image.FromFile("img/png/kortapp-z.png");
}
catch (Exception ex)
{
Logger.LogError($"无法加载应用图标: {ex.Message}");
logo.Image = SystemIcons.Application.ToBitmap();
}
logo.SizeMode = PictureBoxSizeMode.Zoom;
logo.Width = 200;
logo.Height = 200;
logo.Anchor = AnchorStyles.None;
logo.Margin = new Padding(0, 0, 0, 20);
mainLayout.Controls.Add(logo, 0, 0);
// 初始化并添加应用信息
infoLabel = new Label();
infoLabel.Text = "kortapp-z\n版本: 0.9.8\n一个简单、开源的应用商店\nkortapp-z是完全免费的基于.NET8和C++的软件";
infoLabel.Font = new Font("Microsoft YaHei", 12);
infoLabel.AutoSize = false;
infoLabel.Width = 300;
infoLabel.Height = 100;
infoLabel.TextAlign = ContentAlignment.MiddleCenter;
infoLabel.Anchor = AnchorStyles.None;
mainLayout.Controls.Add(infoLabel, 0, 1);
this.Controls.Add(mainLayout);
}
}
// 保留原AboutForm作为容器(可选)
public class AboutForm : Form
{
public AboutForm()
{ {
this.Text = "关于 kortapp-z"; this.Text = "关于 kortapp-z";
this.Size = new Size(500, 400); this.Size = new Size(500, 400);
@@ -19,48 +74,9 @@ namespace AppStore
this.FormBorderStyle = FormBorderStyle.FixedDialog; this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
// 添加应用图标 var aboutControl = new AboutUserControl();
PictureBox logo = new PictureBox(); this.Controls.Add(aboutControl);
try
{
logo.Image = Image.FromFile("img/png/kortapp-z.png");
logo.SizeMode = PictureBoxSizeMode.Zoom;
logo.Width = 200;
logo.Height = 200;
logo.Location = new Point((this.Width - logo.Width) / 2, 30);
this.Controls.Add(logo);
}
catch (Exception ex)
{
MessageBox.Show($"无法加载应用图标: {ex.Message}");
}
// 添加应用信息
Label infoLabel = new Label();
infoLabel.Text = "kortapp-z\n版本: 0.9.5\n一个简单、开源的应用商店\nkortapp-z是完全免费的基于.NET8和C++的软件";
infoLabel.Font = new Font("Microsoft YaHei", 12);
infoLabel.AutoSize = false;
infoLabel.Width = this.ClientSize.Width - 40;
infoLabel.Height = 100;
infoLabel.TextAlign = ContentAlignment.MiddleCenter;
infoLabel.Location = new Point(
20,
logo.Bottom + 20
);
this.Controls.Add(infoLabel);
// 添加关闭按钮
Button closeButton = new Button();
closeButton.Text = "关闭";
closeButton.Width = 100;
closeButton.Height = 40;
closeButton.Location = new Point(
(this.Width - closeButton.Width) / 2,
infoLabel.Bottom + 30
);
closeButton.Click += (s, e) => this.Close();
this.Controls.Add(closeButton);
} }
} }
} }

View File

@@ -104,8 +104,7 @@ namespace AppStore
styleButton(btnAbout); styleButton(btnAbout);
btnAbout.Click += (s, e) => { btnAbout.Click += (s, e) => {
Logger.Log("用户点击了'关于'按钮"); Logger.Log("用户点击了'关于'按钮");
var aboutForm = new AboutForm(); ShowAboutView();
aboutForm.ShowDialog();
}; };
buttonPanel.Controls.Add(btnAbout); buttonPanel.Controls.Add(btnAbout);
@@ -135,8 +134,16 @@ namespace AppStore
/// </summary> /// </summary>
private void ShowSettingsView() private void ShowSettingsView()
{ {
var settingsForm = new SettingsForm(); contentPanel.Controls.Clear();
settingsForm.ShowDialog(); // 以模态对话框形式显示设置窗口 var settingsControl = new SettingsUserControl();
contentPanel.Controls.Add(settingsControl);
}
private void ShowAboutView()
{
contentPanel.Controls.Clear();
var aboutControl = new AboutUserControl();
contentPanel.Controls.Add(aboutControl);
} }
/// <summary> /// <summary>
@@ -216,6 +223,11 @@ namespace AppStore
"https://ghproxy.net/https://github.com/amir1376/ab-download-manager/releases/download/v1.6.4/ABDownloadManager_1.6.4_windows_x64.exe", "https://ghproxy.net/https://github.com/amir1376/ab-download-manager/releases/download/v1.6.4/ABDownloadManager_1.6.4_windows_x64.exe",
"img/png/ABDM.png")); "img/png/ABDM.png"));
flowPanel.Controls.Add(CreateAppCard(
"NDM",
"https://ghproxy.net/https://github.com/zs-yg/package/releases/download/v0.7/NeatDM_setup.exe",
"img/jpg/NDM.jpg"));
flowPanel.Controls.Add(CreateAppCard( flowPanel.Controls.Add(CreateAppCard(
"python3.8", "python3.8",
"https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe", "https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe",
@@ -306,6 +318,11 @@ namespace AppStore
"https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false", "https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false",
"img/jpg/vs.jpg")); "img/jpg/vs.jpg"));
flowPanel.Controls.Add(CreateAppCard(
"VSCodium",
"https://visualstudio.microsoft.com/zh-hans/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false",
"img/png/codium_cnl.png"));
flowPanel.Controls.Add(CreateAppCard( flowPanel.Controls.Add(CreateAppCard(
"7-Zip", "7-Zip",
"https://objects.githubusercontent.com/github-production-release-asset-2e65be/466446150/1645817e-3677-4207-93ff-e62de7e147be?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250613%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250613T035936Z&X-Amz-Expires=300&X-Amz-Signature=5e02d5fc34f45bd8308029c9fc78052007e9475ce0e32775619921cb8f3b83ea&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3D7z2409-x64.exe&response-content-type=application%2Foctet-stream", "https://objects.githubusercontent.com/github-production-release-asset-2e65be/466446150/1645817e-3677-4207-93ff-e62de7e147be?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20250613%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250613T035936Z&X-Amz-Expires=300&X-Amz-Signature=5e02d5fc34f45bd8308029c9fc78052007e9475ce0e32775619921cb8f3b83ea&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3D7z2409-x64.exe&response-content-type=application%2Foctet-stream",

View File

@@ -1,50 +1,53 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
namespace AppStore namespace AppStore
{ {
public class SettingsForm : Form public class SettingsUserControl : UserControl
{ {
private Button btnCleanLogs; private Button btnCleanLogs;
public SettingsForm() public SettingsUserControl()
{ {
this.Text = "设置"; this.Dock = DockStyle.Fill;
this.Size = new Size(400, 300); this.BackColor = Color.White;
this.StartPosition = FormStartPosition.CenterParent;
// 设置顶部内边距
btnCleanLogs = new Button(); this.Padding = new Padding(0, 30, 0, 0);
btnCleanLogs.Text = "清理日志";
btnCleanLogs.Size = new Size(150, 40); btnCleanLogs = new Button();
btnCleanLogs.Location = new Point(120, 100); btnCleanLogs.Text = "清理日志";
btnCleanLogs.Font = new Font("Microsoft YaHei", 10); btnCleanLogs.Size = new Size(150, 40);
btnCleanLogs.Click += (s, e) => CleanLogs(); btnCleanLogs.Location = new Point((this.Width - 150) / 2, 50); // 调整Y坐标为50靠近顶部
this.Controls.Add(btnCleanLogs); btnCleanLogs.Font = new Font("Microsoft YaHei", 10);
} btnCleanLogs.Anchor = AnchorStyles.Top; // 添加顶部锚点
btnCleanLogs.Click += (s, e) => CleanLogs();
private void CleanLogs() this.Controls.Add(btnCleanLogs);
{ }
try
{ private void CleanLogs()
string logCleanerPath = Path.Combine("resource", "log_cleaner.exe"); {
try
if (File.Exists(logCleanerPath)) {
{ string logCleanerPath = Path.Combine("resource", "log_cleaner.exe");
Process.Start(logCleanerPath);
MessageBox.Show("日志清理程序已启动", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); if (File.Exists(logCleanerPath))
} {
else Process.Start(logCleanerPath);
{ MessageBox.Show("日志清理程序已启动", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("日志清理程序未找到", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); }
} else
} {
catch (Exception ex) MessageBox.Show("日志清理程序未找到", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
{ }
Logger.LogError("清理日志时出错", ex); }
MessageBox.Show($"清理日志时出错: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); catch (Exception ex)
} {
} Logger.LogError("清理日志时出错", ex);
} MessageBox.Show($"清理日志时出错: {ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
}
}
}

BIN
img/jpg/D.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/jpg/Min.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/jpg/NDM.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
img/jpg/vs.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
img/png/Ditto.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
img/png/Go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/png/SSM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
img/png/brave.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
img/png/codium_cnl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
img/png/java.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
img/png/nodejs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/png/openark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/png/ruby.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
img/png/rust.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB