Commit bb89702f by 任天宇

优化

parent a0e202c1
......@@ -32,6 +32,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.plLeft = new System.Windows.Forms.Panel();
this.gbInfo = new System.Windows.Forms.GroupBox();
this.btnInstallDriver = new System.Windows.Forms.Button();
this.lbCurrentPackageNode = new System.Windows.Forms.Label();
this.lbCurrentPackage = new System.Windows.Forms.Label();
this.lbCurrentLocation = new System.Windows.Forms.Label();
......@@ -73,7 +74,6 @@
this.SampleDeadTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleQuantityUnit = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SamplePackageName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnInstallDriver = new System.Windows.Forms.Button();
this.plLeft.SuspendLayout();
this.gbInfo.SuspendLayout();
this.gbLogin.SuspendLayout();
......@@ -113,13 +113,27 @@
this.gbInfo.TabStop = false;
this.gbInfo.Text = "信息";
//
// btnInstallDriver
//
this.btnInstallDriver.BackColor = System.Drawing.SystemColors.Control;
this.btnInstallDriver.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnInstallDriver.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnInstallDriver.Location = new System.Drawing.Point(3, 272);
this.btnInstallDriver.Name = "btnInstallDriver";
this.btnInstallDriver.Size = new System.Drawing.Size(259, 38);
this.btnInstallDriver.TabIndex = 83;
this.btnInstallDriver.Text = "驱动安装";
this.btnInstallDriver.UseVisualStyleBackColor = false;
this.btnInstallDriver.Visible = false;
this.btnInstallDriver.Click += new System.EventHandler(this.btnInstallDriver_Click);
//
// lbCurrentPackageNode
//
this.lbCurrentPackageNode.AutoSize = true;
this.lbCurrentPackageNode.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentPackageNode.Location = new System.Drawing.Point(16, 180);
this.lbCurrentPackageNode.Name = "lbCurrentPackageNode";
this.lbCurrentPackageNode.Size = new System.Drawing.Size(79, 16);
this.lbCurrentPackageNode.Size = new System.Drawing.Size(80, 16);
this.lbCurrentPackageNode.TabIndex = 7;
this.lbCurrentPackageNode.Text = "当前袋子:";
//
......@@ -129,7 +143,7 @@
this.lbCurrentPackage.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentPackage.Location = new System.Drawing.Point(16, 127);
this.lbCurrentPackage.Name = "lbCurrentPackage";
this.lbCurrentPackage.Size = new System.Drawing.Size(79, 16);
this.lbCurrentPackage.Size = new System.Drawing.Size(80, 16);
this.lbCurrentPackage.TabIndex = 6;
this.lbCurrentPackage.Text = "当前箱号:";
//
......@@ -139,7 +153,7 @@
this.lbCurrentLocation.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentLocation.Location = new System.Drawing.Point(16, 74);
this.lbCurrentLocation.Name = "lbCurrentLocation";
this.lbCurrentLocation.Size = new System.Drawing.Size(79, 16);
this.lbCurrentLocation.Size = new System.Drawing.Size(80, 16);
this.lbCurrentLocation.TabIndex = 5;
this.lbCurrentLocation.Text = "当前位置:";
//
......@@ -149,7 +163,7 @@
this.lbCurrentDepartment.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentDepartment.Location = new System.Drawing.Point(16, 21);
this.lbCurrentDepartment.Name = "lbCurrentDepartment";
this.lbCurrentDepartment.Size = new System.Drawing.Size(79, 16);
this.lbCurrentDepartment.Size = new System.Drawing.Size(80, 16);
this.lbCurrentDepartment.TabIndex = 4;
this.lbCurrentDepartment.Text = "当前部门:";
//
......@@ -569,20 +583,6 @@
this.SamplePackageName.ReadOnly = true;
this.SamplePackageName.Width = 120;
//
// btnInstallDriver
//
this.btnInstallDriver.BackColor = System.Drawing.SystemColors.Control;
this.btnInstallDriver.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnInstallDriver.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnInstallDriver.Location = new System.Drawing.Point(3, 272);
this.btnInstallDriver.Name = "btnInstallDriver";
this.btnInstallDriver.Size = new System.Drawing.Size(259, 38);
this.btnInstallDriver.TabIndex = 83;
this.btnInstallDriver.Text = "驱动安装";
this.btnInstallDriver.UseVisualStyleBackColor = false;
this.btnInstallDriver.Visible = false;
this.btnInstallDriver.Click += new System.EventHandler(this.btnInstallDriver_Click);
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......@@ -593,7 +593,7 @@
this.Controls.Add(this.plLeft);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmMain";
this.Text = "样品入箱客户端 1.0(23.6.14 CP2101)";
this.Text = "样品入箱客户端 1.1(23.7.03 CP2101)";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.plLeft.ResumeLayout(false);
this.gbInfo.ResumeLayout(false);
......
......@@ -94,9 +94,9 @@ namespace Kivii.Client.SamplePackages
}
}
}
catch
catch(Exception ex)
{
throw ex;
}
}
......@@ -125,9 +125,9 @@ namespace Kivii.Client.SamplePackages
}
}
}
catch
catch (Exception ex)
{
throw ex;
}
}
#endregion
......@@ -299,7 +299,7 @@ namespace Kivii.Client.SamplePackages
if (_currentSamples == null) _currentSamples = new List<Sample>();
if (!_currentSamples.Exists(o => o.Kvid == record.Kvid))
{
_currentSamples.Add(record);
_currentSamples.Insert(0, record);
}
this.Invoke(new Action(delegate
{
......@@ -359,9 +359,11 @@ namespace Kivii.Client.SamplePackages
_currentPackage = new Sample();
_currentPackage.PopulateWith(package);
tbSetCurrentPackage.Enabled = _currentPackage == null;
tbCurrentPackage.Text = _currentPackage.Name + (_currentPackage.PackageName.IsNullOrEmpty() ? "" : $"({_currentPackage.PackageName})");
btnClearCurrentPackage.Enabled = _currentPackage != null;
cbSetCurrentPackageNode.Enabled = _currentPackage.Status == (int)PackageStatus.Empty || _currentPackage.Status == (int)PackageStatus.Full;
cbSetCurrentPackageNode.SelectedIndex = 0;
_currentPackage.PackageName = cbSetCurrentPackageNode.Text;
tbCurrentPackage.Text = _currentPackage.Name + (_currentPackage.PackageName.IsNullOrEmpty() ? "" : $"({_currentPackage.PackageName})");
btnScanRfid.Enabled = _currentPackage.Status == (int)PackageStatus.Empty || _currentPackage.Status == (int)PackageStatus.Full;
tbScanSample.Enabled = _currentPackage.Status == (int)PackageStatus.Empty || _currentPackage.Status == (int)PackageStatus.Full;
tbScanSample.Text = "";
......@@ -374,7 +376,6 @@ namespace Kivii.Client.SamplePackages
MessageBox.Show("当前箱子已入库,无法继续操作!", "箱号设置");
return;
}
cbSetCurrentPackageNode.SelectedIndex = 0;
Thread.Sleep(200);
btnScanRfid_Click(null, null);
}
......@@ -529,8 +530,10 @@ namespace Kivii.Client.SamplePackages
btnLogin.Enabled = false;
_client = new JsonServiceClient(tbxServiceUrl.Text);
var auth = new Authenticate { UserName = tbxUserName.Text, Password = tbxPassword.Text, provider = "Kivii" };
var task = _client.PostAsync(auth);
task.Success(resp =>
var resp = _client.Post(auth);
try
{
if (resp != null)
{
initUserInfo(resp);
btnLogin.Enabled = false;
......@@ -542,15 +545,37 @@ namespace Kivii.Client.SamplePackages
lbLogStatus.ForeColor = Color.Green;
//tbSetCurrentPackage.Enabled = !btnLogin.Enabled;
setDefault(tbxServiceUrl, tbxUserName, tbxPassword);
}, true);
task.Error(err =>
}
}
catch(Exception ex)
{
btnLogin.Enabled = true;
initUserInfo();
_client.Dispose();
_client = null;
MessageBox.Show(err.Message, "Login Error");
}, true);
MessageBox.Show(ex.Message, "Login Error");
}
//task.Success(resp =>
//{
// initUserInfo(resp);
// btnLogin.Enabled = false;
// btnLogout.Enabled = !btnLogin.Enabled;
// tbxServiceUrl.Enabled = btnLogin.Enabled;
// tbxUserName.Enabled = btnLogin.Enabled;
// tbxPassword.Enabled = btnLogin.Enabled;
// lbLogStatus.Text = "登录成功";
// lbLogStatus.ForeColor = Color.Green;
// //tbSetCurrentPackage.Enabled = !btnLogin.Enabled;
// setDefault(tbxServiceUrl, tbxUserName, tbxPassword);
//}, true);
//task.Error(err =>
//{
// btnLogin.Enabled = true;
// initUserInfo();
// _client.Dispose();
// _client = null;
// MessageBox.Show(err.Message, "Login Error");
//}, true);
}
private void btnLogout_Click(object sender, EventArgs e)
......@@ -622,7 +647,14 @@ namespace Kivii.Client.SamplePackages
private void cbSetCurrentPackageNode_TextChanged(object sender, EventArgs e)
{
tbCurrentPackageNode.Text = cbSetCurrentPackageNode.Text;
if (_currentPackage != null) _currentPackage.PackageName = cbSetCurrentPackageNode.Text;
if (_currentPackage != null)
{
_currentPackage.PackageName = cbSetCurrentPackageNode.Text;
tbCurrentPackage.Text = _currentPackage.Name + (_currentPackage.PackageName.IsNullOrEmpty() ? "" : $"({_currentPackage.PackageName})");
}
}
private void dgvSamples_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
......
......@@ -34,6 +34,9 @@
<PropertyGroup>
<ApplicationIcon>F.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.0, Version=5.6.2023.4000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Common.5.6.2023.4000\lib\net40\Kivii.Common.V4.0.dll</HintPath>
......@@ -88,6 +91,7 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="App.config" />
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.6190")]
[assembly: AssemblyFileVersion("5.4.2023.6190")]
[assembly: AssemblyVersion("5.4.2023.7030")]
[assembly: AssemblyFileVersion("5.4.2023.7030")]
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
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