Compare commits

...

2 Commits

Author SHA1 Message Date
zsyg
43027d7953 Add files via upload 2025-07-07 18:07:29 +08:00
zsyg
6d2711da08 删除艺术字 2025-07-07 17:52:13 +08:00
17 changed files with 179 additions and 218 deletions

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@@ -57,7 +51,7 @@ namespace AppStore
// 初始化并添加应用信息 // 初始化并添加应用信息
infoLabel = new Label(); infoLabel = new Label();
infoLabel.Text = "kortapp-z\n版本: 1.2.6\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/C++的软件"; infoLabel.Text = "kortapp-z\n版本: 1.2.7\n作者: zs-yg\n一个简单、开源的应用商店\nkortapp-z是完全免费\n基于.NET8和C/C++的软件";
infoLabel.Font = new Font("Microsoft YaHei", 12); infoLabel.Font = new Font("Microsoft YaHei", 12);
infoLabel.AutoSize = false; infoLabel.AutoSize = false;
infoLabel.Width = 300; infoLabel.Width = 300;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@@ -1,131 +1,137 @@
// _ _ using System;
//| | _____ _ __| |_ __ _ _ __ _ __ ____ using System.Drawing;
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ / using System.Windows.Forms;
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___| namespace AppStore
// |_| |_| {
using System; public class DownloadItem : UserControl
using System.Drawing; {
using System.Windows.Forms; private Label nameLabel;
private ProgressBar progressBar;
namespace AppStore private Label statusLabel;
{ private Button cancelBtn;
public class DownloadItem : UserControl
{ public string FileName { get; set; } = string.Empty;
private Label nameLabel; public int Progress { get; set; }
private ProgressBar progressBar; public string Status { get; set; } = string.Empty;
private Label statusLabel;
private Button cancelBtn; public DownloadItem()
{
public string FileName { get; set; } = string.Empty; nameLabel = new Label();
public int Progress { get; set; } progressBar = new ProgressBar();
public string Status { get; set; } = string.Empty; statusLabel = new Label();
cancelBtn = new Button();
public DownloadItem()
{ InitializeComponent();
nameLabel = new Label();
progressBar = new ProgressBar(); // 监听主题变化
statusLabel = new Label(); ThemeManager.ThemeChanged += (theme) => {
cancelBtn = new Button(); this.Invoke((MethodInvoker)delegate {
ApplyTheme();
InitializeComponent(); });
};
// 监听主题变化 }
ThemeManager.ThemeChanged += (theme) => {
this.Invoke((MethodInvoker)delegate { private void ApplyTheme()
ApplyTheme(); {
}); this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
}; ? Color.White
} : Color.Black;
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
private void ApplyTheme() ? Color.Black
{ : Color.White;
this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
? Color.White cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
: Color.Black; ? SystemColors.Control
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light : Color.FromArgb(70, 70, 70);
? Color.Black cancelBtn.ForeColor = ThemeManager.TextColor;
: Color.White; }
cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light private void InitializeComponent()
? SystemColors.Control {
: Color.FromArgb(70, 70, 70); this.Size = new Size(400, 60);
cancelBtn.ForeColor = ThemeManager.TextColor; this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
} ? Color.White
: Color.Black;
private void InitializeComponent() this.BorderStyle = BorderStyle.None; // 禁用默认边框
{ this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
this.Size = new Size(400, 60); ? Color.Black
this.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light : Color.White;
? Color.White this.Paint += DownloadItem_Paint; // 添加自定义绘制
: Color.Black;
this.BorderStyle = BorderStyle.FixedSingle; // 文件名标签
this.ForeColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light nameLabel = new Label();
? Color.Black nameLabel.AutoSize = true;
: Color.White; nameLabel.Location = new Point(10, 10);
nameLabel.Font = new Font("Microsoft YaHei", 9, FontStyle.Bold);
// 文件名标签 this.Controls.Add(nameLabel);
nameLabel = new Label();
nameLabel.AutoSize = true; // 进度条
nameLabel.Location = new Point(10, 10); progressBar = new ProgressBar();
nameLabel.Font = new Font("Microsoft YaHei", 9, FontStyle.Bold); progressBar.Size = new Size(200, 20);
this.Controls.Add(nameLabel); progressBar.Location = new Point(10, 30);
this.Controls.Add(progressBar);
// 进度条
progressBar = new ProgressBar(); // 状态标签
progressBar.Size = new Size(200, 20); statusLabel = new Label();
progressBar.Location = new Point(10, 30); statusLabel.AutoSize = true;
this.Controls.Add(progressBar); statusLabel.Location = new Point(220, 30);
statusLabel.Font = new Font("Microsoft YaHei", 8);
// 状态标签 this.Controls.Add(statusLabel);
statusLabel = new Label();
statusLabel.AutoSize = true; // 取消按钮
statusLabel.Location = new Point(220, 30); cancelBtn = new Button();
statusLabel.Font = new Font("Microsoft YaHei", 8); cancelBtn.Text = "取消";
this.Controls.Add(statusLabel); cancelBtn.Size = new Size(60, 25);
cancelBtn.Location = new Point(320, 30);
// 取消按钮 cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light
cancelBtn = new Button(); ? SystemColors.Control
cancelBtn.Text = "取消"; : Color.FromArgb(70, 70, 70);
cancelBtn.Size = new Size(60, 25); cancelBtn.ForeColor = ThemeManager.TextColor;
cancelBtn.Location = new Point(320, 30); cancelBtn.FlatStyle = FlatStyle.Flat;
cancelBtn.BackColor = ThemeManager.CurrentTheme == ThemeManager.ThemeMode.Light cancelBtn.FlatAppearance.BorderSize = 0;
? SystemColors.Control cancelBtn.Click += CancelBtn_Click;
: Color.FromArgb(70, 70, 70); this.Controls.Add(cancelBtn);
cancelBtn.ForeColor = ThemeManager.TextColor; }
cancelBtn.FlatStyle = FlatStyle.Flat;
cancelBtn.FlatAppearance.BorderSize = 0; public void UpdateDisplay()
cancelBtn.Click += CancelBtn_Click; {
this.Controls.Add(cancelBtn); nameLabel.Text = FileName;
} progressBar.Value = Progress;
statusLabel.Text = Status;
public void UpdateDisplay() this.Invalidate(); // 触发重绘
{ }
nameLabel.Text = FileName;
progressBar.Value = Progress; private void DownloadItem_Paint(object sender, PaintEventArgs e)
statusLabel.Text = Status; {
} // 自定义边框绘制
using (var pen = new Pen(ThemeManager.BorderColor, 1))
private void CancelBtn_Click(object sender, EventArgs e) {
{ e.Graphics.DrawRectangle(pen,
if (sender == null || e == null) return; new Rectangle(0, 0, this.Width - 1, this.Height - 1));
if (InvokeRequired) }
{ }
Invoke(new EventHandler(CancelBtn_Click), sender, e);
return; private void CancelBtn_Click(object sender, EventArgs e)
} {
if (sender == null || e == null) return;
try if (InvokeRequired)
{ {
DownloadManager.Instance.CancelDownload(this); Invoke(new EventHandler(CancelBtn_Click), sender, e);
Status = "已取消"; return;
UpdateDisplay(); }
}
catch (Exception ex) try
{ {
Status = $"取消失败: {ex.Message}"; DownloadManager.Instance.CancelDownload(this);
UpdateDisplay(); Status = "已取消";
} UpdateDisplay();
} }
} catch (Exception ex)
} {
Status = $"取消失败: {ex.Message}";
UpdateDisplay();
}
}
}
}

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#nullable enable #nullable enable
using System; using System;
using System.Drawing; using System.Drawing;
@@ -132,6 +126,10 @@ namespace AppStore
private Button btnAbout = null!; private Button btnAbout = null!;
// 内容显示面板 // 内容显示面板
private Panel contentPanel = null!; private Panel contentPanel = null!;
// 系统托盘图标
private NotifyIcon trayIcon = null!;
// 托盘右键菜单
private ContextMenuStrip trayMenu = null!;
/// <summary> /// <summary>
/// 初始化窗体组件 /// 初始化窗体组件
@@ -146,6 +144,41 @@ namespace AppStore
this.StartPosition = FormStartPosition.CenterScreen; this.StartPosition = FormStartPosition.CenterScreen;
this.Icon = new Icon("img/ico/icon.ico"); // 设置窗体图标 this.Icon = new Icon("img/ico/icon.ico"); // 设置窗体图标
// 初始化系统托盘
trayMenu = new ContextMenuStrip();
trayMenu.Items.Add("打开", null, (s, e) => {
this.Show();
this.WindowState = FormWindowState.Normal;
});
trayMenu.Items.Add("退出", null, (s, e) => Application.Exit());
trayIcon = new NotifyIcon();
trayIcon.Text = "kortapp-z";
trayIcon.Icon = new Icon("img/ico/icon.ico");
trayIcon.ContextMenuStrip = trayMenu;
trayIcon.Visible = true;
trayIcon.DoubleClick += (s, e) => {
this.Show();
this.WindowState = FormWindowState.Normal;
};
// 窗体最小化到托盘处理
this.Resize += (s, e) => {
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide();
}
};
// 窗体关闭按钮处理 - 隐藏到托盘而不是退出
this.FormClosing += (s, e) => {
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
this.Hide();
}
};
// 注册主题变更事件 // 注册主题变更事件
ThemeManager.ThemeChanged += (theme) => ThemeManager.ThemeChanged += (theme) =>
{ {

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <windows.h> #include <windows.h>
#include <vector> #include <vector>
#include <fstream> #include <fstream>

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <vector> #include <vector>

View File

@@ -2,7 +2,7 @@
; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档! ; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档!
#define MyAppName "kortapp-z" #define MyAppName "kortapp-z"
#define MyAppVersion "1.2.6" #define MyAppVersion "1.2.7"
#define MyAppPublisher "zsyg" #define MyAppPublisher "zsyg"
#define MyAppURL "https://github.com/zs-yg/kortapp-z" #define MyAppURL "https://github.com/zs-yg/kortapp-z"
#define MyAppExeName "kortapp-z.exe" #define MyAppExeName "kortapp-z.exe"

View File

@@ -2,7 +2,7 @@
; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档! ; 有关创建 Inno Setup 脚本文件的详细信息,请参阅帮助文档!
#define MyAppName "kortapp-z" #define MyAppName "kortapp-z"
#define MyAppVersion "1.2.6" #define MyAppVersion "1.2.7"
#define MyAppPublisher "zsyg" #define MyAppPublisher "zsyg"
#define MyAppURL "https://github.com/zs-yg/kortapp-z" #define MyAppURL "https://github.com/zs-yg/kortapp-z"
#define MyAppExeName "kortapp-z.exe" #define MyAppExeName "kortapp-z.exe"

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include <chrono> #include <chrono>

View File

@@ -1,9 +1,3 @@
// _ _
//| | _____ _ __| |_ __ _ _ __ _ __ ____
//| |/ / _ \| '__| __/ _` | '_ \| '_ \ ____|_ /
//| | (_) | | | || (_| | |_) | |_) |_____/ /
//|_|\_\___/|_| \__\__,_| .__/| .__/ /___|
// |_| |_|
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;