using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IniFiles;
namespace SCMCncLib
{
public enum NC_DEVICE_TYPE { VIRTUAL = 1, NUM_10x0, OSAI_510, ESAGV_KVARA, FILE_DEVICE };
///
/// Base class for devices
///
public class thdNcBase
{
// !!! 2016.05.25 commentato e riscritto perchè NON C'E' la parte form, è DLL comunicazione...
#if false
protected XSimMainWindow m_form; // link to main window
protected MWEngine mwEngine; // link to graphic engine
#endif // false
public bool Connected = false;
protected bool requestStop = false;
protected int PlcDelay;
public bool Finished = false; // this flag will be true when execution is stopped (after a RequestStop)
public string DeviceName = ""; // name of the device (just for display purpose)
public NC_DEVICE_TYPE DeviceType = 0; // store type of device if needed
// !!! 2016.05.25 commentato e riscritto perchè NON C'E' la parte form, è DLL comunicazione...
#if false
///
/// Initialization: common operations for all devices.
///
/// The e.
/// The f ini.
/// The form.
public thdNcBase(MWEngine e, IniFile fIni, XSimMainWindow form)
{
// store main form
m_form = form;
// store link to graphic manager
mwEngine = e;
// set delay for execution cycle
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
}
#endif // false
///
/// Initialization: common operations for all devices.
///
/// The f ini.
public thdNcBase(IniFile fIni)
{
// set delay for execution cycle
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
}
///
/// Initialize read and write buffers of memory manager
///
public void CreateBuffers()
{
#if false
mwEngine.MemoryManager.InitializeMemories();
#endif
}
///
/// Request to stop the thread
///
public void RequestStop()
{
requestStop = true;
}
///
/// Virtual method for thread main execution
///
public virtual void Execute() {}
///
/// Call main form function to display actual connection status
///
protected void WriteConnectionStatus()
{
// !!! 2016.05.25 commentato e riscritto perchè NON C'E' la parte form, è DLL comunicazione...
#if false
XSimMainWindow.Instance.Dispatcher.BeginInvoke(new Action(() => m_form.SetConnectionState(Connected)));
#endif // false
}
}
}