diff --git a/WebMVC/WebMVCApi/Controllers/TestController.cs b/WebMVC/WebMVCApi/Controllers/TestController.cs index 7441ffd..5c1735b 100644 --- a/WebMVC/WebMVCApi/Controllers/TestController.cs +++ b/WebMVC/WebMVCApi/Controllers/TestController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using WebMVCApi.Models; +using Zack.ASPNETCore; namespace WebMVCApi.Controllers { @@ -15,9 +16,11 @@ namespace WebMVCApi.Controllers { private IMemoryCache _memoryCache; + private IMemoryCacheHelper _memoryCacheHelper; - public TestController(IMemoryCache _memoryCache) { + public TestController(IMemoryCache _memoryCache, IMemoryCacheHelper _memoryCacheHelper) { this._memoryCache= _memoryCache; + this._memoryCacheHelper = _memoryCacheHelper; } [HttpGet("GetPerson")] @@ -77,5 +80,15 @@ namespace WebMVCApi.Controllers return $"id {id} 的用户{p1.Name}更新成功 {DateTime.Now}"; }); } + + + [HttpGet("test1")] + public async Task test1(long id) + { + return _memoryCacheHelper.GetOrCreateAsync($"Book{id}",async (e) => + { + return 123; + },10); + } } } diff --git a/WebMVC/WebMVCApi/Program.cs b/WebMVC/WebMVCApi/Program.cs index e0df9c4..cbe2e5a 100644 --- a/WebMVC/WebMVCApi/Program.cs +++ b/WebMVC/WebMVCApi/Program.cs @@ -1,3 +1,5 @@ +using Zack.ASPNETCore; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -7,6 +9,12 @@ builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddMemoryCache(); +builder.Services.AddScoped(); +builder.Services.AddStackExchangeRedisCache(option => +{ + option.Configuration = "local.wuanwanghao.top:6379"; + option.InstanceName = "cache1"; +}); var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/WebMVC/WebMVCApi/WebMVCApi.csproj b/WebMVC/WebMVCApi/WebMVCApi.csproj index 107ee21..6520fc0 100644 --- a/WebMVC/WebMVCApi/WebMVCApi.csproj +++ b/WebMVC/WebMVCApi/WebMVCApi.csproj @@ -14,6 +14,7 @@ + diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework.sln b/WindowsFormsAppFramework/WindowsFormsAppFramework.sln new file mode 100644 index 0000000..9dc6d48 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsAppFramework", "WindowsFormsAppFramework\WindowsFormsAppFramework.csproj", "{262EB894-D8C3-460B-A2BA-4A11484E89E6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {262EB894-D8C3-460B-A2BA-4A11484E89E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {262EB894-D8C3-460B-A2BA-4A11484E89E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {262EB894-D8C3-460B-A2BA-4A11484E89E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {262EB894-D8C3-460B-A2BA-4A11484E89E6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {552D5839-0BCB-4C3B-B664-46AF3B4E3F9B} + EndGlobalSection +EndGlobal diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/App.config b/WindowsFormsAppFramework/WindowsFormsAppFramework/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.Designer.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.Designer.cs new file mode 100644 index 0000000..98dc86c --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.Designer.cs @@ -0,0 +1,352 @@ +namespace WindowsFormsAppFramework +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.panel1 = new System.Windows.Forms.GroupBox(); + this.panel2 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.progressBar2 = new System.Windows.Forms.ProgressBar(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.virtulAddressSpace = new System.Windows.Forms.GroupBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.progressBar4 = new System.Windows.Forms.ProgressBar(); + this.progressBar3 = new System.Windows.Forms.ProgressBar(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.virtulAddressSpace.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Black; + this.panel1.Controls.Add(this.panel2); + this.panel1.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.panel1.Location = new System.Drawing.Point(35, 36); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(116, 347); + this.panel1.TabIndex = 0; + this.panel1.TabStop = false; + this.panel1.Text = "Cpu使用"; + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Lime; + this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.panel2.Location = new System.Drawing.Point(29, 33); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(57, 291); + this.panel2.TabIndex = 0; + this.panel2.TabStop = false; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.label5); + this.groupBox3.Controls.Add(this.label6); + this.groupBox3.Controls.Add(this.progressBar2); + this.groupBox3.Controls.Add(this.progressBar1); + this.groupBox3.Controls.Add(this.label2); + this.groupBox3.Controls.Add(this.label1); + this.groupBox3.Location = new System.Drawing.Point(174, 41); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(322, 129); + this.groupBox3.TabIndex = 1; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "物理内存 G"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(236, 69); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(41, 12); + this.label5.TabIndex = 5; + this.label5.Text = "label5"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(236, 38); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(41, 12); + this.label6.TabIndex = 4; + this.label6.Text = "label6"; + // + // progressBar2 + // + this.progressBar2.Location = new System.Drawing.Point(91, 69); + this.progressBar2.Name = "progressBar2"; + this.progressBar2.Size = new System.Drawing.Size(129, 21); + this.progressBar2.TabIndex = 3; + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(91, 28); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(129, 22); + this.progressBar1.TabIndex = 2; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(26, 69); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(41, 12); + this.label2.TabIndex = 1; + this.label2.Text = "可用数"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(26, 38); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 12); + this.label1.TabIndex = 0; + this.label1.Text = "总数"; + // + // virtulAddressSpace + // + this.virtulAddressSpace.Controls.Add(this.label7); + this.virtulAddressSpace.Controls.Add(this.label8); + this.virtulAddressSpace.Controls.Add(this.progressBar4); + this.virtulAddressSpace.Controls.Add(this.progressBar3); + this.virtulAddressSpace.Controls.Add(this.label4); + this.virtulAddressSpace.Controls.Add(this.label3); + this.virtulAddressSpace.Location = new System.Drawing.Point(174, 211); + this.virtulAddressSpace.Name = "virtulAddressSpace"; + this.virtulAddressSpace.Size = new System.Drawing.Size(322, 149); + this.virtulAddressSpace.TabIndex = 2; + this.virtulAddressSpace.TabStop = false; + this.virtulAddressSpace.Text = "虚拟地址空间 G"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(236, 83); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(41, 12); + this.label7.TabIndex = 7; + this.label7.Text = "label7"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(236, 43); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(41, 12); + this.label8.TabIndex = 6; + this.label8.Text = "label8"; + // + // progressBar4 + // + this.progressBar4.Location = new System.Drawing.Point(91, 74); + this.progressBar4.Name = "progressBar4"; + this.progressBar4.Size = new System.Drawing.Size(129, 21); + this.progressBar4.TabIndex = 5; + // + // progressBar3 + // + this.progressBar3.Location = new System.Drawing.Point(91, 36); + this.progressBar3.Name = "progressBar3"; + this.progressBar3.Size = new System.Drawing.Size(129, 19); + this.progressBar3.TabIndex = 4; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(26, 83); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(41, 12); + this.label4.TabIndex = 1; + this.label4.Text = "可用数"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(26, 43); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(29, 12); + this.label3.TabIndex = 0; + this.label3.Text = "总数"; + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(697, 41); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(173, 12); + this.label9.TabIndex = 3; + this.label9.Text = "获取前15个内存占用较高的进程"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(699, 69); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 4; + this.button1.Text = "刷新"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(795, 68); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 5; + this.button2.Text = "kill"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 12; + this.listBox1.Location = new System.Drawing.Point(699, 112); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(171, 244); + this.listBox1.TabIndex = 6; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(12, 397); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(53, 12); + this.label10.TabIndex = 7; + this.label10.Text = "进程数:"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(122, 397); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(71, 12); + this.label11.TabIndex = 8; + this.label11.Text = "cpu使用率:"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(62, 397); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(47, 12); + this.label12.TabIndex = 9; + this.label12.Text = "label12"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(194, 396); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(47, 12); + this.label13.TabIndex = 10; + this.label13.Text = "label13"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(934, 418); + this.Controls.Add(this.label13); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.label10); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.label9); + this.Controls.Add(this.virtulAddressSpace); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.panel1); + this.Name = "Form1"; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.panel1.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.virtulAddressSpace.ResumeLayout(false); + this.virtulAddressSpace.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox panel1; + private System.Windows.Forms.GroupBox panel2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox virtulAddressSpace; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.ProgressBar progressBar2; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.ProgressBar progressBar4; + private System.Windows.Forms.ProgressBar progressBar3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + } +} + diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.cs new file mode 100644 index 0000000..1f45c49 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.cs @@ -0,0 +1,161 @@ +using Microsoft.VisualBasic.Devices; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Management; +using System.Reflection.Emit; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsAppFramework +{ + public partial class Form1 : Form + { + + Process[] myProcess = Array.Empty(); + int mhight = 0; + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + LoadTop10(); + // MessageBox.Show("Test"); + } + private void CreateImage() + { + int i = panel2.Height / 100; + Bitmap bitmap = new Bitmap(panel2.Width, panel2.Height); + Graphics graphics = Graphics.FromImage(bitmap); + graphics.Clear(Color.White); + SolidBrush solidBrush = new SolidBrush(Color.Lime); + graphics.FillRectangle(solidBrush, 0, panel2.Height - mhight * i, panel2.Width, mhight * i); + panel2.BackgroundImage = bitmap; + } + private void MyUse() + { + + mhight = CpuPercent(); + slideShow(); + CreateImage(); + + } + + private int CpuPercent() + { + ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("select * from Win32_Processor"); + + foreach (ManagementObject mobject in managementObjectSearcher.Get()) + { + return Convert.ToInt32(mobject["LoadPercentage"]?.ToString()); + } + return 0; + } + + private void timer1_Tick(object sender, EventArgs e) + { + Task.Run(() => + { + MyUse(); + }); + } + + private void button2_Click(object sender, EventArgs e) + { + if (null == listBox1.SelectedItem) + { + MessageBox.Show("请选择进程"); + return; + } + string name = listBox1.SelectedItem.ToString() ?? ""; + if (string.IsNullOrEmpty(name)) + { + MessageBox.Show("请选择进程"); + return; + } + Process[] processs = Process.GetProcesses(); + foreach (var p in processs) + { + try + { + if (p.ProcessName.ToLower().Trim().Equals(name)) + { + p.Kill(); + MessageBox.Show("已关闭进程,请刷新!"); + return; + } + } + catch + { + return; + } + } + } + + private void button1_Click(object sender, EventArgs e) + { + LoadTop10(); + } + + private void slideShow() + { + this.BeginInvoke(new Action(() => + { + this.label12.Text = Process.GetProcesses().Length.ToString(); + this.label13.Text = mhight + "%"; + })); + } + + private void LoadTop10() + { + this.BeginInvoke(new Action(() => + { + // 获取当前进程对象 + Process currentProcess = Process.GetCurrentProcess(); + // 获取系统的总内存大小 + ComputerInfo computerInfo = new ComputerInfo(); + var totalMemory = Convert.ToDouble(computerInfo.TotalPhysicalMemory) / 1024 / 1024 / 1024; + this.label6.Text = totalMemory.ToString("0.00"); + this.progressBar1.Maximum = Convert.ToInt32(totalMemory); + this.progressBar1.Value = Convert.ToInt32(totalMemory); + // 获取系统的内存剩余大小 + var availablePhysicalMemory = Convert.ToDouble(computerInfo.AvailablePhysicalMemory) / 1024 / 1024 / 1024; + this.label5.Text = availablePhysicalMemory.ToString("0.00"); + this.progressBar2.Maximum = Convert.ToInt32(totalMemory); + this.progressBar2.Value = Convert.ToInt32(availablePhysicalMemory); + + + // 获取系统的总虚拟内存大小 + var totalVirtualMemory = Convert.ToDouble(computerInfo.TotalVirtualMemory) / 1024 / 1024 / 1024; + this.label8.Text = totalVirtualMemory.ToString("0.00"); + this.progressBar3.Maximum = Convert.ToInt32(totalVirtualMemory); + this.progressBar3.Value = Convert.ToInt32(totalVirtualMemory); + // 获取系统的虚拟内存剩余大小 + var availableVirtualMemory = Convert.ToDouble(computerInfo.AvailableVirtualMemory) / 1024 / 1024 / 1024; + this.label7.Text = availableVirtualMemory.ToString("0.00"); + this.progressBar4.Maximum = Convert.ToInt32(totalVirtualMemory * 100); + this.progressBar4.Value = Convert.ToInt32(availableVirtualMemory * 100); + var processes = Process.GetProcesses(); + var list = processes.OrderByDescending(p => + { + return p.PagedMemorySize64; + }).Take(15).Select(p => p.ProcessName); + listBox1.Items.Clear(); + listBox1.Items.AddRange(list.ToArray()); + + this.label12.Text = processes.Length.ToString(); + this.label13.Text = CpuPercent() + "%"; + + // 获取系统的 CPU 核数 + int cpuCores = Environment.ProcessorCount; + + // 获取可用的 CPU 核数 + int availableCores = currentProcess.ProcessorAffinity.ToInt32(); + })); + } + } +} diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.resx b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.resx new file mode 100644 index 0000000..1f666f2 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Program.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Program.cs new file mode 100644 index 0000000..3611be7 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsAppFramework +{ + internal static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Form1 form1 = new Form1(); + Application.Run(form1); + } + } +} diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/AssemblyInfo.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..95e417b --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsAppFramework")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsAppFramework")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("262eb894-d8c3-460b-a2ba-4a11484e89e6")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.Designer.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.Designer.cs new file mode 100644 index 0000000..09e17eb --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsAppFramework.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsAppFramework.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.resx b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.Designer.cs b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.Designer.cs new file mode 100644 index 0000000..b15e576 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsAppFramework.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.settings b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/WindowsFormsAppFramework.csproj b/WindowsFormsAppFramework/WindowsFormsAppFramework/WindowsFormsAppFramework.csproj new file mode 100644 index 0000000..82ec2e5 --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/WindowsFormsAppFramework.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {262EB894-D8C3-460B-A2BA-4A11484E89E6} + WinExe + WindowsFormsAppFramework + WindowsFormsAppFramework + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + ..\packages\System.CodeDom.7.0.0\lib\net462\System.CodeDom.dll + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/WindowsFormsAppFramework/WindowsFormsAppFramework/packages.config b/WindowsFormsAppFramework/WindowsFormsAppFramework/packages.config new file mode 100644 index 0000000..3352b0b --- /dev/null +++ b/WindowsFormsAppFramework/WindowsFormsAppFramework/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file