Commit 75b1054b authored by tr's avatar tr

1、自动更新功能:实验版

parent ed5c1660
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -235,6 +235,9 @@ namespace Tools.MyCommon
//布尔特殊处理
if (drv[field] == DBNull.Value && drv.Row.Table.Columns[field].DataType.Name.Equals("Boolean"))
drv[field] = false;
//日期值特殊处理
if (drv[field] == DBNull.Value && drv.Row.Table.Columns[field].DataType.Name.Equals("DateTime"))
drv[field] = DateTime.Now;
//设置绑定
var property = bind.PropertyName;
c.DataBindings.Clear();
......
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
......@@ -162,7 +163,45 @@ namespace Tools.MyUtils
}
#endregion
#region 读写配置文件
/// <summary>
/// 读取AppSettings
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
public static string AppSettings(string key)
{
return ConfigurationManager.AppSettings[key];
}
/// <summary>
/// 编辑AppSettings
/// <para>存在则更新,否则添加</para>
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
public static void AppSettings(string key, string value)
{
//打开配置文件(*.exe.config)
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//存在时更新,否则添加
if (config.AppSettings.Settings.AllKeys.Contains(key))
{
config.AppSettings.Settings[key].Value = value;
}
else
{
config.AppSettings.Settings.Add(key, value);
}
//保存配置文件
config.Save(ConfigurationSaveMode.Modified);
//更新缓存
ConfigurationManager.RefreshSection("appSettings");
}
#endregion
#region winform:提示;帮助窗口;异步UI支持
/// <summary>
......
......@@ -190,6 +190,16 @@ namespace Tools.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 压缩包 {
get {
object obj = ResourceManager.GetObject("压缩包", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
......@@ -330,6 +340,16 @@ namespace Tools.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 空 {
get {
object obj = ResourceManager.GetObject("空", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
......
......@@ -157,6 +157,9 @@
<data name="加载" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\加载.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="压缩包" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\压缩包.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="复制" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\复制.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
......@@ -199,6 +202,9 @@
<data name="生成" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\生成.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="空" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\空.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="类" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\类.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
......
......@@ -39,8 +39,8 @@
<Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\FunnyPick\packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\FunnyPick\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.dll</HintPath>
......@@ -55,6 +55,7 @@
<HintPath>..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -102,6 +103,12 @@
<Compile Include="UI\Popups\wSelectTemplates.Designer.cs">
<DependentUpon>wSelectTemplates.cs</DependentUpon>
</Compile>
<Compile Include="UI\sys\wUploadUpdate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\sys\wUploadUpdate.Designer.cs">
<DependentUpon>wUploadUpdate.cs</DependentUpon>
</Compile>
<Compile Include="UI\wExcelExportSetting.cs">
<SubType>Form</SubType>
</Compile>
......@@ -283,6 +290,9 @@
<EmbeddedResource Include="UI\Popups\wSelectTemplates.resx">
<DependentUpon>wSelectTemplates.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\sys\wUploadUpdate.resx">
<DependentUpon>wUploadUpdate.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wExcelExportSetting.resx">
<DependentUpon>wExcelExportSetting.cs</DependentUpon>
</EmbeddedResource>
......@@ -435,6 +445,8 @@
</ItemGroup>
<ItemGroup>
<Content Include="favior.ico" />
<None Include="Resources\压缩包.png" />
<None Include="Resources\空.png" />
<None Include="Resources\生成.png" />
<None Include="Resources\最小化.png" />
<None Include="Resources\最大化.png" />
......@@ -443,5 +455,6 @@
<None Include="Resources\清空.png" />
<None Include="Resources\编辑.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
namespace Tools.UI.sys
{
partial class wUploadUpdate
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnUpload = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tbUName = new System.Windows.Forms.TextBox();
this.tbUSize = new System.Windows.Forms.TextBox();
this.dpUDate = new System.Windows.Forms.DateTimePicker();
this.tbURemark = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.btnSave = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label5 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// btnUpload
//
this.btnUpload.Location = new System.Drawing.Point(80, 303);
this.btnUpload.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(117, 33);
this.btnUpload.TabIndex = 1;
this.btnUpload.Text = "上传压缩包";
this.btnUpload.UseVisualStyleBackColor = true;
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(143, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 2;
this.label1.Text = "更新时间:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(143, 57);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 17);
this.label2.TabIndex = 3;
this.label2.Text = "文件名称:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(143, 87);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 4;
this.label3.Text = "文件大小:";
//
// tbUName
//
this.tbUName.Enabled = false;
this.tbUName.Location = new System.Drawing.Point(216, 53);
this.tbUName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tbUName.Name = "tbUName";
this.tbUName.ReadOnly = true;
this.tbUName.Size = new System.Drawing.Size(240, 23);
this.tbUName.TabIndex = 6;
//
// tbUSize
//
this.tbUSize.Enabled = false;
this.tbUSize.Location = new System.Drawing.Point(216, 83);
this.tbUSize.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tbUSize.Name = "tbUSize";
this.tbUSize.ReadOnly = true;
this.tbUSize.Size = new System.Drawing.Size(214, 23);
this.tbUSize.TabIndex = 7;
//
// dpUDate
//
this.dpUDate.Enabled = false;
this.dpUDate.Location = new System.Drawing.Point(216, 23);
this.dpUDate.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dpUDate.Name = "dpUDate";
this.dpUDate.Size = new System.Drawing.Size(151, 23);
this.dpUDate.TabIndex = 8;
//
// tbURemark
//
this.tbURemark.Location = new System.Drawing.Point(33, 145);
this.tbURemark.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tbURemark.Multiline = true;
this.tbURemark.Name = "tbURemark";
this.tbURemark.Size = new System.Drawing.Size(423, 143);
this.tbURemark.TabIndex = 9;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(36, 121);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(68, 17);
this.label4.TabIndex = 10;
this.label4.Text = "更新说明:";
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(269, 303);
this.btnSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(117, 33);
this.btnSave.TabIndex = 11;
this.btnSave.Text = "开始更新";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.Window;
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Image = global::Tools.Properties.Resources.空;
this.pictureBox1.InitialImage = null;
this.pictureBox1.Location = new System.Drawing.Point(33, 23);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(88, 88);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(436, 87);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 17);
this.label5.TabIndex = 12;
this.label5.Text = "M";
//
// wUploadUpdate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(489, 356);
this.Controls.Add(this.label5);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.label4);
this.Controls.Add(this.tbURemark);
this.Controls.Add(this.dpUDate);
this.Controls.Add(this.tbUSize);
this.Controls.Add(this.tbUName);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnUpload);
this.Controls.Add(this.pictureBox1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "wUploadUpdate";
this.Text = "上传更新";
this.Load += new System.EventHandler(this.wUploadUpdate_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btnUpload;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox tbUName;
private System.Windows.Forms.TextBox tbUSize;
private System.Windows.Forms.DateTimePicker dpUDate;
private System.Windows.Forms.TextBox tbURemark;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Label label5;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//
using Tools.MyCommon;
using Tools.MyData;
using Tools.MyUtils;
namespace Tools.UI.sys
{
public partial class wUploadUpdate : wEditBasic
{
public wUploadUpdate()
{
InitializeComponent();
}
private void wUploadUpdate_Load(object sender, EventArgs e)
{
this.InitData();
this.InitUI();
}
public override void InitData()
{
//初始化数据库链接
var link = Utils.GetDbLinkString("192.168.1.204", "sa", "sa", "FTT_Work");
this.InitDBHelper(link);
//初始化保存结构
this.ModuleTableList = new List<TQuery> {
new TQuery("FTT_AutoUpdate", "SELECT TOP 0 * FROM FTT_AutoUpdate"),
};
//初始化数据源
this._ds = this._db.GetData(this.ModuleTableList, true);
//无数据行,则新增
var dt = this._ds.Tables[0];
if(dt.DefaultView.Count == 0)
dt.Rows.Add(dt.NewRow());
//绑定基础信息
var drv = this._ds.Tables[0].DefaultView[0];
this.BindBaseInfo(this, drv);
}
public override bool SaveCheck()
{
if (string.IsNullOrEmpty(this.tbURemark.Text.Trim()))
{
Utils.Tip("更新说明不能为空!");
return false;
}
return base.SaveCheck();
}
private void btnUpload_Click(object sender, EventArgs e)
{
//对话框
OpenFileDialog dlg = new OpenFileDialog()
{
Multiselect = false,
Filter = "压缩包|*.rar;*.zip",
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
};
//结果处理
if (dlg.ShowDialog() == DialogResult.OK)
{
//赋值基本信息
var bytes = File.ReadAllBytes(dlg.FileName);
var drv = this._ds.Tables[0].DefaultView[0];
drv["UName"] = Path.GetFileName(dlg.FileName);
drv["USize"] = (bytes.Length / 1000 / 1000).ToString();
drv["UData"] = bytes;
drv.EndEdit();
//上传成功,更新图片
this.pictureBox1.Image = Properties.Resources.压缩包;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
this.Save();
}
}
}
<?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>
</root>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<packages>
<package id="NPOI" version="2.5.1" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.6" targetFramework="net461" />
<package id="SharpZipLib" version="1.2.0" targetFramework="net461" />
<package id="SharpZipLib" version="1.3.2" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -60,6 +60,7 @@
this.lbSysLoginUser = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tsmiSysUpload = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
......@@ -169,6 +170,7 @@
// toolStripMenuItem1
//
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiSysUpload,
this.tsmiSysUpdate,
this.tsmiSysReLogin,
this.tsmiSysExit});
......@@ -179,19 +181,19 @@
// tsmiSysUpdate
//
this.tsmiSysUpdate.Name = "tsmiSysUpdate";
this.tsmiSysUpdate.Size = new System.Drawing.Size(124, 22);
this.tsmiSysUpdate.Size = new System.Drawing.Size(180, 22);
this.tsmiSysUpdate.Text = "检查更新";
//
// tsmiSysReLogin
//
this.tsmiSysReLogin.Name = "tsmiSysReLogin";
this.tsmiSysReLogin.Size = new System.Drawing.Size(124, 22);
this.tsmiSysReLogin.Size = new System.Drawing.Size(180, 22);
this.tsmiSysReLogin.Text = "重新登录";
//
// tsmiSysExit
//
this.tsmiSysExit.Name = "tsmiSysExit";
this.tsmiSysExit.Size = new System.Drawing.Size(124, 22);
this.tsmiSysExit.Size = new System.Drawing.Size(180, 22);
this.tsmiSysExit.Text = "退出系统";
//
// toolStripMenuItem2
......@@ -206,13 +208,13 @@
// tsmiAccPasswordMgr
//
this.tsmiAccPasswordMgr.Name = "tsmiAccPasswordMgr";
this.tsmiAccPasswordMgr.Size = new System.Drawing.Size(124, 22);
this.tsmiAccPasswordMgr.Size = new System.Drawing.Size(180, 22);
this.tsmiAccPasswordMgr.Text = "密码管理";
//
// tsmiAccPersonalSetting
//
this.tsmiAccPersonalSetting.Name = "tsmiAccPersonalSetting";
this.tsmiAccPersonalSetting.Size = new System.Drawing.Size(124, 22);
this.tsmiAccPersonalSetting.Size = new System.Drawing.Size(180, 22);
this.tsmiAccPersonalSetting.Text = "个人设置";
//
// toolStripMenuItem3
......@@ -227,13 +229,13 @@
// tsmiHelpDocument
//
this.tsmiHelpDocument.Name = "tsmiHelpDocument";
this.tsmiHelpDocument.Size = new System.Drawing.Size(124, 22);
this.tsmiHelpDocument.Size = new System.Drawing.Size(180, 22);
this.tsmiHelpDocument.Text = "帮助文档";
//
// tsmiHelpAboutUs
//
this.tsmiHelpAboutUs.Name = "tsmiHelpAboutUs";
this.tsmiHelpAboutUs.Size = new System.Drawing.Size(124, 22);
this.tsmiHelpAboutUs.Size = new System.Drawing.Size(180, 22);
this.tsmiHelpAboutUs.Text = "关于我们";
//
// Header
......@@ -396,6 +398,12 @@
this.label2.Text = "登录人员:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tsmiSysUpload
//
this.tsmiSysUpload.Name = "tsmiSysUpload";
this.tsmiSysUpload.Size = new System.Drawing.Size(180, 22);
this.tsmiSysUpload.Text = "上传更新";
//
// wMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -454,5 +462,6 @@
private System.Windows.Forms.ToolStripMenuItem tsmiAccPasswordMgr;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripMenuItem tsmiSysUpload;
}
}
\ No newline at end of file
......@@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
......@@ -154,7 +156,7 @@ namespace Tools
}
#endregion
#region 基础:系统菜单
#region 基础:系统菜单功能
/// <summary>
/// 事件:菜单栏事件
......@@ -169,6 +171,7 @@ namespace Tools
switch (tsmi.Name.Substring(4))
{
case "SysUpload": this.UploadUpdate(); break;
case "SysUpdate": this.CheckUpdate(); break;
case "SysReLogin": this.ReLogin(); break;
case "SysExit": this.Exit(); break;
......@@ -179,17 +182,32 @@ namespace Tools
default: break;
}
}
#endregion
#region 本地:系统菜单功能
/// <summary>
/// 上传更新
/// </summary>
private void UploadUpdate()
{
new UI.sys.wUploadUpdate().ShowDialog();
}
/// <summary>
/// 系统:检查更新
/// </summary>
private void CheckUpdate()
{
this.ShowMessage("自动更新");
//启动自动更新
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = $@".\AutoUpdate\AutoUpdate.exe",
UseShellExecute = false,
RedirectStandardError = true,
};
Process up = new Process() { StartInfo = info };
up.Start();
//退出当前应用
Application.Exit();
}
/// <summary>
/// 系统:重新登录
......@@ -245,6 +263,10 @@ namespace Tools
}
#endregion
#endregion
#region 本地:模块菜单渲染及打开模块
/// <summary>
......@@ -257,7 +279,6 @@ namespace Tools
this.listView1.ShowItemToolTips = true;
this.listView1.View = View.SmallIcon;
this.listView1.DoubleClick += ListView1_DoubleClick;
//this.listView1.ItemSelectionChanged += ListView1_ItemSelectionChanged;
//装载目录
var mList = this.Extend.GetModuleList();
foreach (ModuleInfo m in mList)
......@@ -271,42 +292,6 @@ namespace Tools
});
}
}
/// <summary>
/// 事件:双击打开模块
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListView1_DoubleClick(object sender, EventArgs e)
{
if (this.listView1.Items.Count == 0)
return;
//打开窗口
try
{
var item = this.listView1.SelectedItems[0];
this.OpenModule(item);
}
catch (Exception ex)
{
var msg = $"错误消息:{ex.Message}\r\n堆栈信息:{ex.StackTrace}";
MyUtils.Utils.Tip(msg, 1200, 800);
}
}
/// <summary>
/// 事件:图标切换
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
var item = e.Item;
if (item == null)
return;
//选中效果
item.ImageIndex = item.Selected ? 0 : 1;
}
/// <summary>
/// 打开模块
/// </summary>
......@@ -345,7 +330,28 @@ namespace Tools
this.tabControl1.SelectedTab = page;
page.Refresh();
}
/// <summary>
/// 事件:双击打开模块
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ListView1_DoubleClick(object sender, EventArgs e)
{
if (this.listView1.Items.Count == 0)
return;
//打开窗口
try
{
var item = this.listView1.SelectedItems[0];
this.OpenModule(item);
}
catch (Exception ex)
{
var msg = $"错误消息:{ex.Message}\r\n堆栈信息:{ex.StackTrace}";
MyUtils.Utils.Tip(msg, 1200, 800);
}
}
/// <summary>
/// 事件:Tab双击(双击移除Page,即关闭窗口)
/// </summary>
......@@ -364,7 +370,6 @@ namespace Tools
#endregion
private void ShowMessage(string msg)
{
MessageBox.Show(msg, "提示");
......
......@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAc
GwAAAk1TRnQBSQFMAgEBCQEAAUABAAFAAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
GwAAAk1TRnQBSQFMAgEBCQEAAUgBAAFIAQABIAEAASABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABgAMAAWADAAEBAQABCAYAATAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
......@@ -249,6 +249,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>478, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>713, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
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