Commit 28a2ccc7 LN

增加播放窗口。aoi检测修正改为菜单。

1 个父辈 e104a243
......@@ -192,5 +192,11 @@ namespace TSA_V.Common
public static string DisContinueWorking = "DisContinueWorking";
public static string DisShowScreenAlarm = "DisShowScreenAlarm";
/// <summary>
/// 实时播放视频所在屏幕索引号
/// </summary>
public static string VideoFrom_Index = "VideoFrom_Index";
public static string VideoForm_Show = "VideoForm_Show";
}
}
......@@ -61,10 +61,10 @@ namespace TSA_V.Common
public static int GetIntValue(string keyStr, string storeStr)
public static int GetIntValue(string keyStr, string storeStr,int defValue=0)
{
string key = keyStr + storeStr;
int a = 0;
int a = defValue;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
......@@ -128,9 +128,9 @@ namespace TSA_V.Common
}
public static int GetIntValue(string key)
public static int GetIntValue(string key,int defValue = 0)
{
int a = 0;
int a = defValue;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
......
......@@ -310,9 +310,9 @@ namespace TSA_V
}
}
Screen screen = sc[index];
int x = (screen.Bounds.Width - this.Width) / 2;
int y = (screen.Bounds.Height - this.Height) / 2;
this.Location = new Point(x, y);
int x =screen.Bounds.Left+ (screen.Bounds.Width - this.Width) / 2;
int y = screen.Bounds.Top+(screen.Bounds.Height - this.Height) / 2;
this.Location = new Point( x, y);
this.StartPosition = FormStartPosition.CenterParent;
//this.SetScreen(index);
//this.CenterToScreen();
......
......@@ -16,6 +16,7 @@ using System.IO;
using AccAOI;
using System.Speech.Synthesis;
using Asa;
using System.Threading;
namespace TSA_V
{
......@@ -377,12 +378,31 @@ namespace TSA_V
FrmProjectorScreen.instance = new FrmProjectorScreen();
LogUtil.info("检测到只有一个显示器,关闭投影界面");
}
//ShowCameraPlay();
}
catch (Exception ex)
{
LogUtil.error("投影界面检测处理出错:" + ex.ToString());
}
}
private void ShowCameraPlay()
{
if (WorkModeUtil.SelectOk())
{
if (!FrmCameraPlay.instance.ISShow)
{
Thread t2 = new Thread(x =>
{
FrmCameraPlay.instance.ISShow = true;
FrmCameraPlay.instance.ShowForm();
});
t2.SetApartmentState(ApartmentState.STA);
t2.Start();
}
}
}
private void openForms()
{
......
......@@ -4,9 +4,12 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
namespace TSA_V
......@@ -174,7 +177,28 @@ namespace TSA_V
return h_hovercImg;
}
[HandleProcessCorruptedStateExceptions]
public static T DeepClone<T>(T _object)
{
try
{
T dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, _object);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (T)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
catch (Exception e)
{
LogUtil.info("GetStringCenterA" + e.ToString());
return default;
}
}
}
}
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
......@@ -46,7 +47,7 @@ namespace TSA_V
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
[MTAThread]
static void Main()
{
//DatumPoint datumPoint = new DatumPoint("YR1", "1", 2, 61.309f, 133.04f, "CRD", 6.06f, -4.31f);
......@@ -113,7 +114,29 @@ namespace TSA_V
FrmLogin frm = new FrmLogin();
DialogResult dr = frm.ShowDialog();
if (dr == DialogResult.OK)
Application.Run(new FrmMenu());
{
Thread t2 = new Thread(x =>
{
FrmCameraPlay.instance.ISShow = true;
FrmCameraPlay.instance.ShowForm();
});
t2.SetApartmentState(ApartmentState.STA);
t2.Start();
//Application.Run(new FrmMenu());
Thread t1 = new Thread(x =>
{
Application.Run(new FrmMenu());
//FrmMenu frmMenu= new FrmMenu();
//frmMenu.ShowDialog();
});
t1.SetApartmentState(ApartmentState.STA);
t1.Start();
t1.Join();
}
DeviceLibrary.DB.db.Close();
//System.Threading.Thread.CurrentThread.Abort();
Process.GetCurrentProcess().Kill();
......@@ -125,8 +148,9 @@ namespace TSA_V
{
LogUtil.error(ex.ToString());
}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUnhandledException("CurrentDomain_UnhandledException", e.ToString() + "" + e.ExceptionObject.ToString() + " ");
......
......@@ -2587,4 +2587,9 @@
<data name="iscontinue" xml:space="preserve">
<value>There is an open program '{0}', whether to continue or not?</value>
</data>
<data name = "不使用AOI" xml:space = "preserve"> <value> Without AOI </value> </data>
<data name = "FrmWork_lblGuoBan_Text" xml:space = "preserve"> <value> over-boarding mode </value> </data>
<data name = "FrmAOICheck_btnUpdateImg_Text" xml:space = "preserve"> <value> amendment </value> </data>
<data name = "SureUpdateMethod" xml:space = "preserve"> <value> Sure about the amendment?{0}? </value> </data>
<data name = "FrmLanguage_rbtnRussian_Text" xml:space = "preserve"> <value> Russian </value> </data>
</root>
\ No newline at end of file
......@@ -2583,4 +2583,9 @@
<data name="iscontinue" xml:space="preserve">
<value>有未结束的程序'{0}',是否继续?</value>
</data>
<data name = "不使用AOI" xml:space = "preserve"> <value> 不使用AOI </value> </data>
<data name = "FrmWork_lblGuoBan_Text" xml:space = "preserve"> <value> 过板模式 </value> </data>
<data name = "FrmAOICheck_btnUpdateImg_Text" xml:space = "preserve"> <value> 修正 </value> </data>
<data name = "SureUpdateMethod" xml:space = "preserve"> <value> 确定修正{0}? </value> </data>
<data name = "FrmLanguage_rbtnRussian_Text" xml:space = "preserve"> <value> 俄文 </value> </data>
</root>
\ No newline at end of file
......@@ -2583,4 +2583,9 @@
<data name="iscontinue" xml:space="preserve">
<value>有未结束的程序'{0}',是否继续?</value>
</data>
<data name = "不使用AOI" xml:space = "preserve"> <value> 不使用AOI </value> </data>
<data name = "FrmWork_lblGuoBan_Text" xml:space = "preserve"> <value> 过板模式 </value> </data>
<data name = "FrmAOICheck_btnUpdateImg_Text" xml:space = "preserve"> <value> 修正 </value> </data>
<data name = "SureUpdateMethod" xml:space = "preserve"> <value> 确定修正{0}? </value> </data>
<data name = "FrmLanguage_rbtnRussian_Text" xml:space = "preserve"> <value> 俄文 </value> </data>
</root>
\ No newline at end of file
......@@ -116,6 +116,10 @@ namespace TSA_V
}
public static void LogDefaultMap()
{
if (defaultMap == null || defaultMap.Count <= 0)
{
return;
}
//LogUtil.info("开始打印缺少的文字配置" + defaultMap.Count);
StringBuilder builder = new StringBuilder();
builder.Append("开始打印缺少的文字配置" + defaultMap.Count+"\r\n");
......
......@@ -115,6 +115,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AOIManager.cs" />
<Compile Include="cameraPlay\FrmCameraPlay.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="cameraPlay\FrmCameraPlay.Designer.cs">
<DependentUpon>FrmCameraPlay.cs</DependentUpon>
</Compile>
<Compile Include="DataCalculate.cs">
<SubType>Form</SubType>
</Compile>
......@@ -210,6 +216,12 @@
<Compile Include="workForm\FrmAOICheck.Designer.cs">
<DependentUpon>FrmAOICheck.cs</DependentUpon>
</Compile>
<Compile Include="cameraPlay\CameraPlay.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="cameraPlay\CameraPlay.Designer.cs">
<DependentUpon>CameraPlay.cs</DependentUpon>
</Compile>
<Compile Include="workForm\FrmCodeInPut.cs">
<SubType>Form</SubType>
</Compile>
......@@ -311,6 +323,9 @@
<Compile Include="FrmDeviceConfig.Designer.cs">
<DependentUpon>FrmDeviceConfig.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="cameraPlay\FrmCameraPlay.resx">
<DependentUpon>FrmCameraPlay.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="deviceDebug\FrmUpdatePwd.resx">
<DependentUpon>FrmUpdatePwd.cs</DependentUpon>
</EmbeddedResource>
......@@ -363,6 +378,9 @@
<EmbeddedResource Include="workForm\FrmAOICheck.resx">
<DependentUpon>FrmAOICheck.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="cameraPlay\CameraPlay.resx">
<DependentUpon>CameraPlay.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="workForm\FrmCodeInPut.resx">
<DependentUpon>FrmCodeInPut.cs</DependentUpon>
</EmbeddedResource>
......
namespace TSA_V
{
partial class CameraPlay
{
/// <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.components = new System.ComponentModel.Container();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(430, 393);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmCameraPlay
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(430, 393);
this.Controls.Add(this.pictureBox1);
this.Name = "FrmCameraPlay";
this.Text = "FrmCameraPlay";
this.Load += new System.EventHandler(this.FrmCameraPlay_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
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;
namespace TSA_V
{
public partial class CameraPlay : UserControl
{
public CameraPlay()
{
InitializeComponent();
}
private void FrmCameraPlay_Load(object sender, EventArgs e)
{
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (blnDraw)
{
this.Invoke(new Action(() =>
{
currPoint = Cursor.Position;
currPoint.X = currPoint.X - (this.Size.Width / 2);
currPoint.Y = currPoint.Y - (this.Size.Height / 2);
this.Location = currPoint;
}));
}
}
Point currPoint;
Point start;
Point end;
bool blnDraw;
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
start = e.Location;
blnDraw = true;
}
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
//if (blnDraw)
//{
// if (e.Button != MouseButtons.Left)
// {
// return;
// }
// end = e.Location;
// pictureBox1.Invalidate();
//}
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
if(e.Button==MouseButtons.Left)
{
blnDraw = false;
}
}
}
}
<?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>
\ No newline at end of file
namespace TSA_V
{
partial class FrmCameraPlay
{
/// <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.components = new System.ComponentModel.Container();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(384, 261);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// timer1
//
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmCameraPlay
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(384, 261);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "FrmCameraPlay";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Live video";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmCameraPlay_FormClosing);
this.Load += new System.EventHandler(this.FrmCameraPlay_Load);
this.Shown += new System.EventHandler(this.FrmCameraPlay_Shown);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
using AccAOI.camera;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
namespace TSA_V
{
public partial class FrmCameraPlay : Form
{
public bool ISShow = false ;
public int ScreenIndex = ConfigAppSettings.GetIntValue(Setting_Init.VideoFrom_Index,2);
public bool NeedShow = ConfigAppSettings.GetBoolValue(Setting_Init.VideoForm_Show );
public static FrmCameraPlay instance = new FrmCameraPlay();
public FrmCameraPlay()
{
NeedShow = false ;
InitializeComponent();
}
private void FrmCameraPlay_Load(object sender, EventArgs e)
{
}
public bool ShowForm()
{
ISShow = true;
if (!NeedShow)
{
return false;
}
Screen[] sc = Screen.AllScreens;
Screen screen = null;
if (sc.Count() > ScreenIndex)
{
screen = sc[ScreenIndex];
int ScreenWidth = screen.Bounds.Width;
int ScreenHeight = screen.Bounds.Height;
this.Width = ScreenWidth;
this.Height = ScreenWidth;
this.StartPosition = FormStartPosition.Manual;
this.WindowState = FormWindowState.Maximized;
this.Location = new Point(0, 0);
this.ShowDialog();
LogUtil.info("实时视频界面显示:屏幕索引=" + ScreenIndex + " !");
return true;
}
else if (sc.Count() > 0)
{
screen = sc[0];
this.StartPosition = FormStartPosition.Manual;
this.Size = new Size(400, 300);
this.Location = new Point(screen.Bounds.Left+ screen.Bounds.Width - this.Width, screen.Bounds.Top+ 5);
this.ShowDialog();
LogUtil.info("实时视频界面显示:屏幕索引=" + ScreenIndex + " !");
return true;
}
else
{
LogUtil.info("实时视频界面显示:屏幕索引=" + ScreenIndex + " 未找到");
return false;
}
}
private void FrmCameraPlay_Shown(object sender, EventArgs e)
{
timer1.Start();
this.TopMost = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if(this.Visible )
{
try
{
string camera = ConfigAppSettings.GetValue(Setting_Init.CameraName);
if (camera == "")
{
camera = AccAOI.camera.CameraManager.hikNameList.ToArray().FirstOrDefault();
}
Image currImage = CameraManager.GetCamerImage(camera);
if (currImage == null)
{
string file = @"G:\test.bmp";
if (File.Exists(file))
{
//从本地加载图片
Bitmap aa = new Bitmap(file);
currImage = ImageManager.DeepClone(aa);
}
}
if (currImage != null)
{
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
}
pictureBox1.Image = currImage;
}
}
catch (Exception ex)
{
LogUtil.error("实时视频播放出错:" + ex.ToString());
}
}
}
private void FrmCameraPlay_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
public const int HWND_TOP = 0;
public const int HWND_BOTTOM = 1;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
[DllImport("user32.dll")]
public static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint wFlags);
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, out WindowRect lpRect);
}
public struct WindowRect
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
}
<?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>
\ No newline at end of file
......@@ -44,13 +44,15 @@ namespace TSA_V
this.panelImg = new System.Windows.Forms.Panel();
this.picResult = new Acc.ImageBox.AccImageBox();
this.panel3 = new System.Windows.Forms.Panel();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.listErrorView = new System.Windows.Forms.ListView();
this.chbAllShow = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.picCurr = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.picStand = new System.Windows.Forms.PictureBox();
this.btnUpdateImg = new System.Windows.Forms.Button();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.修正ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
......@@ -58,6 +60,7 @@ namespace TSA_V
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// timer1
......@@ -184,8 +187,10 @@ namespace TSA_V
//
// picResult
//
this.picResult.BackColor = System.Drawing.Color.Black;
this.picResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.picResult.DragHandleSize = 9;
this.picResult.ImageBorderColor = System.Drawing.SystemColors.ActiveCaptionText;
this.picResult.Location = new System.Drawing.Point(0, 0);
this.picResult.Name = "picResult";
this.picResult.Size = new System.Drawing.Size(720, 852);
......@@ -207,11 +212,26 @@ namespace TSA_V
this.panel3.Size = new System.Drawing.Size(336, 852);
this.panel3.TabIndex = 298;
//
// btnUpdateImg
//
this.btnUpdateImg.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(198, 3);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(130, 40);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
//
// listErrorView
//
this.listErrorView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listErrorView.ContextMenuStrip = this.contextMenuStrip1;
this.listErrorView.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listErrorView.HideSelection = false;
this.listErrorView.Location = new System.Drawing.Point(3, 45);
......@@ -277,19 +297,19 @@ namespace TSA_V
this.picStand.TabIndex = 297;
this.picStand.TabStop = false;
//
// btnUpdateImg
// contextMenuStrip1
//
this.btnUpdateImg.BackColor = System.Drawing.SystemColors.Control;
this.btnUpdateImg.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnUpdateImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpdateImg.Location = new System.Drawing.Point(198, 3);
this.btnUpdateImg.Name = "btnUpdateImg";
this.btnUpdateImg.Size = new System.Drawing.Size(130, 40);
this.btnUpdateImg.TabIndex = 303;
this.btnUpdateImg.Text = "修正";
this.btnUpdateImg.UseVisualStyleBackColor = false;
this.btnUpdateImg.Visible = false;
this.btnUpdateImg.Click += new System.EventHandler(this.btnUpdateImg_Click);
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.修正ToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(101, 26);
//
// 修正ToolStripMenuItem
//
this.修正ToolStripMenuItem.Name = "修正ToolStripMenuItem";
this.修正ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.修正ToolStripMenuItem.Text = "修正";
this.修正ToolStripMenuItem.Click += new System.EventHandler(this.修正ToolStripMenuItem_Click);
//
// FrmAOICheck
//
......@@ -311,6 +331,7 @@ namespace TSA_V
this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picCurr)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picStand)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -336,5 +357,7 @@ namespace TSA_V
private System.Windows.Forms.CheckBox chbAllShow;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Button btnUpdateImg;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem 修正ToolStripMenuItem;
}
}
\ No newline at end of file
......@@ -52,6 +52,7 @@ namespace TSA_V
return;
}
lblCurrWorkTime.Text = ResourceCulture.GetString("{0}秒后自动检测", "{0}秒后自动检测", waitSeconds.ToString());
修正ToolStripMenuItem.Text = ResourceCulture.GetString("FrmAOICheck_btnUpdateImg_Text", "修正");
// this.picResult.Image = CurrProject.standardImage;
}
......@@ -174,7 +175,7 @@ namespace TSA_V
{
//从本地加载图片
Bitmap aa = new Bitmap(file);
currImage = DeepClone(aa);
currImage = ImageManager.DeepClone(aa);
}
}
......@@ -304,17 +305,20 @@ namespace TSA_V
{
ResultBean bean = beans[0];
picStand.Image = bean.standardRoiImage;
picCurr.Image =DeepClone( bean.currentRoiImage);
picCurr.Image = ImageManager.DeepClone( bean.currentRoiImage);
picResult.SelectionRegion = bean.roiPath;
//如果结果NG,可以修正
if(!bean.result && (!updateMName.Contains(bean.MethodName)))
{
selectResultBean = bean;
btnUpdateImg.Visible = true;
//btnUpdateImg.Visible = true;
listErrorView.ContextMenuStrip = this.contextMenuStrip1;
}
else
{
listErrorView.ContextMenuStrip = null;
btnUpdateImg.Visible = false;
}
//Graphics g = picResult.CreateGraphics();
......@@ -383,7 +387,7 @@ namespace TSA_V
{
return;
}
using (Image image = DeepClone(selectResultBean.currentRoiImage))
using (Image image = ImageManager.DeepClone(selectResultBean.currentRoiImage))
{
string savePath = getSaveImagePath(BoardManager.CurrBoard.GetAoiFileName(), selectResultBean);
......@@ -398,6 +402,7 @@ namespace TSA_V
IsUpdate = true;
btnRun.Visible = true;
btnUpdateImg.Visible = false;
listErrorView.ContextMenuStrip=null;
updateMName.Add(selectResultBean.MethodName);
LogUtil.info($" {BoardManager.CurrBoard} 修正 {selectResultBean.MethodName} 成功,图片保存到:" + savePath + imageName);
}
......@@ -408,27 +413,9 @@ namespace TSA_V
}
}
[HandleProcessCorruptedStateExceptions]
public static T DeepClone<T>(T _object)
private void 修正ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
T dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, _object);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (T)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
catch (Exception e)
{
LogUtil.info("GetStringCenterA" + e.ToString());
return default;
}
btnUpdateImg_Click(null,null);
}
}
}
......@@ -120,6 +120,9 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>109, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>103</value>
</metadata>
......
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!