Commit cd1a4c9a by Pascal Bigot

--no commit message

parent f1d8019d
......@@ -21,6 +21,7 @@ namespace CommonLib
public delegate void DocumentModifiedEvent();
public delegate void DocComStateChange(BTDoc doc);
public delegate void MessageTreat(BTDoc sender, MESSAGE Mess, object Param, TYPE_APP TypeApp);
public delegate void VirtualDataFormOpenClose(BTDoc sender, VirtualDataForm form, bool bOpen);
/// <summary>
///
/// </summary>
......@@ -70,6 +71,7 @@ namespace CommonLib
public event DocComStateChange OnCommStateChange;
public event MessageTreat BeforeMessageTreat;
public event MessageTreat EndMessageTreat;
public event VirtualDataFormOpenClose VirtualDataFormStateChanged;
#endregion
#region donnée spécifiques aux fonctionement en mode Command
......@@ -781,15 +783,23 @@ namespace CommonLib
{
m_virtualDataForm = new VirtualDataForm(this);
m_virtualDataForm.Text += " - " + Path.GetFileNameWithoutExtension(this.FileName);
m_virtualDataForm.Show();
m_virtualDataForm.BringToFront();
if (VirtualDataFormStateChanged != null)
{
VirtualDataFormStateChanged(this, m_virtualDataForm, true);
//m_virtualDataForm.Show();
//m_virtualDataForm.BringToFront();
}
}
else
{
if (m_virtualDataForm != null)
{
m_virtualDataForm.Close();
m_virtualDataForm = null;
if (VirtualDataFormStateChanged != null)
{
VirtualDataFormStateChanged(this, m_virtualDataForm, false);
//m_virtualDataForm.Close();
//m_virtualDataForm = null;
}
}
}
if (!m_Comm.IsOpen && this.IsRunning)
......
......@@ -146,14 +146,13 @@ namespace CommonLib
/// <returns></returns>
public int PreParseScript(string[] script)
{
int Id = 0;
int Id = -1;
List<PreParsedLine> preParsedScript = m_PreParser.PreParseScript(script);
if (preParsedScript != null)
{
Id = ++m_iQuickIdCounter;
m_DictioQuickScripts.Add(Id, preParsedScript);
}
System.Diagnostics.Debug.Assert(Id != -1);
return Id;
}
......@@ -186,21 +185,32 @@ namespace CommonLib
while (m_PileScriptsToExecute.Count != 0 && !m_bStopRequested)
{
// on prend le script sans l'enlever afin de savoir qu'il n'est pas encore executé
Object thisLock = new Object();
int QuickId = 0;
lock (thisLock)
try
{
QuickId = m_PileScriptsToExecute.Peek();
lock (this)
{
QuickId = m_PileScriptsToExecute.Peek();
if (QuickId != 0)
{
InternalExecuteScript(QuickId);
// il est éxécuté, on l'enlève de la liste.
m_PileScriptsToExecute.Dequeue();
if (EventScriptExecuted != null)
EventScriptExecuted(QuickId);
}
else
{
Traces.LogAddCritical(TraceCat.Executer, string.Format("un quickId 0 est sortie de la FIFO"));
}
}
}
catch (Exception ex)
{
LogEvent evt = new LogEvent(LOG_EVENT_TYPE.ERROR, string.Format(Lang.LangSys.C("Error in execution motor {0}", ex.Message)));
AddLogEvent(evt);
}
//if (m_bIsWaiting)
// System.Diagnostics.Debug.Assert(false, "appel en trop");
InternalExecuteScript(QuickId);
// il est éxécuté, on l'enlève de la liste.
m_PileScriptsToExecute.Dequeue();
if (EventScriptExecuted != null)
EventScriptExecuted(QuickId);
Thread.Sleep(20);
}
......@@ -216,17 +226,13 @@ namespace CommonLib
/// <param name="QuickID"></param>
public void ExecuteScript(int QuickID)
{
//System.Diagnostics.Debug.Assert(QuickID != 0);
if (m_DictioQuickScripts.ContainsKey(QuickID))
{
Object thisLock = new Object();
lock (thisLock)
lock (this)
{
// Critical code section
m_PileScriptsToExecute.Enqueue(QuickID);
}
//m_QueueMutex.ReleaseMutex();
//if (EvScriptToExecute != null)
//EvScriptToExecute();
}
#if DEBUG
else
......@@ -247,6 +253,12 @@ namespace CommonLib
/// <param name="QuickID"></param>
internal void InternalExecuteScript(int QuickID)
{
if (!m_DictioQuickScripts.ContainsKey(QuickID))
{
LogEvent log = new LogEvent(LOG_EVENT_TYPE.WARNING, string.Format(Lang.LangSys.C("Unknown script id {0}"), QuickID));
AddLogEvent(log);
return;
}
List<PreParsedLine> QuickScript = m_DictioQuickScripts[QuickID];
for (int i = 0; i < QuickScript.Count; i++)
{
......
......@@ -57,7 +57,8 @@
<IntermediatePath>..\obj\Release\</IntermediatePath>
<IntermediateOuputPath>..\obj\Release\</IntermediateOuputPath>
<BaseIntermediateOutputPath>..\obj\Release\</BaseIntermediateOutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
......@@ -162,6 +163,12 @@
<Compile Include="SmartCommand\Ihm\VariableForm.Designer.cs">
<DependentUpon>VariableForm.cs</DependentUpon>
</Compile>
<Compile Include="SmartCommand\Ihm\VirtualCnxContainer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SmartCommand\Ihm\VirtualCnxContainer.Designer.cs">
<DependentUpon>VirtualCnxContainer.cs</DependentUpon>
</Compile>
<Compile Include="SmartConfig\Ihm\ConfigurationForm\DesignerForm.cs">
<SubType>Form</SubType>
</Compile>
......@@ -241,6 +248,9 @@
<SubType>Designer</SubType>
<DependentUpon>VariableForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SmartCommand\Ihm\VirtualCnxContainer.resx">
<DependentUpon>VirtualCnxContainer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SmartConfig\Ihm\ConfigurationForm\DesignerForm.resx">
<SubType>Designer</SubType>
<DependentUpon>DesignerForm.cs</DependentUpon>
......
......@@ -30,6 +30,7 @@ namespace SmartApp
protected MruStripMenuInline m_mruStripMenu;
//
SolutionGest m_GestSolution;
VirtualCnxContainer m_VirtualDataFormContainter;
protected bool m_bAutoStartProjOnOpen = false;
protected bool m_bHideMonAfterPrjStart = false;
......@@ -427,6 +428,7 @@ namespace SmartApp
doc.OnCommStateChange += new DocComStateChange(OnDocument_CommStateChange);
doc.OnRunStateChange += new RunStateChangeEvent(OnDocument_RunStateChange);
doc.EventAddLogEvent += new AddLogEventDelegate(AddLogEvent);
doc.VirtualDataFormStateChanged += new VirtualDataFormOpenClose(doc_VirtualDataFormStateChanged);
AddDocToMonitorList(doc);
}
else
......@@ -462,6 +464,36 @@ namespace SmartApp
}
}
void doc_VirtualDataFormStateChanged(BTDoc sender, VirtualDataForm form, bool bOpen)
{
if (m_VirtualDataFormContainter == null)
{
m_VirtualDataFormContainter = new VirtualCnxContainer();
}
if (form != null)
{
if (bOpen)
{
form.MdiParent = m_VirtualDataFormContainter;
form.Show();
}
else
{
form.MdiParent = null;
form.Close();
}
}
if (m_VirtualDataFormContainter.MdiChildren.Length == 0)
{
m_VirtualDataFormContainter.Close();
m_VirtualDataFormContainter = null;
}
else
{
m_VirtualDataFormContainter.Show();
}
}
/// <summary>
///
/// </summary>
......
namespace SmartApp
{
partial class VirtualCnxContainer
{
/// <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.m_menuStrip = new System.Windows.Forms.MenuStrip();
this.menuWindows = new System.Windows.Forms.ToolStripMenuItem();
this.menuItemCascade = new System.Windows.Forms.ToolStripMenuItem();
this.menuItemTileVertical = new System.Windows.Forms.ToolStripMenuItem();
this.menuItemTileHorizontal = new System.Windows.Forms.ToolStripMenuItem();
this.menuItemArrangeIcons = new System.Windows.Forms.ToolStripMenuItem();
this.m_menuStrip.SuspendLayout();
this.SuspendLayout();
//
// m_menuStrip
//
this.m_menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuWindows});
this.m_menuStrip.Location = new System.Drawing.Point(0, 0);
this.m_menuStrip.MdiWindowListItem = this.menuWindows;
this.m_menuStrip.Name = "m_menuStrip";
this.m_menuStrip.Size = new System.Drawing.Size(561, 24);
this.m_menuStrip.TabIndex = 1;
this.m_menuStrip.Text = "MenuStrip";
//
// menuWindows
//
this.menuWindows.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItemCascade,
this.menuItemTileVertical,
this.menuItemTileHorizontal,
this.menuItemArrangeIcons});
this.menuWindows.Name = "menuWindows";
this.menuWindows.Size = new System.Drawing.Size(62, 20);
this.menuWindows.Text = "&Windows";
//
// menuItemCascade
//
this.menuItemCascade.Name = "menuItemCascade";
this.menuItemCascade.Size = new System.Drawing.Size(153, 22);
this.menuItemCascade.Text = "&Cascade";
this.menuItemCascade.Click += new System.EventHandler(this.menuItemCascade_Click);
//
// menuItemTileVertical
//
this.menuItemTileVertical.Name = "menuItemTileVertical";
this.menuItemTileVertical.Size = new System.Drawing.Size(153, 22);
this.menuItemTileVertical.Text = "Tile &Vertical";
this.menuItemTileVertical.Click += new System.EventHandler(this.menuItemTileVertical_Click);
//
// menuItemTileHorizontal
//
this.menuItemTileHorizontal.Name = "menuItemTileHorizontal";
this.menuItemTileHorizontal.Size = new System.Drawing.Size(153, 22);
this.menuItemTileHorizontal.Text = "Tile &Horizontal";
this.menuItemTileHorizontal.Click += new System.EventHandler(this.menuItemTileHorizontal_Click);
//
// menuItemArrangeIcons
//
this.menuItemArrangeIcons.Name = "menuItemArrangeIcons";
this.menuItemArrangeIcons.Size = new System.Drawing.Size(153, 22);
this.menuItemArrangeIcons.Text = "&Arrange Icons";
this.menuItemArrangeIcons.Click += new System.EventHandler(this.menuItemArrangeIcons_Click);
//
// VirtualCnxContainer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(561, 412);
this.Controls.Add(this.m_menuStrip);
this.IsMdiContainer = true;
this.Name = "VirtualCnxContainer";
this.Text = "Virtual connexions container";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VirtualCnxContainer_FormClosing);
this.m_menuStrip.ResumeLayout(false);
this.m_menuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip m_menuStrip;
private System.Windows.Forms.ToolStripMenuItem menuWindows;
private System.Windows.Forms.ToolStripMenuItem menuItemCascade;
private System.Windows.Forms.ToolStripMenuItem menuItemTileVertical;
private System.Windows.Forms.ToolStripMenuItem menuItemTileHorizontal;
private System.Windows.Forms.ToolStripMenuItem menuItemArrangeIcons;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SmartApp
{
public partial class VirtualCnxContainer : Form
{
public VirtualCnxContainer()
{
InitializeComponent();
}
private void menuItemCascade_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.Cascade);
}
private void menuItemTileVertical_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);
}
private void menuItemTileHorizontal_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileHorizontal);
}
private void menuItemArrangeIcons_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.ArrangeIcons);
}
private void VirtualCnxContainer_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
}
}
}
}
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="m_menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
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