You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs

179 lines
5.7 KiB
C#

using System;
using System.Collections.Generic;
1 year ago
using System.Data;
using System.Diagnostics;
1 year ago
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using DataBlockHelper.DBHelpers;
using DevExpress.XtraEditors.Filtering.Templates;
using ICSharpCode.Core;
using log4net;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking;
using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor;
using Mesnac.Action.ChemicalWeighing.MinAn;
using Mesnac.Action.ChemicalWeighing.Report;
using Mesnac.Action.ChemicalWeighing.RgvPlc;
using Mesnac.Basic;
1 year ago
using Mesnac.Codd.Session;
using Mesnac.Controls.Base;
using Mesnac.Controls.ChemicalWeighing;
using Mesnac.Controls.ChemicalWeighing.HslCurve;
using Mesnac.Controls.Default;
1 year ago
namespace Mesnac.Action.ChemicalWeighing.Test
{
public class TestAction : DatabaseAction, IAction
{
MCButton mCButton;
1 year ago
// LoggingService<TestAction> _log;
HslMoveText hslMove;
MultiCurve MultiCurve1;
HslCurve PressureCurve;
double a = 0;
int count = 0;
public void theout(object source, EventArgs e)
1 year ago
{
//LoggingService<TestAction>.InfoFormatted("定时器开始运行");
//ReportReadDb.ReadReport();
//MultiCurve1.PointValue1 =
//MultiCurve1.PointValue2 =
a += 0.01;
var random = new Random();
this.count++;
float num = (float)(Math.Sqrt(Math.Abs(Math.Sin(a))) + Math.Sqrt(Math.Abs(Math.Cos(a))));
float num2 = (float)(Math.Sqrt(Math.Abs(Math.Sin(a))) - Math.Sqrt(Math.Abs(Math.Cos(a))));
float num3 = (float)(Math.Cos(6.283185307179586 * (double)this.count / 80.0) * 0.5 + 0.5);
this.PressureCurve.AddCurveData(new string[]
{
"A",
"B",
"C"
}, new float[]
{
num,
num2,
num2
});
1 year ago
}
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
var allDb = GetAllControls();
mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton;
hslMove = allDb.FirstOrDefault(x => x.Name == "HslMoveText1") as HslMoveText;
MultiCurve1 = allDb.FirstOrDefault(x => x.Name == "MultiCurve1") as MultiCurve;
PressureCurve = allDb.FirstOrDefault(x => x.Name == "PressureCurve") as HslCurve;
//MultiCurve1.AxesAuto = true;
this.PressureCurve.ColorDashLines = Color.LightGray;
this.PressureCurve.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
this.PressureCurve.FontCalibration = new Font("微软雅黑", 9f);
this.PressureCurve.IsRenderRightCoordinate = false;
//this.PressureCurve.ReferenceAxisLeft.Color = Color.FromArgb(255, 128, 0);
this.PressureCurve.ReferenceAxisLeft.Unit = "℃";
this.PressureCurve.ReferenceAxisLeft.Max = 2;
this.PressureCurve.ReferenceAxisLeft.Min = -2;
this.PressureCurve.TabIndex = 2;
this.PressureCurve.StrechDataCountMax = 200;
this.PressureCurve.SetLeftCurve("A", null, Color.DodgerBlue);
this.PressureCurve.SetLeftCurve("B", null, Color.DarkOrange);
this.PressureCurve.SetLeftCurve("C", null, Color.LimeGreen);
1 year ago
this.hslMove.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
this.hslMove.BackColor = Color.FromArgb(128, 128, 255);
this.hslMove.Font = new Font("楷体", 15f, FontStyle.Regular, GraphicsUnit.Point, 134);
this.hslMove.ForeColor = Color.Yellow;
1 year ago
this.hslMove.Margin = new Padding(5, 6, 5, 6);
this.hslMove.MoveSpeed = 2f;
1 year ago
this.hslMove.Size = new Size(726, 49);
this.hslMove.TabIndex = 8;
this.hslMove.Text = @"公告:这是一条测试的公告信息";
1 year ago
//mCButton.Click += MCButton_Click;
1 year ago
System.Timers.Timer t = new System.Timers.Timer(50);//实例化Timer类设置间隔时间为10000毫秒
t.Elapsed += new System.Timers.ElapsedEventHandler(theout);//到达时间的时候执行事件;
t.AutoReset = true;//设置是执行一次false还是一直执行(true)
t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件
1 year ago
}
1 year ago
private void MCButton_Click(object sender, EventArgs e)
{
12 months ago
var s= new DB120Helper().SiloO;
12 months ago
12 months ago
s = new DB120Helper().SiloJ;
12 months ago
12 months ago
DB120WriteHelp.AddABCDEF(new Uhd()
{
A = 60,
B = 60,
C = 60,
D = 60,
E = 60,
F = 60,
G = 60,
H = 60,
I = 60,
J = 60,
K = 60,
L = 60,
M = 60,
N = 60,
O = 60,
Delay1 = 3,
Delay2 = 2,
Delay3 = 1
});
DB120Helper help1 = new DB120Helper();
12 months ago
var user = help1.GetUhd;
DB92WriterHelp.Add(new Pipe()
{
MainPipieA = 0.4f,
AuxPipieA = 0.4f,
MainPipieB = 0.4f,
AuxPipieB = 0.4f,
MainPipieC = 0.4f,
AuxPipieC = 0.4f,
UpperPressure = 0.6f,
LowerPressure = 0.3f,
});
DB92Help help = new DB92Help();
var pipe= help.GetPipe;
1 year ago
}
}
}