//****************************************************************************************** // D'ORSI Vincent le 25/06/2014 V1.00 /* * Log Update : * 1.00 - 25/06/2014 - Vincent D'ORSI : * => Version initiale * */ //****************************************************************************************** using ExtendedFrameworkVD.Device; using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Windows.Forms; namespace Avtovaz_Emballage_Schaltdom { /// /// Cette classe regroupe l'ensemble des chemins d'accès communs. /// public class CCommonVariables { #region Variables public const String EXIT_PASSWORD = "?Abc123"; public const String OPEN_SYSTEM_PARAMETER_PASSWORD = "?Abc123"; public static CMultiThreadingVariables MultiThreadingVariables = new CMultiThreadingVariables(); #endregion /// /// Cette classe regroupe l'ensemble des variables utilisées entre les threads. /// public class CMultiThreadingVariables { #region Variables private CApplicationConfig _appConfig; // Variable pour les données d'application private FAvtovazSchaltdomPallet _fAvtovazSchaltdomPallet_1; private FAdam6052 _adam6052_1; private ReaderWriterLock _lock = new ReaderWriterLock(); #endregion #region Propriétés /// /// La propriété AppConfig contient les données d'application. /// /// La propriété AppConfig retourne ou affecte la valeur , _appConfig, une variable privée. public CApplicationConfig AppConfig { get { CApplicationConfig temp; _lock.AcquireReaderLock(500); try { temp = _appConfig; } finally { _lock.ReleaseReaderLock(); } return temp; } set { _lock.AcquireWriterLock(500); try { _appConfig = value; } finally { _lock.ReleaseWriterLock(); } } //get //{ // FAvtovazSchaltdomPallet temp; // lock (this) // { // temp = _fAvtovazSchaltdomPallet_1; // } // return temp; //} //set //{ // lock (this) // { // _fAvtovazSchaltdomPallet_1 = value; // } //} } /// /// La propriété AvtovazSchaltdomPallet_1 contient la communication avec le détecteur O3D200_1. /// /// La propriété AvtovazSchaltdomPallet_1 retourne ou affecte la valeur , _fAvtovazSchaltdomPallet_1, une variable privée. public FAvtovazSchaltdomPallet AvtovazSchaltdomPallet_1 { get { FAvtovazSchaltdomPallet temp; _lock.AcquireReaderLock(500); try { temp = _fAvtovazSchaltdomPallet_1; } finally { _lock.ReleaseReaderLock(); } return temp; } set { _lock.AcquireWriterLock(500); try { _fAvtovazSchaltdomPallet_1 = value; } finally { _lock.ReleaseWriterLock(); } } //get //{ // FAvtovazSchaltdomPallet temp; // lock (this) // { // temp = _fAvtovazSchaltdomPallet_1; // } // return temp; //} //set //{ // lock (this) // { // _fAvtovazSchaltdomPallet_1 = value; // } //} } /// /// La propriété Adam6052_1 contient la communication avec le module ADAM6052_1. /// /// La propriété Adam6052_1 retourne ou affecte la valeur , _adam6052_1, une variable privée. public FAdam6052 Adam6052_1 { get { FAdam6052 temp; _lock.AcquireReaderLock(500); try { temp = _adam6052_1; } finally { _lock.ReleaseReaderLock(); } return temp; } set { _lock.AcquireWriterLock(500); try { _adam6052_1 = value; } finally { _lock.ReleaseWriterLock(); } } //get //{ // FAdam6052 temp; // lock (this) // { // temp = _adam6052_1; // } // return temp; //} //set //{ // lock (this) // { // _adam6052_1 = value; // } //} } #endregion #region Constructeurs, destructeurs et événements /*############################################################################## # CMultiThreadingVariables ##############################################################################*/ /// /// Constructeur de la classe , la form principale de l'application. /// /// Cette exemple montre comment appeler la méthode . /// /// // En cours d'écriture. /// /// public CMultiThreadingVariables() { } #endregion } } }