change - 加载界面

dep_nodyang
wangsr 1 year ago
parent 90c7c0381e
commit 8455a4b825

@ -10,22 +10,15 @@ using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
{
public class TestAction: ChemicalWeighingAction, IAction
public class DownToDatabase
{
public static event EventHandler OnAdd;
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning").FirstOrDefault();
this._materialGridControl = materialGridControl;
public DownToDatabase() { }
public DownToDatabase(DbMCControl _materialGridControl)
{
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;
DataGridView clientGridView = _materialGridControl.BaseControl as DataGridView;
//验证是否选中某物料
if (clientGridView.SelectedRows.Count != 1)

@ -28,10 +28,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
DbMCControl materialGridControl =
this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning")
.FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl;
_materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning").FirstOrDefault(); //获取物料数据控件
DownToDatabase downToDatabase = new DownToDatabase(_materialGridControl);
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;

@ -1,65 +1,82 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing
namespace Mesnac.Action.ChemicalWeighing
{
partial class Loading
{
/// <summary>
/// Required designer variable.
/// 必需的设计器变量。
/// </summary>
private IContainer components = null;
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>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
#region Windows 窗体设计器生成的代码
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// label2
// pictureBox1
//
this.pictureBox1.Image = global::Mesnac.Action.ChemicalWeighing.Properties.Resources.loading;
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(129, 125);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(85, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 0;
this.label2.Text = "数据加载中";
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold);
this.label1.Location = new System.Drawing.Point(7, 140);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(110, 27);
this.label1.TabIndex = 1;
this.label1.Text = "加载中……";
//
// Loading
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(299, 72);
this.Controls.Add(this.label2);
this.ClientSize = new System.Drawing.Size(153, 175);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Loading";
this.Text = "Loading";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.TopMost = true;
this.TransparencyKey = System.Drawing.SystemColors.Control;
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
}
}

@ -1,6 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.Pdf.ContentGeneration;
namespace Mesnac.Action.ChemicalWeighing
{
@ -9,24 +15,12 @@ namespace Mesnac.Action.ChemicalWeighing
public Loading()
{
InitializeComponent();
this.ControlBox = true ;
this.MaximizeBox = false;
this.MinimizeBox = false;
FormBorderStyle = FormBorderStyle.FixedSingle;
// orm有个FormBorderStyle属性设为FixedSingle即可
}
private void loading_Load(object sender, EventArgs e)
{
this.Opacity = 1;
}
/// <summary>
/// 关闭命令
/// </summary>
public void CloseOrder()
public void closeOrder()
{
if (this.InvokeRequired)
{
@ -37,7 +31,8 @@ namespace Mesnac.Action.ChemicalWeighing
{
;
}
if (this.IsDisposed)
return;
if (!this.IsDisposed)
{
this.Dispose();
@ -57,7 +52,7 @@ namespace Mesnac.Action.ChemicalWeighing
}
}
private void loading_FormClosing(object sender, FormClosingEventArgs e)
private void LoaderForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (!this.IsDisposed)
{
@ -66,9 +61,10 @@ namespace Mesnac.Action.ChemicalWeighing
}
}
class CONSTANTDEFINE
{
public delegate void SetUISomeInfo();
}
}

@ -11,12 +11,15 @@ namespace Mesnac.Action.ChemicalWeighing
/// 定义委托进行窗口关闭
/// </summary>
private delegate void CloseDelegate();
private static Loading loadingForm;
private static Loading loading;
private static readonly Object syncLock = new Object(); //加锁使用
#endregion
//private LoadingHelper()
//{
//}
/// <summary>
/// 显示loading框
@ -24,7 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing
public static void ShowLoadingScreen()
{
// Make sure it is only launched once.
if (loadingForm != null)
if (loading != null)
return;
Thread thread = new Thread(new ThreadStart(LoadingHelper.ShowForm));
thread.IsBackground = true;
@ -32,48 +35,53 @@ namespace Mesnac.Action.ChemicalWeighing
thread.Start();
}
/// <summary>
/// 显示窗口
/// </summary>
private static void ShowForm()
{
if (loadingForm != null)
if (loading != null)
{
loadingForm.CloseOrder();
loadingForm = null;
loading.closeOrder();
loading = null;
}
loadingForm = new Loading();
loadingForm.TopMost = true;
loadingForm.ShowDialog();
loading = new Loading();
loading.TopMost = true;
loading.ShowDialog();
}
/// <summary>
/// 关闭窗口
/// </summary>
public static void CloseForm()
{
Thread.Sleep(50); //可能到这里线程还未起来,所以进行延时,可以确保线程起来,彻底关闭窗口
if (loadingForm != null)
if (loading != null)
{
lock (syncLock)
{
Thread.Sleep(50);
if (loadingForm != null)
if (loading != null)
{
Thread.Sleep(50); //通过三次延时,确保可以彻底关闭窗口
loadingForm.Invoke(new CloseDelegate(LoadingHelper.CloseFormInternal));
loading.Invoke(new CloseDelegate(LoadingHelper.CloseFormInternal));
}
}
}
}
/// <summary>
/// 关闭窗口,委托中使用
/// </summary>
private static void CloseFormInternal()
{
loadingForm.CloseOrder();
loadingForm = null;
loading.closeOrder();
loading = null;
}
}

@ -446,7 +446,7 @@
<Compile Include="LjMixManager\RecipePlcView.cs" />
<Compile Include="LjMixManager\UpdateAction.cs" />
<Compile Include="LjPlanning\AddAction.cs" />
<Compile Include="LjPlanning\TestAction.cs" />
<Compile Include="LjPlanning\DownToDatabase.cs" />
<Compile Include="LjPlanning\SelectAction.cs" />
<Compile Include="LjPlanning\Db\LjFormulaDb.cs" />
<Compile Include="LjPlanning\DelAction.cs" />
@ -636,6 +636,11 @@
<Compile Include="ProjectDebug\SelectAction.cs" />
<Compile Include="ProjectDebug\ModifyAction.cs" />
<Compile Include="ProjectDebug\UpdateValueAction.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Report\DeviceDetail2Report\DeviceDetail2ReportAction.cs" />
<Compile Include="Report\DeviceDetail2Report\Entity\DeviceDetail2Entity.cs" />
<Compile Include="Report\DryMixer\ExportAction.cs" />
@ -911,6 +916,10 @@
<DependentUpon>FrmSpeedProjectDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="RoleManage\FrmRole.resx">
<DependentUpon>FrmRole.cs</DependentUpon>
</EmbeddedResource>
@ -937,6 +946,7 @@
<ItemGroup>
<Content Include="ChemicalWeighingPlc\0Readme.txt" />
<Content Include="LjRecipeData\NewFile1.txt" />
<None Include="Resources\loading.gif" />
<Content Include="Sys\0readme.txt" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mesnac.Action.ChemicalWeighing.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mesnac.Action.ChemicalWeighing.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;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap loading {
get {
object obj = ResourceManager.GetObject("loading", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

@ -0,0 +1,124 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@ -36,31 +36,6 @@
</Object>
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel1" children="Controls">
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel2" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton14" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAACAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIDAwNkNDMDlEMjM5N0ZENzk4RUYzQkYyQjZGQjU0OUI4BgYAAAAG5rWL6K+VBgcAAAAG5rWL6K+VCw==</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text"></Property>
<Property name="Location">693, 14</Property>
<Property name="Name">MCButton14</Property>
<Property name="Size">36, 22</Property>
<Property name="TabIndex">34</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCLabel, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCLabel3" children="Controls">
<Property name="Format" />
<Property name="TextName" />

Loading…
Cancel
Save