main
forget_the_bright 1 year ago
parent a5e3b070c1
commit 21fa72ad86

@ -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<Object> test1(long id)
{
return _memoryCacheHelper.GetOrCreateAsync<int>($"Book{id}",async (e) =>
{
return 123;
},10);
}
}
}

@ -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<IMemoryCacheHelper, MemoryCacheHelper>();
builder.Services.AddStackExchangeRedisCache(option =>
{
option.Configuration = "local.wuanwanghao.top:6379";
option.InstanceName = "cache1";
});
var app = builder.Build();
// Configure the HTTP request pipeline.

@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="7.0.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Zack.ASPNETCore" Version="1.0.2" />

@ -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

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

@ -0,0 +1,352 @@
namespace WindowsFormsAppFramework
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
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;
}
}

@ -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<Process>();
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();
}));
}
}
}

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

@ -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
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 form1 = new Form1();
Application.Run(form1);
}
}
}

@ -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")]

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsAppFramework.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 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()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[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;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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;
}
}
}
}

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{262EB894-D8C3-460B-A2BA-4A11484E89E6}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsFormsAppFramework</RootNamespace>
<AssemblyName>WindowsFormsAppFramework</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.CodeDom, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.CodeDom.7.0.0\lib\net462\System.CodeDom.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.CodeDom" version="7.0.0" targetFramework="net472" />
<package id="System.Management" version="6.0.1" targetFramework="net472" />
</packages>
Loading…
Cancel
Save