Commit 23aaabda by Pascal Bigot

Merge branch 'origin/PBG-RefonteIHM' into 'master'

Origin/pbg refonte ihm

It' been a while... reintegrating V3 change into master

See merge request !1
parents 1851279e 7fe223d2

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartApp", "SmartApp\SmartApp.csproj", "{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonLib", "CommonLib\CommonLib.csproj", "{3EFBC5AC-5842-4DE5-85C2-507E24AEC46F}"
......
......@@ -41,6 +41,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CtrlSoundPlayer", "SoundPla
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CtrlCnxManager", "CtrlCnxManager\CtrlCnxManager.csproj", "{2631CD3D-3EB2-4ED2-9797-60D5909B01FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CtrlDataComp", "CtrlDataComp\CtrlDataComp.csproj", "{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SmartAppUpdater", "SmartAppUpdater\SmartAppUpdater.csproj", "{A3DF3670-EF60-48AD-A28D-3DABE0655844}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
BuildLang|Any CPU = BuildLang|Any CPU
......@@ -67,8 +71,8 @@ Global
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.BuildLang|Win32.ActiveCfg = BuildLang|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Any CPU.ActiveCfg = Debug Cmd|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Any CPU.Build.0 = Debug Cmd|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Mixed Platforms.ActiveCfg = Debug|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Mixed Platforms.Build.0 = Debug|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Mixed Platforms.ActiveCfg = Debug Cmd|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Mixed Platforms.Build.0 = Debug Cmd|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Cmd|Win32.ActiveCfg = Debug Cmd|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Test|Any CPU.ActiveCfg = Debug Test|Any CPU
{5A8BD31D-5E4E-4891-9351-DD3119CB6BC9}.Debug Test|Any CPU.Build.0 = Debug Test|Any CPU
......@@ -560,6 +564,56 @@ Global
{2631CD3D-3EB2-4ED2-9797-60D5909B01FB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2631CD3D-3EB2-4ED2-9797-60D5909B01FB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2631CD3D-3EB2-4ED2-9797-60D5909B01FB}.Release|Win32.ActiveCfg = Release|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.BuildLang|Any CPU.ActiveCfg = BuildLang|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.BuildLang|Any CPU.Build.0 = BuildLang|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.BuildLang|Mixed Platforms.ActiveCfg = BuildLang|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.BuildLang|Mixed Platforms.Build.0 = BuildLang|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.BuildLang|Win32.ActiveCfg = BuildLang|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Cmd|Any CPU.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Cmd|Any CPU.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Cmd|Mixed Platforms.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Cmd|Mixed Platforms.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Cmd|Win32.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Test|Any CPU.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Test|Any CPU.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Test|Mixed Platforms.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Test|Mixed Platforms.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug Test|Win32.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Debug|Win32.ActiveCfg = Debug|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Release|Any CPU.Build.0 = Release|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{355EAEA7-3E28-40C6-8086-817ACDE4F1FD}.Release|Win32.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.BuildLang|Any CPU.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.BuildLang|Any CPU.Build.0 = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.BuildLang|Mixed Platforms.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.BuildLang|Mixed Platforms.Build.0 = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.BuildLang|Win32.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Cmd|Any CPU.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Cmd|Any CPU.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Cmd|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Cmd|Mixed Platforms.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Cmd|Win32.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Test|Any CPU.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Test|Any CPU.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Test|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Test|Mixed Platforms.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug Test|Win32.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Debug|Win32.ActiveCfg = Debug|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Release|Any CPU.Build.0 = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A3DF3670-EF60-48AD-A28D-3DABE0655844}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -21,14 +21,6 @@ namespace CommonLib
// message notifiant le renomage (symbol) d'un objet
MESS_ITEM_RENAMED,
// message indiquant que des paramètres ont changés
// utilisé pr mettre ajour le modified flag
MESS_CHANGE,
// Message spécifique a SmartCommand
// demande la mise a jour des controls en fonction de la donnée associée
MESS_UPDATE_FROM_DATA,
// message run mode Commande
MESS_CMD_RUN,
......@@ -123,29 +115,12 @@ namespace CommonLib
//*****************************************************************************************************
public class MessNeedUpdate : BaseMessage
{
public bool bUpdateDataForm;
public bool bUpdateFrameForm;
public bool bUpdateScreenForm;
public bool bUpdateProgramForm;
public MessNeedUpdate(BaseMessage mess)
{
if (mess.TypeOfItem == typeof(CommonLib.Data))
{
bUpdateFrameForm = true;
bUpdateScreenForm = true;
bUpdateProgramForm = true;
}
if (mess.TypeOfItem == typeof(CommonLib.Trame))
{
bUpdateScreenForm = true;
bUpdateProgramForm = true;
}
if (mess.TypeOfItem == typeof(CommonLib.Logger)
|| mess.TypeOfItem == typeof(CommonLib.Function)
|| mess.TypeOfItem == typeof(CommonLib.BTTimer)
)
{
bUpdateScreenForm = true;
}
}
......
using System;
using System.Collections.Generic;
using System.Text;
namespace CommonLib
{
public delegate void RunStateChangeEvent(BaseDoc doc);
public class BaseDoc
{
protected string m_strfileFullName;
protected bool m_bModified = false;
protected bool m_bModeRun = false;
protected TYPE_APP m_TypeApp = TYPE_APP.NONE;
public event AddLogEventDelegate EventAddLogEvent;
public event DocumentModifiedEvent OnDocumentModified;
public event RunStateChangeEvent OnRunStateChange;
public BaseDoc(TYPE_APP typeApp)
{
m_TypeApp = typeApp;
}
/// <summary>
/// accesseur du nom de fichier
/// </summary>
public string FileName
{
get
{
return m_strfileFullName;
}
}
public bool IsRunning
{
get { return m_bModeRun; }
protected set
{
if (m_bModeRun != value)
{
m_bModeRun = value;
NotifyRunStateChange();
}
}
}
protected void NotifyRunStateChange()
{
if (OnRunStateChange != null)
OnRunStateChange(this);
}
/// <summary>
/// ajout un message à la fenêtre de log de l'application
/// </summary>
/// <param name="Event">Event à afficher</param>
protected void AddLogEvent(LogEvent Event)
{
if (EventAddLogEvent != null)
{
EventAddLogEvent(Event);
}
}
/// <summary>
/// indique si le document à été modifé depuis sa dernière sauvegarde
/// et le notifie si son état est changé
/// </summary>
public bool Modified
{
get
{
return m_bModified;
}
set
{
m_bModified = value;
if (OnDocumentModified != null)
OnDocumentModified();
}
}
public virtual bool WriteConfigDocument(bool bShowError)
{
return true;
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Xml;
using System.Windows.Forms;
namespace CommonLib
{
/// <summary>
///
/// </summary>
public class BridgeDoc : BaseDoc
{
SolutionGest m_solution;
List<DataBridgeInfo> m_ListDataBridge = new List<DataBridgeInfo>();
/// <summary>
///
/// </summary>
/// <param name="TypeApp"></param>
/// <param name="gestSolution"></param>
public BridgeDoc(TYPE_APP TypeApp, SolutionGest gestSolution) : base (TypeApp)
{
m_solution = gestSolution;
}
public List<DataBridgeInfo> DocumentBridges
{
get { return m_ListDataBridge; }
}
public DataBridgeInfo CreateNewBridge()
{
string strNewBrdigeSymbol = string.Empty;
for (int i = 0; i < Int32.MaxValue; i++)
{
strNewBrdigeSymbol = string.Format("BRIDGE_{0}", i);
bool bNameExists = false;
foreach (DataBridgeInfo br in m_ListDataBridge)
{
if (strNewBrdigeSymbol == br.Symbol)
{
bNameExists = true;
break;
}
}
if (!bNameExists)
break;
}
DataBridgeInfo bgInfo = new DataBridgeInfo();
bgInfo.Symbol = strNewBrdigeSymbol;
m_ListDataBridge.Add(bgInfo);
return bgInfo;
}
public void DeleteBridge(string symbol)
{
DataBridgeInfo brInfo = null;
foreach (DataBridgeInfo br in m_ListDataBridge)
{
if (symbol == br.Symbol)
{
brInfo = br;
break;
}
}
if (brInfo != null)
{
m_ListDataBridge.Remove(brInfo);
}
}
/// <summary>
///
/// </summary>
/// <param name="bShowError"></param>
/// <returns></returns>
public override bool WriteConfigDocument(bool bShowError)
{
return WriteOut(m_strfileFullName, bShowError);
}
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public bool ReadIn(string filename)
{
m_strfileFullName = filename;
XmlDocument XmlDoc = new XmlDocument();
try
{
XmlDoc.Load(filename);
}
catch (Exception e)
{
Traces.LogAddDebug(TraceCat.Document, "Le fichier est corrompu");
Console.WriteLine(e.Message);
return false;
}
XmlNode RootNode = XmlDoc.DocumentElement;
if (RootNode.Name != XML_CF_TAG.Root.ToString())
return false;
foreach (XmlNode Node in RootNode.ChildNodes)
{
if (Node.Name == "DataBridge")
{
DataBridgeInfo bridge = new DataBridgeInfo();
if (bridge.ReadIn(Node))
this.m_ListDataBridge.Add(bridge);
}
}
return true;
}
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <param name="bShowError"></param>
/// <returns></returns>
public bool WriteOut(string filename, bool bShowError)
{
m_strfileFullName = filename;
XmlDocument XmlDoc = new XmlDocument();
XmlDoc.LoadXml("<Root/>");
foreach (DataBridgeInfo bridge in m_ListDataBridge)
{
bridge.WriteOut(XmlDoc, XmlDoc.DocumentElement);
}
XmlDoc.Save(m_strfileFullName);
return true;
}
/// <summary>
///
/// </summary>
public bool FinalizeRead()
{
bool bRet = true;
foreach (DataBridgeInfo bridgeInfo in m_ListDataBridge)
{
bRet &= bridgeInfo.FinalizeRead(m_solution);
}
return bRet;
}
/// <summary>
///
/// </summary>
/// <param name="Mess"></param>
/// <param name="Param"></param>
/// <param name="TypeApp"></param>
public void TraiteMessage(BTDoc sender, MESSAGE Mess, object Param, TYPE_APP TypeApp)
{
foreach (DataBridgeInfo bridgeInfo in m_ListDataBridge)
{
if (Mess == MESSAGE.MESS_CMD_RUN)
{
bridgeInfo.TraiteMessage(sender, MESSAGE.MESS_PRE_PARSE, Param, TypeApp);
}
bridgeInfo.TraiteMessage(sender, Mess, Param, TypeApp);
}
switch (Mess)
{
// les message suivant sont rerouté vers tout les objets
case MESSAGE.MESS_ASK_ITEM_DELETE:
case MESSAGE.MESS_ITEM_DELETED:
case MESSAGE.MESS_ITEM_RENAMED:
case MESSAGE.MESS_CMD_RUN:
this.IsRunning = true;
break;
case MESSAGE.MESS_CMD_STOP:
this.IsRunning = false;
break;
case MESSAGE.MESS_PRE_PARSE:
break;
}
}
}
}
......@@ -85,13 +85,13 @@ namespace CommonLib
public BTComm()
{
// init par défaut
m_TypeComm = TYPE_COMM.ETHERNET;
m_strDestAdress = "192.168.0.99:502";
m_Comm = new EthernetComm();
m_TypeComm = TYPE_COMM.VIRTUAL;
m_strDestAdress = "NA";
m_Comm = new VirtualComm();
m_Comm.EventAddLogEvent += new AddLogEventDelegate(AddLogEvent);
((EthernetComm)m_Comm).IpAddr = "192.168.0.99";
((EthernetComm)m_Comm).Port = 502;
((EthernetComm)m_Comm).OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
//((EthernetComm)m_Comm).IpAddr = "192.168.0.99";
//((EthernetComm)m_Comm).Port = 502;
//((EthernetComm)m_Comm).OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_TimerRecieveTimeout = new System.Windows.Forms.Timer();
m_TimerRecieveTimeout.Interval = 5000;
......@@ -146,6 +146,10 @@ namespace CommonLib
#endregion
#region methodes publiques
public bool SetCommTypeAndParam()
{
return SetCommTypeAndParam(m_TypeComm, m_strDestAdress);
}
/// <summary>
/// permet de définir le type de comm avec ses paramètres
/// initialise la comm en fontion du type et des paramètres
......@@ -161,20 +165,25 @@ namespace CommonLib
return false;
m_TypeComm = CommType;
if (m_Comm != null)
{
m_Comm.EventAddLogEvent -= AddLogEvent;
m_Comm.OnCommStateChange -= ConnectionStateChangeEvent;
}
switch (m_TypeComm)
{
case TYPE_COMM.SERIAL:
m_Comm = new SerialComm();
m_Comm.EventAddLogEvent += new AddLogEventDelegate(AddLogEvent);
((SerialComm)m_Comm).OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_Comm.OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_strDestAdress = strParam;
((SerialComm)m_Comm).ComPort = m_strDestAdress;
break;
case TYPE_COMM.ETHERNET:
m_Comm = new EthernetComm();
m_Comm.EventAddLogEvent += new AddLogEventDelegate(AddLogEvent);
((EthernetComm)m_Comm).OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_Comm.OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_strDestAdress = strParam;
string[] strs = strParam.Split(':');
if (strs.Length != 2)
......@@ -186,7 +195,8 @@ namespace CommonLib
break;
case TYPE_COMM.VIRTUAL:
m_Comm = new VirtualComm();
((VirtualComm)m_Comm).OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_Comm.OnCommStateChange += new CommOpenedStateChange(ConnectionStateChangeEvent);
m_strDestAdress = ((VirtualComm)m_Comm).ComParam;
// aucun paramètres
break;
case TYPE_COMM.HTTP:
......@@ -213,16 +223,9 @@ namespace CommonLib
//WaitForm.Parent = Program.CurrentMainForm;
WaitForm.Show();
Application.DoEvents();
if (m_Comm.OpenComm())
{
WaitForm.Close();
return true;
}
else
{
WaitForm.Close();
return false;
}
bool bRet = m_Comm.OpenComm();