Fix previous commit

This commit is contained in:
Lucio Maranta
2017-11-07 07:50:00 +00:00
parent 22f732ab9d
commit 19dba202b4
31 changed files with 1182 additions and 62 deletions
Binary file not shown.
+130
View File
@@ -0,0 +1,130 @@
using System;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Collections.Generic;
using CMS_CORE.Demo.Models;
using CMS_CORE_Library.Demo.Models;
namespace Nc_Demo_Application.Server.Service
{
[ServiceContract]
interface ILibraryService
{
[OperationContract]
#region Nc Data API
[WebGet(UriTemplate = "cn/name/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetName(out string name);
[WebGet(UriTemplate = "cn/language/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetLanguage(out string language);
[WebGet(UriTemplate = "cn/serial_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetSerialNumber(out string serialNumber);
[WebGet(UriTemplate = "cn/software_version/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetSoftwareVersion(out string softwareVersion);
[WebGet(UriTemplate = "cn/model/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetModel(out string model);
[WebGet(UriTemplate = "cn/date_time/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetDateTime(out string dateTime);
[WebGet(UriTemplate = "cn/machine_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetMachineNumber(out string machineNumber);
[WebGet(UriTemplate = "cn/process_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetProcessNumber(out ushort processNumber);
#endregion
#region Process API
[WebGet(UriTemplate = "process/{id}/status/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetProcessStatus(string id, out int status);
[WebGet(UriTemplate = "process/{id}/mode/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetProcessMode(string id, out int mode);
[WebGet(UriTemplate = "process/{id}/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetProcessAlarms(string id, out List<NcAlarmModel> alarms);
[WebGet(UriTemplate = "processes/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetProcessesAlarms(out List<NcAlarmModel> alarms);
#endregion
#region Process Axes API
[WebGet(UriTemplate = "process/{id}/axes/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetAxesPosition(string id, out List<NcAxisModel> axes);
#endregion
#region Binary Memory
[WebGet(UriTemplate = "binary_memory/byte/{index}/{bit}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetBoolean(string index, string bit, out bool value);
[WebGet(UriTemplate = "binary_memory/byte/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetByte(string index, out byte value);
[WebGet(UriTemplate = "binary_memory/word/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetWord(string index, out ushort value);
[WebGet(UriTemplate = "binary_memory/short/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetShort(string index, out short value);
[WebGet(UriTemplate = "binary_memory/dword/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetDWord(string index, out uint value);
[WebGet(UriTemplate = "binary_memory/integer/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetInteger(string index, out int value);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
void PutByte(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutWord(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutShort(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutInteger(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutDWord(string index, BinaryMemoryModel body);
#endregion
#region Binary Memory List
[WebGet(UriTemplate = "binary_memory/byte/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetByteList(string index, string number, out List<byte> byteList);
[WebGet(UriTemplate = "binary_memory/word/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetWordList(string index, string number, out List<ushort> byteList);
[WebGet(UriTemplate = "binary_memory/short/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetShortList(string index, string number, out List<short> byteList);
[WebGet(UriTemplate = "binary_memory/integer/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetIntegerList(string index, string number, out List<int> byteList);
[WebGet(UriTemplate = "binary_memory//{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetDWordList(string index, string number, out List<uint> byteList);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutByteList(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutWordList(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutShortList(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutIntegerList(string index, BinaryMemoryModel body);
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
void PutDWordList(string index, BinaryMemoryModel body);
#endregion
}
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE_Library.Demo.Models
{
[DataContract]
class BinaryMemoryModel
{
[DataMember]
public byte binary;
[DataMember]
public short word;
[DataMember]
public ushort uWord;
[DataMember]
public int integer;
[DataMember]
public uint dWord;
[DataMember]
public List<byte> byteList;
[DataMember]
public List<short> shortList;
[DataMember]
public List<ushort> wordList;
[DataMember]
public List<int> integerList;
[DataMember]
public List<uint> dWordList;
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE.Demo.Models
{
[DataContract]
class NcAlarmModel
{
[DataMember]
public int id;
[DataMember]
public int code;
[DataMember]
public string text;
[DataMember]
public int processId;
}
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE.Demo.Models
{
[DataContract]
class NcAxisModel
{
[DataMember]
public int id;
[DataMember]
public string name;
[DataMember]
public double actual;
[DataMember]
public double programmed;
[DataMember]
public double machinePosition;
[DataMember]
public double distanceToGo;
[DataMember]
public int processId;
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE.Demo.Models
{
class NcDataModel
{
public int id;
public string name;
public string serialNumber;
public string model;
public string language;
public string softwareVersion;
public string dateTime;
public string machineNumber;
public int processCount;
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE.Demo.Models
{
class NcProcessModel
{
public int id { get; set; }
public string name { get; set; }
public int status;
public int mode;
public int enabled;
}
}
+750
View File
@@ -0,0 +1,750 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Text;
using System.Threading.Tasks;
using CMS_CORE.Demo.Models;
using CMS_CORE.Exceptions;
using CMS_CORE_Library.Demo.Models;
using Nc_Demo_Application.Server.Service;
namespace CMS_CORE.Demo
{
public class Nc_Demo : Nc
{
private EndpointAddress address;
private ChannelFactory<ILibraryService> cf;
private ILibraryService channel;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Contructor & global methods
public Nc_Demo()
{
address =new EndpointAddress("http://localhost:8080/api/");
}
public override void Connect()
{
//Specify the address to be used for the client.
cf = new ChannelFactory<ILibraryService>(new WebHttpBinding(), address);
cf.Endpoint.EndpointBehaviors.Add(new WebHttpBehavior());
channel = cf.CreateChannel();
Connected = true;
}
public override void Disconnect()
{
cf.Close();
Connected = false;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region High level methods
public override void R_NCDateTime(ref DateTime ActualTime)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
// Get datetime from Demo server
string demoDateTime = "";
channel.GetDateTime(out demoDateTime);
ActualTime = Convert.ToDateTime(demoDateTime);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_NCSerialNumber(ref String SN)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
// Get serial number from Demo server
channel.GetSerialNumber(out SN);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
//Get the NC model Name
public override void R_NCModelName(ref string ModelName)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
channel.GetModel(out ModelName);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_NCSoftwareVersion(ref String SWV)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
// Get software version from Demo server
channel.GetSoftwareVersion(out SWV);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_NCMachineNumber(ref string MachNumber)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
// Get machine number from Demo server
channel.GetMachineNumber(out MachNumber);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_NCProcessesNum(ref ushort ProcNumber)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{ // Get Process Cout from Demo server
channel.GetProcessNumber(out ProcNumber);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_NCLanguage(ref CultureInfo Language)
{
//Check if the NC Demo is Connected
CheckConnection();
try
{
// Get language from Demo server
string demoLanguage = "";
channel.GetLanguage(out demoLanguage);
Language = ConverToSTEPLanguage(demoLanguage);
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PLC High-level data
public override void R_PLCActiveAlarms(ref List<String> Alarms)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
List<NcAlarmModel> demoAlarms;
// Get Alarms from server
channel.GetProcessesAlarms(out demoAlarms);
// Parse response
foreach (NcAlarmModel demoAlarm in demoAlarms)
{
Alarms.Add(demoAlarm.text);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS (PATH) High-level data
public override void R_PROCStatus(ushort ProcNumber, ref PROC_Status Status)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get status from server
channel.GetProcessStatus(ProcNumber.ToString(), out int demoStatus);
Status = (PROC_Status)demoStatus;
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCMode(ushort ProcNumber, ref PROC_Mode Mode)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get mode from server
channel.GetProcessMode(ProcNumber.ToString(), out int demoMode);
Mode = (PROC_Mode)demoMode;
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCActiveAlarms(ushort ProcNumber, ref List<string> Alarms)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
channel.GetProcessAlarms(ProcNumber.ToString(), out List<NcAlarmModel> demoAlarms);
foreach (NcAlarmModel demoAlarm in demoAlarms)
{
Alarms.Add(demoAlarm.text);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region PROCESS-AXES (PATH) High-level data
public override void R_PROCAxis_InterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get axes position from Demo Server
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse server response
foreach(NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.actual);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCAxis_ProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get Axes Position from server
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse server response and get programmed position
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.programmed);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCAxis_MachinePosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get Axes Position from server
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse Server response and get machine position
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.machinePosition);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCAxis_FollError(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Get Axes position from Demo server
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response get distance to go
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void R_PROCAxis_DistToGo(ushort ProcNumber, ref Dictionary<string, double> Axes)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
// Parse response get distance to go
foreach (NcAxisModel demoAxis in demoAxes)
{
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: single valiable in memory
public override void RW_Boolean(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemBit, ref bool Value)
{
// Check if the NC Demo is Connected
CheckConnection();
CheckBitRange(MemBit);
try
{
// Read case: Read bit
if (bWrite == R)
{
channel.GetBoolean(MemIndex.ToString(), MemBit.ToString(), out Value);
}
// Write case: write bit
else
{
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Byte(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByte, ref byte Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetByte(MemIndex.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.binary = Value;
channel.PutByte(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Word(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref ushort Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetWord(MemIndex.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.uWord = Value;
channel.PutWord(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Short(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref short Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetShort(MemIndex.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.word = Value;
channel.PutShort(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_DWord(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref uint Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetDWord(MemIndex.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.dWord = Value;
channel.PutDWord(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Integer(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, ref int Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetInteger(MemIndex.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.integer = Value;
channel.PutInteger(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: variables List in memory
public override void RW_Byte_List(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int MemByteStart, int Number, ref List<byte> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetByteList(MemIndex.ToString(), Number.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.byteList = Value;
channel.PutByteList(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Word_List(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<ushort> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetWordList(MemIndex.ToString(), Number.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.wordList = Value;
channel.PutWordList(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Short_List(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<short> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetShortList(MemIndex.ToString(), Number.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.shortList = Value;
channel.PutShortList(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_Integer_List(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<int> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetIntegerList(MemIndex.ToString(), Number.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.integerList = Value;
channel.PutIntegerList(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
public override void RW_DWord_List(bool bWrite, int Process, MEMORY_Type MemType, int MemIndex, int Number, ref List<uint> Value)
{
// Check if the NC Demo is Connected
CheckConnection();
try
{
// Read case
if (bWrite == R)
{
channel.GetDWordList(MemIndex.ToString(), Number.ToString(), out Value);
}
else // Write case
{
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
binaryMemoryModel.dWordList = Value;
channel.PutDWordList(MemIndex.ToString(), binaryMemoryModel);
}
}
catch (Exception ex)
{
ThrowNCException(ex);
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC Low-level function: Parameters
public override void R_NCParam(short Index, short Bit, ref bool Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
}
public override void R_NCParam(short Index, ref byte Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
}
public override void R_NCParam(short Index, ref short Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
}
public override void R_NCParam(short Index, ref int Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
}
public override void R_NCParam(short Index, ref double Value)
{
throw new Nc_Exception(getError(FUNC_NOTALL_NC_ERROR));
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region Subordinate Private Functions
//Check if NC is connected
private void CheckConnection()
{
if (!isConnected())
throw new Nc_Exception(getError(NOT_CONNECTED_ERROR));
}
//Manage the Languages
private CultureInfo ConverToSTEPLanguage(String Lang)
{
CultureInfo Culture = CultureInfo.GetCultures(CultureTypes.AllCultures).FirstOrDefault(X => X.EnglishName.ToLower() == Lang.ToLower());
if (Culture != null)
return Culture;
else
return new CultureInfo("en");
}
//Manage the Exception Launch
private void ThrowNCException(Exception ex)
{
if (!(ex is Nc_Exception))
Connected = false;
//Catch the .Net exceptions
if (ex is EndpointNotFoundException)
throw new Nc_Exception("NC not found: " + ex.Message);
else
throw new Nc_Exception("NC Comunication Error: " + ex.Message);
}
// Convert the internal error in a readable-String error
private String getError(uint CMSError)
{
String ErrororOwner = "";
if (CMSError != 0)
{
ErrororOwner = "CMS-Core-Error: ";
switch (CMSError)
{
case NOT_CONNECTED_ERROR: return ErrororOwner + "Nc not Connected";
case PROC_NOT_FOUND_ERROR: return ErrororOwner + "Process Id not found";
case FUNC_NOTALL_NC_ERROR: return ErrororOwner + "Function not allowed for this type of NC";
case BIT_NOT_IN_RANGE_ERROR: return ErrororOwner + "Bit-number must be between 0 and 7";
case INTERNAL_ERROR: return ErrororOwner + "Internal function error";
}
}
return ErrororOwner + "Generic Error On Function";
}
//Check Bit In Range
private void CheckBitRange(int bitnum)
{
if (bitnum < 0 || bitnum > 7)
throw new Nc_Exception(getError(BIT_NOT_IN_RANGE_ERROR));
}
#endregion
}
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
b5b2eb5897f08292a232734ecbe8ea2948fbc0fc
Binary file not shown.
Binary file not shown.
@@ -125,15 +125,6 @@
</ItemGroup>
<ItemGroup>
<Content Include="Images\CMS_Icon.ico" />
<Content Include="Images\edit.png" />
<Content Include="Images\empty.png" />
<Content Include="Images\Folder New.png" />
<Content Include="Images\folder.png" />
<Content Include="Images\forward.png" />
<Content Include="Images\Icon.png" />
<Content Include="Images\icon_edit.png" />
<Content Include="Images\key New.png" />
<Content Include="Images\key.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
@@ -167,8 +167,8 @@ namespace Nc_Demo_Application.Database
ReadDataFromDatabase(READ_NC_PROCESS_QUERY, ref ncProcessDataTable);
foreach (DataRow row in ncProcessDataTable.Rows)
{
row["status"] = (PROC_STATUS)Convert.ToInt32(row["status"]);
row["mode"] = (PROC_MODE)Convert.ToInt32(row["mode"]);
row["status"] = (int)Convert.ToInt32(row["status"]);
row["mode"] = (int)Convert.ToInt32(row["mode"]);
}
return ncProcessDataTable;
@@ -33,8 +33,9 @@
this.stopServer = new System.Windows.Forms.Button();
this.ncAxesSaveButton = new System.Windows.Forms.TabControl();
this.ncDataPage = new System.Windows.Forms.TabPage();
this.toolStrip5 = new System.Windows.Forms.ToolStrip();
this.saveNcDataButton = new System.Windows.Forms.ToolStripButton();
this.label6 = new System.Windows.Forms.Label();
this.saveNcDataButton = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
@@ -91,6 +92,7 @@
this.BinaryMemoryIntegerColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ncAxesSaveButton.SuspendLayout();
this.ncDataPage.SuspendLayout();
this.toolStrip5.SuspendLayout();
this.processPage.SuspendLayout();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).BeginInit();
@@ -107,7 +109,7 @@
//
// startServer
//
this.startServer.Location = new System.Drawing.Point(480, 306);
this.startServer.Location = new System.Drawing.Point(484, 454);
this.startServer.Name = "startServer";
this.startServer.Size = new System.Drawing.Size(92, 30);
this.startServer.TabIndex = 0;
@@ -118,7 +120,7 @@
// stopServer
//
this.stopServer.Enabled = false;
this.stopServer.Location = new System.Drawing.Point(383, 306);
this.stopServer.Location = new System.Drawing.Point(387, 454);
this.stopServer.Name = "stopServer";
this.stopServer.Size = new System.Drawing.Size(91, 30);
this.stopServer.TabIndex = 1;
@@ -136,14 +138,14 @@
this.ncAxesSaveButton.Location = new System.Drawing.Point(12, 12);
this.ncAxesSaveButton.Name = "ncAxesSaveButton";
this.ncAxesSaveButton.SelectedIndex = 0;
this.ncAxesSaveButton.Size = new System.Drawing.Size(564, 276);
this.ncAxesSaveButton.Size = new System.Drawing.Size(564, 436);
this.ncAxesSaveButton.TabIndex = 3;
//
// ncDataPage
//
this.ncDataPage.BackColor = System.Drawing.SystemColors.Control;
this.ncDataPage.Controls.Add(this.toolStrip5);
this.ncDataPage.Controls.Add(this.label6);
this.ncDataPage.Controls.Add(this.saveNcDataButton);
this.ncDataPage.Controls.Add(this.label5);
this.ncDataPage.Controls.Add(this.label4);
this.ncDataPage.Controls.Add(this.label3);
@@ -163,35 +165,45 @@
this.ncDataPage.Location = new System.Drawing.Point(4, 22);
this.ncDataPage.Name = "ncDataPage";
this.ncDataPage.Padding = new System.Windows.Forms.Padding(3);
this.ncDataPage.Size = new System.Drawing.Size(556, 250);
this.ncDataPage.Size = new System.Drawing.Size(556, 410);
this.ncDataPage.TabIndex = 0;
this.ncDataPage.Text = "Nc Data";
//
// toolStrip5
//
this.toolStrip5.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveNcDataButton});
this.toolStrip5.Location = new System.Drawing.Point(3, 3);
this.toolStrip5.Name = "toolStrip5";
this.toolStrip5.Size = new System.Drawing.Size(550, 25);
this.toolStrip5.TabIndex = 53;
this.toolStrip5.Text = "toolStrip5";
//
// saveNcDataButton
//
this.saveNcDataButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveNcDataButton.Enabled = false;
this.saveNcDataButton.Image = ((System.Drawing.Image)(resources.GetObject("saveNcDataButton.Image")));
this.saveNcDataButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveNcDataButton.Name = "saveNcDataButton";
this.saveNcDataButton.Size = new System.Drawing.Size(23, 22);
this.saveNcDataButton.Text = "toolStripButton1";
this.saveNcDataButton.Click += new System.EventHandler(this.SaveCnDataButton_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(20, 11);
this.label6.Location = new System.Drawing.Point(21, 59);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(217, 18);
this.label6.TabIndex = 52;
this.label6.Text = "Numerical control generic data: ";
//
// saveNcDataButton
//
this.saveNcDataButton.Enabled = false;
this.saveNcDataButton.Location = new System.Drawing.Point(413, 221);
this.saveNcDataButton.Name = "saveNcDataButton";
this.saveNcDataButton.Size = new System.Drawing.Size(75, 23);
this.saveNcDataButton.TabIndex = 51;
this.saveNcDataButton.Text = "Save";
this.saveNcDataButton.UseVisualStyleBackColor = true;
this.saveNcDataButton.Click += new System.EventHandler(this.SaveCnDataButton_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(352, 166);
this.label5.Location = new System.Drawing.Point(352, 226);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 13);
this.label5.TabIndex = 50;
@@ -200,7 +212,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(21, 163);
this.label4.Location = new System.Drawing.Point(21, 223);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 13);
this.label4.TabIndex = 49;
@@ -209,7 +221,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(320, 131);
this.label3.Location = new System.Drawing.Point(320, 191);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(87, 13);
this.label3.TabIndex = 48;
@@ -218,7 +230,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(21, 124);
this.label2.Location = new System.Drawing.Point(21, 184);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 13);
this.label2.TabIndex = 47;
@@ -227,7 +239,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(334, 91);
this.label1.Location = new System.Drawing.Point(334, 151);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(73, 13);
this.label1.TabIndex = 46;
@@ -235,56 +247,56 @@
//
// processNumberTxb
//
this.processNumberTxb.Location = new System.Drawing.Point(414, 163);
this.processNumberTxb.Location = new System.Drawing.Point(414, 223);
this.processNumberTxb.Name = "processNumberTxb";
this.processNumberTxb.Size = new System.Drawing.Size(112, 20);
this.processNumberTxb.TabIndex = 45;
//
// dateTimeTxb
//
this.dateTimeTxb.Location = new System.Drawing.Point(80, 160);
this.dateTimeTxb.Location = new System.Drawing.Point(80, 220);
this.dateTimeTxb.Name = "dateTimeTxb";
this.dateTimeTxb.Size = new System.Drawing.Size(113, 20);
this.dateTimeTxb.TabIndex = 44;
//
// softwareVersionTxb
//
this.softwareVersionTxb.Location = new System.Drawing.Point(413, 124);
this.softwareVersionTxb.Location = new System.Drawing.Point(413, 184);
this.softwareVersionTxb.Name = "softwareVersionTxb";
this.softwareVersionTxb.Size = new System.Drawing.Size(113, 20);
this.softwareVersionTxb.TabIndex = 43;
//
// languageTxb
//
this.languageTxb.Location = new System.Drawing.Point(80, 121);
this.languageTxb.Location = new System.Drawing.Point(80, 181);
this.languageTxb.Name = "languageTxb";
this.languageTxb.Size = new System.Drawing.Size(113, 20);
this.languageTxb.TabIndex = 42;
//
// serialNumberTxb
//
this.serialNumberTxb.Location = new System.Drawing.Point(413, 88);
this.serialNumberTxb.Location = new System.Drawing.Point(413, 148);
this.serialNumberTxb.Name = "serialNumberTxb";
this.serialNumberTxb.Size = new System.Drawing.Size(113, 20);
this.serialNumberTxb.TabIndex = 41;
//
// modelTxb
//
this.modelTxb.Location = new System.Drawing.Point(80, 85);
this.modelTxb.Location = new System.Drawing.Point(80, 145);
this.modelTxb.Name = "modelTxb";
this.modelTxb.Size = new System.Drawing.Size(113, 20);
this.modelTxb.TabIndex = 40;
//
// machineNumberTxb
//
this.machineNumberTxb.Location = new System.Drawing.Point(413, 52);
this.machineNumberTxb.Location = new System.Drawing.Point(413, 112);
this.machineNumberTxb.Name = "machineNumberTxb";
this.machineNumberTxb.Size = new System.Drawing.Size(113, 20);
this.machineNumberTxb.TabIndex = 39;
//
// ncNameTxb
//
this.ncNameTxb.Location = new System.Drawing.Point(80, 49);
this.ncNameTxb.Location = new System.Drawing.Point(80, 109);
this.ncNameTxb.Name = "ncNameTxb";
this.ncNameTxb.Size = new System.Drawing.Size(113, 20);
this.ncNameTxb.TabIndex = 38;
@@ -292,7 +304,7 @@
// ModelLabel
//
this.ModelLabel.AutoSize = true;
this.ModelLabel.Location = new System.Drawing.Point(38, 88);
this.ModelLabel.Location = new System.Drawing.Point(38, 148);
this.ModelLabel.Name = "ModelLabel";
this.ModelLabel.Size = new System.Drawing.Size(36, 13);
this.ModelLabel.TabIndex = 37;
@@ -301,7 +313,7 @@
// MachineNumLabel
//
this.MachineNumLabel.AutoSize = true;
this.MachineNumLabel.Location = new System.Drawing.Point(319, 55);
this.MachineNumLabel.Location = new System.Drawing.Point(319, 115);
this.MachineNumLabel.Name = "MachineNumLabel";
this.MachineNumLabel.Size = new System.Drawing.Size(88, 13);
this.MachineNumLabel.TabIndex = 36;
@@ -310,7 +322,7 @@
// NCNameLabel
//
this.NCNameLabel.AutoSize = true;
this.NCNameLabel.Location = new System.Drawing.Point(21, 52);
this.NCNameLabel.Location = new System.Drawing.Point(21, 112);
this.NCNameLabel.Name = "NCNameLabel";
this.NCNameLabel.Size = new System.Drawing.Size(53, 13);
this.NCNameLabel.TabIndex = 35;
@@ -324,7 +336,7 @@
this.processPage.Location = new System.Drawing.Point(4, 22);
this.processPage.Name = "processPage";
this.processPage.Padding = new System.Windows.Forms.Padding(3);
this.processPage.Size = new System.Drawing.Size(556, 250);
this.processPage.Size = new System.Drawing.Size(556, 410);
this.processPage.TabIndex = 1;
this.processPage.Text = "Nc Process";
//
@@ -359,7 +371,7 @@
this.ncProcessModeColumn});
this.ncProcessGridView.Location = new System.Drawing.Point(3, 28);
this.ncProcessGridView.Name = "ncProcessGridView";
this.ncProcessGridView.Size = new System.Drawing.Size(553, 167);
this.ncProcessGridView.Size = new System.Drawing.Size(550, 382);
this.ncProcessGridView.TabIndex = 4;
this.ncProcessGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.ncProcessGridView_DataError);
//
@@ -396,7 +408,7 @@
this.alarms.Controls.Add(this.ncAlarmsGridView);
this.alarms.Location = new System.Drawing.Point(4, 22);
this.alarms.Name = "alarms";
this.alarms.Size = new System.Drawing.Size(556, 250);
this.alarms.Size = new System.Drawing.Size(556, 410);
this.alarms.TabIndex = 2;
this.alarms.Text = "NC Alarms";
this.alarms.UseVisualStyleBackColor = true;
@@ -433,7 +445,7 @@
this.ncAlarmsGridView.Location = new System.Drawing.Point(3, 28);
this.ncAlarmsGridView.Name = "ncAlarmsGridView";
this.ncAlarmsGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.ncAlarmsGridView.Size = new System.Drawing.Size(485, 167);
this.ncAlarmsGridView.Size = new System.Drawing.Size(553, 386);
this.ncAlarmsGridView.TabIndex = 0;
//
// ncAlarmCodeColumn
@@ -470,7 +482,7 @@
this.ncAxesPage.Controls.Add(this.ncAxisGridView);
this.ncAxesPage.Location = new System.Drawing.Point(4, 22);
this.ncAxesPage.Name = "ncAxesPage";
this.ncAxesPage.Size = new System.Drawing.Size(556, 250);
this.ncAxesPage.Size = new System.Drawing.Size(556, 410);
this.ncAxesPage.TabIndex = 3;
this.ncAxesPage.Text = "Axes";
this.ncAxesPage.UseVisualStyleBackColor = true;
@@ -509,7 +521,7 @@
this.axisProcessColumn});
this.ncAxisGridView.Location = new System.Drawing.Point(3, 28);
this.ncAxisGridView.Name = "ncAxisGridView";
this.ncAxisGridView.Size = new System.Drawing.Size(485, 167);
this.ncAxisGridView.Size = new System.Drawing.Size(550, 386);
this.ncAxisGridView.TabIndex = 0;
//
// axisIdColumn
@@ -568,7 +580,7 @@
this.byteMemoryPage.Controls.Add(this.binaryMemoryGridView);
this.byteMemoryPage.Location = new System.Drawing.Point(4, 22);
this.byteMemoryPage.Name = "byteMemoryPage";
this.byteMemoryPage.Size = new System.Drawing.Size(556, 250);
this.byteMemoryPage.Size = new System.Drawing.Size(556, 410);
this.byteMemoryPage.TabIndex = 4;
this.byteMemoryPage.Text = "Byte Memory";
this.byteMemoryPage.UseVisualStyleBackColor = true;
@@ -599,6 +611,7 @@
// addRowsBinaryMemory
//
this.addRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.addRowsBinaryMemory.Enabled = false;
this.addRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("addRowsBinaryMemory.Image")));
this.addRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
this.addRowsBinaryMemory.Name = "addRowsBinaryMemory";
@@ -609,6 +622,7 @@
// deleteRowsBinaryMemory
//
this.deleteRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.deleteRowsBinaryMemory.Enabled = false;
this.deleteRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("deleteRowsBinaryMemory.Image")));
this.deleteRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
this.deleteRowsBinaryMemory.Name = "deleteRowsBinaryMemory";
@@ -629,7 +643,7 @@
this.BinaryMemoryIntegerColumn});
this.binaryMemoryGridView.Location = new System.Drawing.Point(3, 28);
this.binaryMemoryGridView.Name = "binaryMemoryGridView";
this.binaryMemoryGridView.Size = new System.Drawing.Size(550, 222);
this.binaryMemoryGridView.Size = new System.Drawing.Size(550, 386);
this.binaryMemoryGridView.TabIndex = 0;
this.binaryMemoryGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.BinaryMemoryGridView_CellEndEdit);
this.binaryMemoryGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.BinaryMemoryGridView_CellValueChanged);
@@ -670,7 +684,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(588, 348);
this.ClientSize = new System.Drawing.Size(586, 496);
this.Controls.Add(this.ncAxesSaveButton);
this.Controls.Add(this.stopServer);
this.Controls.Add(this.startServer);
@@ -680,6 +694,8 @@
this.ncAxesSaveButton.ResumeLayout(false);
this.ncDataPage.ResumeLayout(false);
this.ncDataPage.PerformLayout();
this.toolStrip5.ResumeLayout(false);
this.toolStrip5.PerformLayout();
this.processPage.ResumeLayout(false);
this.processPage.PerformLayout();
this.toolStrip1.ResumeLayout(false);
@@ -712,7 +728,6 @@
private System.Windows.Forms.TabPage processPage;
private System.Windows.Forms.TabPage ncDataPage;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button saveNcDataButton;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
@@ -766,6 +781,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryBinaryColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryWordColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryIntegerColumn;
private System.Windows.Forms.ToolStrip toolStrip5;
private System.Windows.Forms.ToolStripButton saveNcDataButton;
}
}
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Windows.Forms;
using static Nc_Demo_Application.Constants;
using System.Data;
using System.Linq;
namespace Nc_Demo_Application
{
@@ -31,11 +32,9 @@ namespace Nc_Demo_Application
startServer.Enabled = false;
stopServer.Enabled = true;
SetButtonStatus(true);
// Populate process model and status ComboBox
ncProcessModeColumn.ValueType = typeof(PROC_MODE);
ncProcessModeColumn.DataSource = Enum.GetValues(typeof(PROC_MODE));
ncProcessStatusColumn.ValueType = typeof(PROC_STATUS);
// Populate process model and status ComboBox
ncProcessModeColumn.DataSource = Enum.GetValues(typeof(PROC_MODE));
ncProcessStatusColumn.DataSource = Enum.GetValues(typeof(PROC_STATUS));
// Read data from database
@@ -64,7 +63,10 @@ namespace Nc_Demo_Application
saveNcProcessData.Enabled =
saveNcAlarmsButton.Enabled =
saveNcAxesButton.Enabled =
saveBinaryMemoryButton.Enabled = status;
saveBinaryMemoryButton.Enabled =
addRowsBinaryMemory.Enabled =
deleteRowsBinaryMemory.Enabled =
status;
}
private void FillNcDataInput()
@@ -289,6 +291,7 @@ namespace Nc_Demo_Application
private void deleteRowsBinaryMemory_Click(object sender, EventArgs e)
{
// Remove last 4 rows
int lenght = binaryMemoryGridView.RowCount - 1;
for (int i = lenght; i > (lenght - 4); i--)
{
@@ -117,10 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip5.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>437, 17</value>
</metadata>
<metadata name="toolStrip5.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>437, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="saveNcDataButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABRSURBVDhPY6AK+Pbt239S8NevX+dDtUIASJAheA4cf3j/
EY6RxUB0zIR9mIaQYgAIwwyBaifdABAm2gBkjKyGtgYQg0cNGJQGkIOh2ikBDAwAR/4LjdUkCHIAAAAA
SUVORK5CYII=
</value>
</data>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="saveNcProcessData.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -141,6 +158,21 @@
<metadata name="ncProcessModeColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncProcessIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncProcessNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncProcessStatusColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncProcessModeColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>227, 17</value>
</metadata>
<metadata name="toolStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>227, 17</value>
</metadata>
@@ -164,6 +196,21 @@
<metadata name="ncAlarmIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncAlarmCodeColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncAlarmTextColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncAlarmProcessIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ncAlarmIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStrip4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 17</value>
</metadata>
<metadata name="toolStrip4.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>332, 17</value>
</metadata>
@@ -196,6 +243,30 @@
<metadata name="axisProcessColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisActualColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisProgrammedColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisMachinePositionColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisDistanceToGoColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="axisProcessColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
@@ -230,6 +301,15 @@
<metadata name="BinaryMemoryIntegerColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BinaryMemoryBinaryColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BinaryMemoryWordColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BinaryMemoryIntegerColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAgIAAAAEAIAAoCAEAFgAAACgAAACAAAAAAAEAAAEAIAAAAAAAAAgBAAAAAAAAAAAAAAAAAAAA
@@ -1 +1 @@
11f6b4a003b7449a519bdf088b56a7b01e02f84d
54262f7fb30151a95c96fbd0e2851c87bdd4e629
@@ -18,3 +18,23 @@ C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csproj.CoreCompileInputs.cache
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.exe
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.pdb
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe.config
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.pdb
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.EF6.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.Linq.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.ServiceModel.Primitives.dll
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.xml
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.xml
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.xml
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll.config
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csprojResolveAssemblyReference.cache
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.NcDemoApplicationForm.resources
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.Properties.Resources.resources
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csproj.GenerateResource.Cache
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csproj.CoreCompileInputs.cache
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.exe
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.pdb