New feature:
- Added new form where user can insert a custom port. - Added custom ip in the demo constructor Fixed minor problems
This commit is contained in:
Binary file not shown.
Generated
+14
@@ -28,13 +28,25 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.connectDemo = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// connectDemo
|
||||
//
|
||||
this.connectDemo.Location = new System.Drawing.Point(69, 118);
|
||||
this.connectDemo.Name = "connectDemo";
|
||||
this.connectDemo.Size = new System.Drawing.Size(154, 23);
|
||||
this.connectDemo.TabIndex = 0;
|
||||
this.connectDemo.Text = "Connect to demo";
|
||||
this.connectDemo.UseVisualStyleBackColor = true;
|
||||
this.connectDemo.Click += new System.EventHandler(this.connectDemo_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.Controls.Add(this.connectDemo);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
@@ -43,6 +55,8 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button connectDemo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,20 +42,32 @@ namespace CMS_CORE_Application
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
}
|
||||
Nc_Demo nc_Demo = new Nc_Demo();
|
||||
nc_Demo.Connect();
|
||||
|
||||
DateTime testDateTime = new DateTime();
|
||||
nc_Demo.R_NCDateTime(ref testDateTime);
|
||||
|
||||
byte byteValue = 0;
|
||||
nc_Demo.RW_Byte(false, 1, Nc.MEMORY_Type.NullVariable, 0, 0, ref byteValue);
|
||||
MessageBox.Show("First byte:" + byteValue.ToString() + "DateTime " + testDateTime.ToString());
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void connectDemo_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Nc_Demo nc_Demo = new Nc_Demo("localhost", 8080);
|
||||
nc_Demo.Connect();
|
||||
|
||||
DateTime testDateTime = new DateTime();
|
||||
nc_Demo.R_NCDateTime(ref testDateTime);
|
||||
|
||||
byte byteValue = 0;
|
||||
nc_Demo.RW_Byte(false, 1, Nc.MEMORY_Type.NullVariable, 0, 0, ref byteValue);
|
||||
MessageBox.Show("First byte: " + byteValue.ToString() + "\nDateTime: " + testDateTime.ToString());
|
||||
}
|
||||
catch (Nc_Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -17,27 +17,30 @@ namespace CMS_CORE.Demo
|
||||
public class Nc_Demo : Nc
|
||||
{
|
||||
|
||||
private EndpointAddress address;
|
||||
private EndpointAddress serverAddress;
|
||||
private ChannelFactory<ILibraryService> cf;
|
||||
private ILibraryService channel;
|
||||
private ILibraryService serverService;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#region Contructor & global methods
|
||||
|
||||
public Nc_Demo()
|
||||
public Nc_Demo(String IpAddress, ushort RemotePort)
|
||||
{
|
||||
address =new EndpointAddress("http://localhost:8080/api/");
|
||||
Ip = IpAddress;
|
||||
Port = RemotePort;
|
||||
}
|
||||
|
||||
public override void Connect()
|
||||
{
|
||||
//Specify the address to be used for the client.
|
||||
// Create new connection to the demo server
|
||||
String url = "http://" + Ip + ":" + Port + "/api";
|
||||
serverAddress = new EndpointAddress(url);
|
||||
|
||||
cf = new ChannelFactory<ILibraryService>(new WebHttpBinding(), address);
|
||||
cf = new ChannelFactory<ILibraryService>(new WebHttpBinding(), serverAddress);
|
||||
cf.Endpoint.EndpointBehaviors.Add(new WebHttpBehavior());
|
||||
|
||||
channel = cf.CreateChannel();
|
||||
|
||||
serverService = cf.CreateChannel();
|
||||
|
||||
Connected = true;
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ namespace CMS_CORE.Demo
|
||||
{
|
||||
// Get datetime from Demo server
|
||||
string demoDateTime = "";
|
||||
channel.GetDateTime(out demoDateTime);
|
||||
serverService.GetDateTime(out demoDateTime);
|
||||
|
||||
ActualTime = Convert.ToDateTime(demoDateTime);
|
||||
}
|
||||
@@ -79,7 +82,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get serial number from Demo server
|
||||
channel.GetSerialNumber(out SN);
|
||||
serverService.GetSerialNumber(out SN);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -95,7 +98,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
try
|
||||
{
|
||||
channel.GetModel(out ModelName);
|
||||
serverService.GetModel(out ModelName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -111,7 +114,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get software version from Demo server
|
||||
channel.GetSoftwareVersion(out SWV);
|
||||
serverService.GetSoftwareVersion(out SWV);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -127,7 +130,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get machine number from Demo server
|
||||
channel.GetMachineNumber(out MachNumber);
|
||||
serverService.GetMachineNumber(out MachNumber);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -142,7 +145,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
try
|
||||
{ // Get Process Cout from Demo server
|
||||
channel.GetProcessNumber(out ProcNumber);
|
||||
serverService.GetProcessNumber(out ProcNumber);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -158,7 +161,7 @@ namespace CMS_CORE.Demo
|
||||
{
|
||||
// Get language from Demo server
|
||||
string demoLanguage = "";
|
||||
channel.GetLanguage(out demoLanguage);
|
||||
serverService.GetLanguage(out demoLanguage);
|
||||
|
||||
Language = ConverToSTEPLanguage(demoLanguage);
|
||||
}
|
||||
@@ -181,7 +184,7 @@ namespace CMS_CORE.Demo
|
||||
{
|
||||
List<NcAlarmModel> demoAlarms;
|
||||
// Get Alarms from server
|
||||
channel.GetProcessesAlarms(out demoAlarms);
|
||||
serverService.GetProcessesAlarms(out demoAlarms);
|
||||
|
||||
// Parse response
|
||||
foreach (NcAlarmModel demoAlarm in demoAlarms)
|
||||
@@ -208,7 +211,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get status from server
|
||||
channel.GetProcessStatus(ProcNumber.ToString(), out int demoStatus);
|
||||
serverService.GetProcessStatus(ProcNumber.ToString(), out int demoStatus);
|
||||
|
||||
Status = (PROC_Status)demoStatus;
|
||||
}
|
||||
@@ -226,7 +229,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get mode from server
|
||||
channel.GetProcessMode(ProcNumber.ToString(), out int demoMode);
|
||||
serverService.GetProcessMode(ProcNumber.ToString(), out int demoMode);
|
||||
|
||||
Mode = (PROC_Mode)demoMode;
|
||||
}
|
||||
@@ -243,7 +246,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
try
|
||||
{
|
||||
channel.GetProcessAlarms(ProcNumber.ToString(), out List<NcAlarmModel> demoAlarms);
|
||||
serverService.GetProcessAlarms(ProcNumber.ToString(), out List<NcAlarmModel> demoAlarms);
|
||||
|
||||
foreach (NcAlarmModel demoAlarm in demoAlarms)
|
||||
{
|
||||
@@ -268,7 +271,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get axes position from Demo Server
|
||||
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
|
||||
// Parse server response
|
||||
foreach(NcAxisModel demoAxis in demoAxes)
|
||||
@@ -290,7 +293,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get Axes Position from server
|
||||
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
// Parse server response and get programmed position
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
@@ -311,7 +314,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get Axes Position from server
|
||||
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
|
||||
// Parse Server response and get machine position
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
@@ -333,7 +336,7 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
// Get Axes position from Demo server
|
||||
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
// Parse response get distance to go
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
@@ -353,7 +356,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
try
|
||||
{
|
||||
channel.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
serverService.GetAxesPosition(ProcNumber.ToString(), out List<NcAxisModel> demoAxes);
|
||||
// Parse response get distance to go
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
@@ -383,7 +386,7 @@ namespace CMS_CORE.Demo
|
||||
// Read case: Read bit
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetBoolean(MemIndex.ToString(), MemBit.ToString(), out Value);
|
||||
serverService.GetBoolean(MemIndex.ToString(), MemBit.ToString(), out Value);
|
||||
}
|
||||
// Write case: write bit
|
||||
else
|
||||
@@ -407,14 +410,14 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetByte(MemIndex.ToString(), out Value);
|
||||
serverService.GetByte(MemIndex.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.binary = Value;
|
||||
channel.PutByte(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutByte(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -433,13 +436,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetWord(MemIndex.ToString(), out Value);
|
||||
serverService.GetWord(MemIndex.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.uWord = Value;
|
||||
channel.PutWord(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutWord(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -458,13 +461,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetShort(MemIndex.ToString(), out Value);
|
||||
serverService.GetShort(MemIndex.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.word = Value;
|
||||
channel.PutShort(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutShort(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -483,13 +486,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetDWord(MemIndex.ToString(), out Value);
|
||||
serverService.GetDWord(MemIndex.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.dWord = Value;
|
||||
channel.PutDWord(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutDWord(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -508,13 +511,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetInteger(MemIndex.ToString(), out Value);
|
||||
serverService.GetInteger(MemIndex.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.integer = Value;
|
||||
channel.PutInteger(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutInteger(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -538,13 +541,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetByteList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
serverService.GetByteList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.byteList = Value;
|
||||
channel.PutByteList(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutByteList(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -563,13 +566,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetWordList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
serverService.GetWordList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.wordList = Value;
|
||||
channel.PutWordList(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutWordList(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -588,13 +591,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetShortList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
serverService.GetShortList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.shortList = Value;
|
||||
channel.PutShortList(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutShortList(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -613,13 +616,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetIntegerList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
serverService.GetIntegerList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.integerList = Value;
|
||||
channel.PutIntegerList(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutIntegerList(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -638,13 +641,13 @@ namespace CMS_CORE.Demo
|
||||
// Read case
|
||||
if (bWrite == R)
|
||||
{
|
||||
channel.GetDWordList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
serverService.GetDWordList(MemIndex.ToString(), Number.ToString(), out Value);
|
||||
}
|
||||
else // Write case
|
||||
{
|
||||
BinaryMemoryModel binaryMemoryModel = new BinaryMemoryModel();
|
||||
binaryMemoryModel.dWordList = Value;
|
||||
channel.PutDWordList(MemIndex.ToString(), binaryMemoryModel);
|
||||
serverService.PutDWordList(MemIndex.ToString(), binaryMemoryModel);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
-5
@@ -77,11 +77,11 @@
|
||||
<Compile Include="Database\Models\NcAlarmModel.cs" />
|
||||
<Compile Include="Database\Models\NcAxisModel.cs" />
|
||||
<Compile Include="Database\Models\NcProcessModel.cs" />
|
||||
<Compile Include="DemoApplication.cs">
|
||||
<Compile Include="Views\DemoApplicationForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DemoApplication.Designer.cs">
|
||||
<DependentUpon>DemoApplication.cs</DependentUpon>
|
||||
<Compile Include="Views\DemoApplicationForm.Designer.cs">
|
||||
<DependentUpon>DemoApplicationForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Database\Models\NcDataModel.cs" />
|
||||
<Compile Include="Server\Service\ILibraryService.cs" />
|
||||
@@ -89,8 +89,14 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Server\ServerController.cs" />
|
||||
<EmbeddedResource Include="DemoApplication.resx">
|
||||
<DependentUpon>DemoApplication.cs</DependentUpon>
|
||||
<Compile Include="Views\StartupForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Views\StartupForm.Designer.cs">
|
||||
<DependentUpon>StartupForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Views\DemoApplicationForm.resx">
|
||||
<DependentUpon>DemoApplicationForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
@@ -102,6 +108,9 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Views\StartupForm.resx">
|
||||
<DependentUpon>StartupForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@@ -6,20 +6,20 @@ namespace Nc_Demo_Application
|
||||
{
|
||||
// Database configuration
|
||||
public static string RUNNING_PATH_DIR = AppDomain.CurrentDomain.BaseDirectory;
|
||||
public static string DATABASE_FILE_NAME = "Nc_Demo_Db.db";
|
||||
public const string DATABASE_FILE_NAME = "Nc_Demo_Db.db";
|
||||
|
||||
// Database query
|
||||
public static string READ_NC_DATA_QUERY = "SELECT * FROM nc_data";
|
||||
public static string READ_NC_PROCESS_QUERY = "SELECT * FROM process";
|
||||
public static string READ_NC_ALARMS_QUERY = "SELECT * FROM alarm";
|
||||
public static string READ_NC_AXES_QUERY = "SELECT * FROM axis";
|
||||
public static string READ_BINARY_MEMORY_QUERY = "SELECT * FROM binary_memory";
|
||||
public const string READ_NC_DATA_QUERY = "SELECT * FROM nc_data";
|
||||
public const string READ_NC_PROCESS_QUERY = "SELECT * FROM process";
|
||||
public const string READ_NC_ALARMS_QUERY = "SELECT * FROM alarm";
|
||||
public const string READ_NC_AXES_QUERY = "SELECT * FROM axis";
|
||||
public const string READ_BINARY_MEMORY_QUERY = "SELECT * FROM binary_memory";
|
||||
|
||||
|
||||
// Server configuration
|
||||
public static string SERVER_PORT = ":8080";
|
||||
public static string SERVER_IP_ADDRESS = "http://localhost";
|
||||
public static string API_URL = "/api";
|
||||
public const string SERVER_IP_ADDRESS = "http://localhost";
|
||||
public const string API_URL = "/api";
|
||||
|
||||
// CMS Process Status
|
||||
public enum PROC_STATUS : ushort { IDLE = 1, RUN = 2, HOLD = 3, ERROR = 4, RESET = 5, EMERG = 6 };
|
||||
|
||||
@@ -61,10 +61,12 @@ namespace Nc_Demo_Application.Database
|
||||
|
||||
public void ResetDatabase()
|
||||
{
|
||||
BinaryMemory.Clear();
|
||||
ncProcessDataTable.Clear();
|
||||
ncAlarmDataTable.Clear();
|
||||
ncAxesDataTable.Clear();
|
||||
BinaryMemory.Dispose();
|
||||
ncProcessDataTable.Dispose();
|
||||
ncAlarmDataTable.Dispose();
|
||||
ncAxesDataTable.Dispose();
|
||||
|
||||
sqlConnection.Close();
|
||||
}
|
||||
|
||||
public void ReadDataFromDatabase(string query, ref DataTable resultDataTable)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Nc_Demo_Application
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new NcDemoApplicationForm());
|
||||
Application.Run(new StartupForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Nc_Demo_Application.Server
|
||||
try
|
||||
{
|
||||
//Create Server Uri
|
||||
WebUri = new Uri(Constants.SERVER_IP_ADDRESS + Constants.SERVER_PORT + Constants.API_URL);
|
||||
WebUri = new Uri(Constants.SERVER_IP_ADDRESS + ":" + Constants.SERVER_PORT + Constants.API_URL);
|
||||
|
||||
//Create WebHost
|
||||
Console.WriteLine("RUNNING: Creating API Server on \"" + WebUri + "\"... ");
|
||||
|
||||
@@ -13,49 +13,48 @@ namespace Nc_Demo_Application.Server.Service
|
||||
[ServiceBehavior(MaxItemsInObjectGraph = int.MaxValue, InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
|
||||
class LibraryService : ILibraryService
|
||||
{
|
||||
private DatabaseController dbController = DatabaseController.getInstance();
|
||||
private NcDataModel ncDataData = new NcDataModel();
|
||||
|
||||
#region Nc Data API
|
||||
public void Name(out string name)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
name = ncDataData.name;
|
||||
}
|
||||
|
||||
public void DateTime(out string dateTime)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
dateTime = ncDataData.dateTime;
|
||||
}
|
||||
|
||||
public void Language(out string language)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
language = ncDataData.language;
|
||||
}
|
||||
|
||||
public void MachineNumber(out string machineNumber)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
machineNumber = ncDataData.machineNumber;
|
||||
}
|
||||
|
||||
public void Model(out string model)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
model = ncDataData.model;
|
||||
}
|
||||
|
||||
public void SerialNumber(out string serialNumber)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
serialNumber = ncDataData.serialNumber;
|
||||
}
|
||||
|
||||
public void SoftwareVersion(out string softwareVersion)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
ncDataData = DatabaseController.getInstance().GetNcData();
|
||||
softwareVersion = ncDataData.softwareVersion;
|
||||
}
|
||||
#endregion
|
||||
@@ -63,34 +62,34 @@ namespace Nc_Demo_Application.Server.Service
|
||||
#region Process API
|
||||
public void ProcessNumber(out ushort processNumber)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
List<NcProcessModel> ncProcessesData = DatabaseController.getInstance().GetNcProcesses();
|
||||
processNumber = (ushort)ncProcessesData.Count;
|
||||
}
|
||||
|
||||
public void ProcessStatus(string id, out int status)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
List<NcProcessModel> ncProcessesData = DatabaseController.getInstance().GetNcProcesses();
|
||||
status = ncProcessesData.Find(i => i.id == Convert.ToInt32(id)).status;
|
||||
}
|
||||
|
||||
public void ProcessMode(string id, out int mode)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
List<NcProcessModel> ncProcessesData = DatabaseController.getInstance().GetNcProcesses();
|
||||
mode = ncProcessesData.Find(i => i.id == Convert.ToInt32(id)).mode;
|
||||
}
|
||||
|
||||
public void ProcessAlarms(string id, out List<NcAlarmModel> alarms)
|
||||
{
|
||||
List<NcAlarmModel> ncAlarmsData = dbController.GetNcAlarms();
|
||||
List<NcAlarmModel> ncAlarmsData = DatabaseController.getInstance().GetNcAlarms();
|
||||
alarms = ncAlarmsData.FindAll(i => i.processId == Convert.ToInt32(id));
|
||||
}
|
||||
public void ProcessesAlarms(out List<NcAlarmModel> alarms)
|
||||
{
|
||||
alarms = dbController.GetNcAlarms();
|
||||
alarms = DatabaseController.getInstance().GetNcAlarms();
|
||||
}
|
||||
public void GetAxesActualPosition(string id, out List<NcAxisModel> axes)
|
||||
{
|
||||
List<NcAxisModel> ncAxesModel = dbController.GetNcAxes();
|
||||
List<NcAxisModel> ncAxesModel = DatabaseController.getInstance().GetNcAxes();
|
||||
axes = ncAxesModel.FindAll(i => i.processId == Convert.ToInt32(id));
|
||||
}
|
||||
|
||||
@@ -100,38 +99,38 @@ namespace Nc_Demo_Application.Server.Service
|
||||
|
||||
public void GetBoolean(string index, string bit, out bool value)
|
||||
{
|
||||
string binaryByte = dbController.GetBinaryByteValue(Convert.ToInt32(index));
|
||||
string binaryByte = DatabaseController.getInstance().GetBinaryByteValue(Convert.ToInt32(index));
|
||||
binaryByte = binaryByte.Substring(8 - Convert.ToInt32(bit + 1), 1);
|
||||
value = Convert.ToBoolean(binaryByte);
|
||||
}
|
||||
|
||||
public void GetByte(string index, out byte value)
|
||||
{
|
||||
value = dbController.GetByteValue(Convert.ToInt32(index));
|
||||
value = DatabaseController.getInstance().GetByteValue(Convert.ToInt32(index));
|
||||
}
|
||||
|
||||
public void GetWord(string index, out ushort value)
|
||||
{
|
||||
// Read Unsigned word
|
||||
value = Convert.ToUInt16(dbController.GetWordValue(Convert.ToInt32(index)), 2);
|
||||
value = Convert.ToUInt16(DatabaseController.getInstance().GetWordValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetShort(string index, out short value)
|
||||
{
|
||||
// Read signed Word
|
||||
value = Convert.ToInt16(dbController.GetWordValue(Convert.ToInt32(index)), 2);
|
||||
value = Convert.ToInt16(DatabaseController.getInstance().GetWordValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetDWord(string index, out uint value)
|
||||
{
|
||||
// Read Unsigned Integer
|
||||
value = Convert.ToUInt32(dbController.GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
value = Convert.ToUInt32(DatabaseController.getInstance().GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetInteger(string index, out int value)
|
||||
{
|
||||
// Read Signed Integer
|
||||
value = Convert.ToInt32(dbController.GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
value = Convert.ToInt32(DatabaseController.getInstance().GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void PutByte(string index, BinaryMemoryModel body)
|
||||
@@ -141,7 +140,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
// Edit byte
|
||||
dbController.PutByteValue(Convert.ToInt32(index), body.binary);
|
||||
DatabaseController.getInstance().PutByteValue(Convert.ToInt32(index), body.binary);
|
||||
}
|
||||
|
||||
public void PutWord(string index, BinaryMemoryModel body)
|
||||
@@ -151,7 +150,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutWordValue(Convert.ToInt32(index), body.uWord);
|
||||
DatabaseController.getInstance().PutWordValue(Convert.ToInt32(index), body.uWord);
|
||||
}
|
||||
|
||||
public void PutShort(string index, BinaryMemoryModel body)
|
||||
@@ -161,7 +160,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutShortValue(Convert.ToInt32(index), body.word);
|
||||
DatabaseController.getInstance().PutShortValue(Convert.ToInt32(index), body.word);
|
||||
}
|
||||
|
||||
public void PutInteger(string index, BinaryMemoryModel body)
|
||||
@@ -171,7 +170,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutIntegerValue(Convert.ToInt32(index), body.integer);
|
||||
DatabaseController.getInstance().PutIntegerValue(Convert.ToInt32(index), body.integer);
|
||||
}
|
||||
|
||||
public void PutDWord(string index, BinaryMemoryModel body)
|
||||
@@ -181,7 +180,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutDWordValue(Convert.ToInt32(index), body.dWord);
|
||||
DatabaseController.getInstance().PutDWordValue(Convert.ToInt32(index), body.dWord);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +193,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
byteList = new List<byte>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
byteList.Add(dbController.GetByteValue(idx + i));
|
||||
byteList.Add(DatabaseController.getInstance().GetByteValue(idx + i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +203,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
wordList = new List<ushort>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
wordList.Add(Convert.ToUInt16(dbController.GetWordValue(idx + i), 2));
|
||||
wordList.Add(Convert.ToUInt16(DatabaseController.getInstance().GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
wordList = new List<short>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
wordList.Add(Convert.ToInt16(dbController.GetWordValue(idx + i), 2));
|
||||
wordList.Add(Convert.ToInt16(DatabaseController.getInstance().GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +223,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
integerList = new List<int>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
integerList.Add(Convert.ToInt32(dbController.GetIntegerValue(idx + (4*i)), 2));
|
||||
integerList.Add(Convert.ToInt32(DatabaseController.getInstance().GetIntegerValue(idx + (4*i)), 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +233,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
dWordList = new List<uint>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
dWordList.Add(Convert.ToUInt32(dbController.GetWordValue(idx + i), 2));
|
||||
dWordList.Add(Convert.ToUInt32(DatabaseController.getInstance().GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +247,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (byte item in body.byteList)
|
||||
{
|
||||
dbController.PutByteValue(idx, item);
|
||||
DatabaseController.getInstance().PutByteValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +261,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (ushort item in body.wordList)
|
||||
{
|
||||
dbController.PutWordValue(idx, item);
|
||||
DatabaseController.getInstance().PutWordValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +275,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (short item in body.shortList)
|
||||
{
|
||||
dbController.PutShortValue(idx, item);
|
||||
DatabaseController.getInstance().PutShortValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +289,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (int item in body.shortList)
|
||||
{
|
||||
dbController.PutIntegerValue(idx, item);
|
||||
DatabaseController.getInstance().PutIntegerValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +303,7 @@ namespace Nc_Demo_Application.Server.Service
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (int item in body.dWordList)
|
||||
{
|
||||
dbController.PutIntegerValue(idx, item);
|
||||
DatabaseController.getInstance().PutIntegerValue(idx, item);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
+788
@@ -0,0 +1,788 @@
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
partial class DemoApplicationForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DemoApplicationForm));
|
||||
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.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.processNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.dateTimeTxb = new System.Windows.Forms.TextBox();
|
||||
this.softwareVersionTxb = new System.Windows.Forms.TextBox();
|
||||
this.languageTxb = new System.Windows.Forms.TextBox();
|
||||
this.serialNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.modelTxb = new System.Windows.Forms.TextBox();
|
||||
this.machineNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.ncNameTxb = new System.Windows.Forms.TextBox();
|
||||
this.ModelLabel = new System.Windows.Forms.Label();
|
||||
this.MachineNumLabel = new System.Windows.Forms.Label();
|
||||
this.NCNameLabel = new System.Windows.Forms.Label();
|
||||
this.processPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcProcessData = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncProcessGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ncProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncProcessNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncProcessStatusColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.ncProcessModeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.alarms = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip3 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcAlarmsButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncAlarmsGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ncAlarmCodeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmTextColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAxesPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip4 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcAxesButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncAxisGridView = new System.Windows.Forms.DataGridView();
|
||||
this.axisIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisActualColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisProgrammedColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisMachinePositionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisDistanceToGoColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisProcessColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.followErrorProcessColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.byteMemoryPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip2 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveBinaryMemoryButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.addRowsBinaryMemory = new System.Windows.Forms.ToolStripButton();
|
||||
this.deleteRowsBinaryMemory = new System.Windows.Forms.ToolStripButton();
|
||||
this.binaryMemoryGridView = new System.Windows.Forms.DataGridView();
|
||||
this.BinaryMemoryAddressColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryDecimalColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryBinaryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryWordColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryIntegerColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.serverStatusLabel = new System.Windows.Forms.Label();
|
||||
this.ncAxesSaveButton.SuspendLayout();
|
||||
this.ncDataPage.SuspendLayout();
|
||||
this.toolStrip5.SuspendLayout();
|
||||
this.processPage.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).BeginInit();
|
||||
this.alarms.SuspendLayout();
|
||||
this.toolStrip3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).BeginInit();
|
||||
this.ncAxesPage.SuspendLayout();
|
||||
this.toolStrip4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).BeginInit();
|
||||
this.byteMemoryPage.SuspendLayout();
|
||||
this.toolStrip2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// stopServer
|
||||
//
|
||||
this.stopServer.Location = new System.Drawing.Point(485, 454);
|
||||
this.stopServer.Name = "stopServer";
|
||||
this.stopServer.Size = new System.Drawing.Size(91, 30);
|
||||
this.stopServer.TabIndex = 1;
|
||||
this.stopServer.Text = "Stop";
|
||||
this.stopServer.UseVisualStyleBackColor = true;
|
||||
this.stopServer.Click += new System.EventHandler(this.StopServer_Click);
|
||||
//
|
||||
// ncAxesSaveButton
|
||||
//
|
||||
this.ncAxesSaveButton.Controls.Add(this.ncDataPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.processPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.alarms);
|
||||
this.ncAxesSaveButton.Controls.Add(this.ncAxesPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.byteMemoryPage);
|
||||
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, 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.label5);
|
||||
this.ncDataPage.Controls.Add(this.label4);
|
||||
this.ncDataPage.Controls.Add(this.label3);
|
||||
this.ncDataPage.Controls.Add(this.label2);
|
||||
this.ncDataPage.Controls.Add(this.label1);
|
||||
this.ncDataPage.Controls.Add(this.processNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.dateTimeTxb);
|
||||
this.ncDataPage.Controls.Add(this.softwareVersionTxb);
|
||||
this.ncDataPage.Controls.Add(this.languageTxb);
|
||||
this.ncDataPage.Controls.Add(this.serialNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.modelTxb);
|
||||
this.ncDataPage.Controls.Add(this.machineNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.ncNameTxb);
|
||||
this.ncDataPage.Controls.Add(this.ModelLabel);
|
||||
this.ncDataPage.Controls.Add(this.MachineNumLabel);
|
||||
this.ncDataPage.Controls.Add(this.NCNameLabel);
|
||||
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, 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.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
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.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(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: ";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
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;
|
||||
this.label5.Text = "Process N";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
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;
|
||||
this.label4.Text = "DateTime";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
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;
|
||||
this.label3.Text = "Software Version";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
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;
|
||||
this.label2.Text = "Language";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
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;
|
||||
this.label1.Text = "Serial Number";
|
||||
//
|
||||
// processNumberTxb
|
||||
//
|
||||
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, 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, 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, 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, 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, 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, 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, 109);
|
||||
this.ncNameTxb.Name = "ncNameTxb";
|
||||
this.ncNameTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.ncNameTxb.TabIndex = 38;
|
||||
//
|
||||
// ModelLabel
|
||||
//
|
||||
this.ModelLabel.AutoSize = true;
|
||||
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;
|
||||
this.ModelLabel.Text = "Model";
|
||||
//
|
||||
// MachineNumLabel
|
||||
//
|
||||
this.MachineNumLabel.AutoSize = true;
|
||||
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;
|
||||
this.MachineNumLabel.Text = "Machine Number";
|
||||
//
|
||||
// NCNameLabel
|
||||
//
|
||||
this.NCNameLabel.AutoSize = true;
|
||||
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;
|
||||
this.NCNameLabel.Text = "NC Name";
|
||||
//
|
||||
// processPage
|
||||
//
|
||||
this.processPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.processPage.Controls.Add(this.toolStrip1);
|
||||
this.processPage.Controls.Add(this.ncProcessGridView);
|
||||
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, 410);
|
||||
this.processPage.TabIndex = 1;
|
||||
this.processPage.Text = "Nc Process";
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcProcessData});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(3, 3);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(550, 25);
|
||||
this.toolStrip1.TabIndex = 9;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// saveNcProcessData
|
||||
//
|
||||
this.saveNcProcessData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcProcessData.Image = ((System.Drawing.Image)(resources.GetObject("saveNcProcessData.Image")));
|
||||
this.saveNcProcessData.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcProcessData.Name = "saveNcProcessData";
|
||||
this.saveNcProcessData.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcProcessData.Text = "Save";
|
||||
this.saveNcProcessData.Click += new System.EventHandler(this.SaveNcProcessData_Click);
|
||||
//
|
||||
// ncProcessGridView
|
||||
//
|
||||
this.ncProcessGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.ncProcessGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncProcessGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ncProcessIdColumn,
|
||||
this.ncProcessNameColumn,
|
||||
this.ncProcessStatusColumn,
|
||||
this.ncProcessModeColumn});
|
||||
this.ncProcessGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.ncProcessGridView.Name = "ncProcessGridView";
|
||||
this.ncProcessGridView.Size = new System.Drawing.Size(550, 386);
|
||||
this.ncProcessGridView.TabIndex = 4;
|
||||
this.ncProcessGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.ncProcessGridView_DataError);
|
||||
//
|
||||
// ncProcessIdColumn
|
||||
//
|
||||
this.ncProcessIdColumn.DataPropertyName = "id";
|
||||
this.ncProcessIdColumn.HeaderText = "Process Id";
|
||||
this.ncProcessIdColumn.Name = "ncProcessIdColumn";
|
||||
this.ncProcessIdColumn.ReadOnly = true;
|
||||
//
|
||||
// ncProcessNameColumn
|
||||
//
|
||||
this.ncProcessNameColumn.DataPropertyName = "name";
|
||||
this.ncProcessNameColumn.HeaderText = "Name";
|
||||
this.ncProcessNameColumn.Name = "ncProcessNameColumn";
|
||||
//
|
||||
// ncProcessStatusColumn
|
||||
//
|
||||
this.ncProcessStatusColumn.DataPropertyName = "status";
|
||||
this.ncProcessStatusColumn.HeaderText = "Status";
|
||||
this.ncProcessStatusColumn.Name = "ncProcessStatusColumn";
|
||||
this.ncProcessStatusColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ncProcessStatusColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// ncProcessModeColumn
|
||||
//
|
||||
this.ncProcessModeColumn.DataPropertyName = "mode";
|
||||
this.ncProcessModeColumn.HeaderText = "Mode";
|
||||
this.ncProcessModeColumn.Name = "ncProcessModeColumn";
|
||||
//
|
||||
// alarms
|
||||
//
|
||||
this.alarms.Controls.Add(this.toolStrip3);
|
||||
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, 410);
|
||||
this.alarms.TabIndex = 2;
|
||||
this.alarms.Text = "NC Alarms";
|
||||
this.alarms.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip3
|
||||
//
|
||||
this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcAlarmsButton});
|
||||
this.toolStrip3.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip3.Name = "toolStrip3";
|
||||
this.toolStrip3.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip3.TabIndex = 2;
|
||||
this.toolStrip3.Text = "toolStrip3";
|
||||
//
|
||||
// saveNcAlarmsButton
|
||||
//
|
||||
this.saveNcAlarmsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcAlarmsButton.Image = ((System.Drawing.Image)(resources.GetObject("saveNcAlarmsButton.Image")));
|
||||
this.saveNcAlarmsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcAlarmsButton.Name = "saveNcAlarmsButton";
|
||||
this.saveNcAlarmsButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcAlarmsButton.Text = "save";
|
||||
this.saveNcAlarmsButton.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click);
|
||||
//
|
||||
// ncAlarmsGridView
|
||||
//
|
||||
this.ncAlarmsGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.ncAlarmsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncAlarmsGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ncAlarmCodeColumn,
|
||||
this.ncAlarmProcessIdColumn,
|
||||
this.ncAlarmTextColumn,
|
||||
this.ncAlarmIdColumn});
|
||||
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(553, 386);
|
||||
this.ncAlarmsGridView.TabIndex = 0;
|
||||
//
|
||||
// ncAlarmCodeColumn
|
||||
//
|
||||
this.ncAlarmCodeColumn.DataPropertyName = "code";
|
||||
this.ncAlarmCodeColumn.HeaderText = "Code";
|
||||
this.ncAlarmCodeColumn.Name = "ncAlarmCodeColumn";
|
||||
//
|
||||
// ncAlarmProcessIdColumn
|
||||
//
|
||||
this.ncAlarmProcessIdColumn.DataPropertyName = "process_id";
|
||||
this.ncAlarmProcessIdColumn.HeaderText = "Process";
|
||||
this.ncAlarmProcessIdColumn.Name = "ncAlarmProcessIdColumn";
|
||||
this.ncAlarmProcessIdColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ncAlarmProcessIdColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// ncAlarmTextColumn
|
||||
//
|
||||
this.ncAlarmTextColumn.DataPropertyName = "text";
|
||||
this.ncAlarmTextColumn.FillWeight = 280F;
|
||||
this.ncAlarmTextColumn.HeaderText = "Text";
|
||||
this.ncAlarmTextColumn.Name = "ncAlarmTextColumn";
|
||||
//
|
||||
// ncAlarmIdColumn
|
||||
//
|
||||
this.ncAlarmIdColumn.DataPropertyName = "id";
|
||||
this.ncAlarmIdColumn.HeaderText = "Id";
|
||||
this.ncAlarmIdColumn.Name = "ncAlarmIdColumn";
|
||||
this.ncAlarmIdColumn.Visible = false;
|
||||
//
|
||||
// ncAxesPage
|
||||
//
|
||||
this.ncAxesPage.Controls.Add(this.toolStrip4);
|
||||
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, 410);
|
||||
this.ncAxesPage.TabIndex = 3;
|
||||
this.ncAxesPage.Text = "Axes";
|
||||
this.ncAxesPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip4
|
||||
//
|
||||
this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcAxesButton});
|
||||
this.toolStrip4.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip4.Name = "toolStrip4";
|
||||
this.toolStrip4.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip4.TabIndex = 53;
|
||||
this.toolStrip4.Text = "toolStrip4";
|
||||
//
|
||||
// saveNcAxesButton
|
||||
//
|
||||
this.saveNcAxesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcAxesButton.Image = ((System.Drawing.Image)(resources.GetObject("saveNcAxesButton.Image")));
|
||||
this.saveNcAxesButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcAxesButton.Name = "saveNcAxesButton";
|
||||
this.saveNcAxesButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcAxesButton.Text = "Save";
|
||||
this.saveNcAxesButton.Click += new System.EventHandler(this.SaveNcAxesButton_Click);
|
||||
//
|
||||
// ncAxisGridView
|
||||
//
|
||||
this.ncAxisGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.ncAxisGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncAxisGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.axisIdColumn,
|
||||
this.axisNameColumn,
|
||||
this.axisActualColumn,
|
||||
this.axisProgrammedColumn,
|
||||
this.axisMachinePositionColumn,
|
||||
this.axisDistanceToGoColumn,
|
||||
this.axisProcessColumn,
|
||||
this.followErrorProcessColumn});
|
||||
this.ncAxisGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.ncAxisGridView.Name = "ncAxisGridView";
|
||||
this.ncAxisGridView.Size = new System.Drawing.Size(550, 386);
|
||||
this.ncAxisGridView.TabIndex = 0;
|
||||
//
|
||||
// axisIdColumn
|
||||
//
|
||||
this.axisIdColumn.DataPropertyName = "id";
|
||||
this.axisIdColumn.HeaderText = "id";
|
||||
this.axisIdColumn.Name = "axisIdColumn";
|
||||
this.axisIdColumn.Visible = false;
|
||||
//
|
||||
// axisNameColumn
|
||||
//
|
||||
this.axisNameColumn.DataPropertyName = "name";
|
||||
this.axisNameColumn.HeaderText = "Name";
|
||||
this.axisNameColumn.MaxInputLength = 4;
|
||||
this.axisNameColumn.Name = "axisNameColumn";
|
||||
//
|
||||
// axisActualColumn
|
||||
//
|
||||
this.axisActualColumn.DataPropertyName = "actual";
|
||||
this.axisActualColumn.HeaderText = "Actual";
|
||||
this.axisActualColumn.Name = "axisActualColumn";
|
||||
//
|
||||
// axisProgrammedColumn
|
||||
//
|
||||
this.axisProgrammedColumn.DataPropertyName = "programmed";
|
||||
this.axisProgrammedColumn.HeaderText = "Programmed";
|
||||
this.axisProgrammedColumn.Name = "axisProgrammedColumn";
|
||||
//
|
||||
// axisMachinePositionColumn
|
||||
//
|
||||
this.axisMachinePositionColumn.DataPropertyName = "machine_position";
|
||||
this.axisMachinePositionColumn.HeaderText = "Machine Position";
|
||||
this.axisMachinePositionColumn.Name = "axisMachinePositionColumn";
|
||||
//
|
||||
// axisDistanceToGoColumn
|
||||
//
|
||||
this.axisDistanceToGoColumn.DataPropertyName = "distance_to_go";
|
||||
this.axisDistanceToGoColumn.HeaderText = "Distance to go";
|
||||
this.axisDistanceToGoColumn.Name = "axisDistanceToGoColumn";
|
||||
//
|
||||
// axisProcessColumn
|
||||
//
|
||||
this.axisProcessColumn.DataPropertyName = "process_id";
|
||||
this.axisProcessColumn.HeaderText = "Process";
|
||||
this.axisProcessColumn.Name = "axisProcessColumn";
|
||||
//
|
||||
// followErrorProcessColumn
|
||||
//
|
||||
this.followErrorProcessColumn.DataPropertyName = "following_error";
|
||||
this.followErrorProcessColumn.HeaderText = "Following Error";
|
||||
this.followErrorProcessColumn.Name = "followErrorProcessColumn";
|
||||
//
|
||||
// byteMemoryPage
|
||||
//
|
||||
this.byteMemoryPage.Controls.Add(this.toolStrip2);
|
||||
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, 410);
|
||||
this.byteMemoryPage.TabIndex = 4;
|
||||
this.byteMemoryPage.Text = "Byte Memory";
|
||||
this.byteMemoryPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip2
|
||||
//
|
||||
this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveBinaryMemoryButton,
|
||||
this.addRowsBinaryMemory,
|
||||
this.deleteRowsBinaryMemory});
|
||||
this.toolStrip2.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip2.Name = "toolStrip2";
|
||||
this.toolStrip2.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip2.TabIndex = 1;
|
||||
this.toolStrip2.Text = "toolStrip2";
|
||||
//
|
||||
// saveBinaryMemoryButton
|
||||
//
|
||||
this.saveBinaryMemoryButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveBinaryMemoryButton.Image = ((System.Drawing.Image)(resources.GetObject("saveBinaryMemoryButton.Image")));
|
||||
this.saveBinaryMemoryButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveBinaryMemoryButton.Name = "saveBinaryMemoryButton";
|
||||
this.saveBinaryMemoryButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveBinaryMemoryButton.Text = "Save";
|
||||
this.saveBinaryMemoryButton.Click += new System.EventHandler(this.SaveBinaryMemory_Click);
|
||||
//
|
||||
// addRowsBinaryMemory
|
||||
//
|
||||
this.addRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.addRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("addRowsBinaryMemory.Image")));
|
||||
this.addRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.addRowsBinaryMemory.Name = "addRowsBinaryMemory";
|
||||
this.addRowsBinaryMemory.Size = new System.Drawing.Size(23, 22);
|
||||
this.addRowsBinaryMemory.Text = "toolStripButton1";
|
||||
this.addRowsBinaryMemory.Click += new System.EventHandler(this.addRowsBinaryMemory_Click);
|
||||
//
|
||||
// deleteRowsBinaryMemory
|
||||
//
|
||||
this.deleteRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.deleteRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("deleteRowsBinaryMemory.Image")));
|
||||
this.deleteRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.deleteRowsBinaryMemory.Name = "deleteRowsBinaryMemory";
|
||||
this.deleteRowsBinaryMemory.Size = new System.Drawing.Size(23, 22);
|
||||
this.deleteRowsBinaryMemory.Text = "toolStripButton1";
|
||||
this.deleteRowsBinaryMemory.Click += new System.EventHandler(this.deleteRowsBinaryMemory_Click);
|
||||
//
|
||||
// binaryMemoryGridView
|
||||
//
|
||||
this.binaryMemoryGridView.AllowUserToAddRows = false;
|
||||
this.binaryMemoryGridView.AllowUserToDeleteRows = false;
|
||||
this.binaryMemoryGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.binaryMemoryGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.binaryMemoryGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.BinaryMemoryAddressColumn,
|
||||
this.BinaryMemoryDecimalColumn,
|
||||
this.BinaryMemoryBinaryColumn,
|
||||
this.BinaryMemoryWordColumn,
|
||||
this.BinaryMemoryIntegerColumn});
|
||||
this.binaryMemoryGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.binaryMemoryGridView.Name = "binaryMemoryGridView";
|
||||
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);
|
||||
//
|
||||
// BinaryMemoryAddressColumn
|
||||
//
|
||||
this.BinaryMemoryAddressColumn.DataPropertyName = "address";
|
||||
this.BinaryMemoryAddressColumn.HeaderText = "Byte Address";
|
||||
this.BinaryMemoryAddressColumn.Name = "BinaryMemoryAddressColumn";
|
||||
this.BinaryMemoryAddressColumn.ReadOnly = true;
|
||||
//
|
||||
// BinaryMemoryDecimalColumn
|
||||
//
|
||||
this.BinaryMemoryDecimalColumn.DataPropertyName = "value";
|
||||
this.BinaryMemoryDecimalColumn.HeaderText = "Decimal";
|
||||
this.BinaryMemoryDecimalColumn.Name = "BinaryMemoryDecimalColumn";
|
||||
//
|
||||
// BinaryMemoryBinaryColumn
|
||||
//
|
||||
this.BinaryMemoryBinaryColumn.DataPropertyName = "binary";
|
||||
this.BinaryMemoryBinaryColumn.HeaderText = "Binary";
|
||||
this.BinaryMemoryBinaryColumn.MaxInputLength = 200;
|
||||
this.BinaryMemoryBinaryColumn.Name = "BinaryMemoryBinaryColumn";
|
||||
//
|
||||
// BinaryMemoryWordColumn
|
||||
//
|
||||
this.BinaryMemoryWordColumn.DataPropertyName = "word";
|
||||
this.BinaryMemoryWordColumn.HeaderText = "Word";
|
||||
this.BinaryMemoryWordColumn.Name = "BinaryMemoryWordColumn";
|
||||
//
|
||||
// BinaryMemoryIntegerColumn
|
||||
//
|
||||
this.BinaryMemoryIntegerColumn.DataPropertyName = "integer";
|
||||
this.BinaryMemoryIntegerColumn.HeaderText = "Integer";
|
||||
this.BinaryMemoryIntegerColumn.Name = "BinaryMemoryIntegerColumn";
|
||||
//
|
||||
// serverStatusLabel
|
||||
//
|
||||
this.serverStatusLabel.AutoEllipsis = true;
|
||||
this.serverStatusLabel.AutoSize = true;
|
||||
this.serverStatusLabel.Location = new System.Drawing.Point(16, 463);
|
||||
this.serverStatusLabel.Name = "serverStatusLabel";
|
||||
this.serverStatusLabel.Size = new System.Drawing.Size(0, 13);
|
||||
this.serverStatusLabel.TabIndex = 4;
|
||||
//
|
||||
// DemoApplicationForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(586, 496);
|
||||
this.Controls.Add(this.serverStatusLabel);
|
||||
this.Controls.Add(this.ncAxesSaveButton);
|
||||
this.Controls.Add(this.stopServer);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "DemoApplicationForm";
|
||||
this.Text = "Nc Demo Application";
|
||||
this.Load += new System.EventHandler(this.DemoApplicationForm_Load);
|
||||
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);
|
||||
this.toolStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).EndInit();
|
||||
this.alarms.ResumeLayout(false);
|
||||
this.alarms.PerformLayout();
|
||||
this.toolStrip3.ResumeLayout(false);
|
||||
this.toolStrip3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).EndInit();
|
||||
this.ncAxesPage.ResumeLayout(false);
|
||||
this.ncAxesPage.PerformLayout();
|
||||
this.toolStrip4.ResumeLayout(false);
|
||||
this.toolStrip4.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).EndInit();
|
||||
this.byteMemoryPage.ResumeLayout(false);
|
||||
this.byteMemoryPage.PerformLayout();
|
||||
this.toolStrip2.ResumeLayout(false);
|
||||
this.toolStrip2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Button stopServer;
|
||||
private System.Windows.Forms.TabControl ncAxesSaveButton;
|
||||
private System.Windows.Forms.TabPage processPage;
|
||||
private System.Windows.Forms.TabPage ncDataPage;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox processNumberTxb;
|
||||
private System.Windows.Forms.TextBox softwareVersionTxb;
|
||||
private System.Windows.Forms.TextBox languageTxb;
|
||||
private System.Windows.Forms.TextBox serialNumberTxb;
|
||||
private System.Windows.Forms.TextBox modelTxb;
|
||||
private System.Windows.Forms.TextBox machineNumberTxb;
|
||||
private System.Windows.Forms.TextBox ncNameTxb;
|
||||
private System.Windows.Forms.Label ModelLabel;
|
||||
private System.Windows.Forms.Label MachineNumLabel;
|
||||
private System.Windows.Forms.Label NCNameLabel;
|
||||
private System.Windows.Forms.TextBox dateTimeTxb;
|
||||
private System.Windows.Forms.TabPage alarms;
|
||||
private System.Windows.Forms.DataGridView ncAlarmsGridView;
|
||||
private System.Windows.Forms.TabPage ncAxesPage;
|
||||
private System.Windows.Forms.DataGridView ncAxisGridView;
|
||||
private System.Windows.Forms.DataGridView ncProcessGridView;
|
||||
private System.Windows.Forms.TabPage byteMemoryPage;
|
||||
private System.Windows.Forms.DataGridView binaryMemoryGridView;
|
||||
private System.Windows.Forms.ToolStrip toolStrip3;
|
||||
private System.Windows.Forms.ToolStripButton saveNcAlarmsButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip4;
|
||||
private System.Windows.Forms.ToolStripButton saveNcAxesButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip2;
|
||||
private System.Windows.Forms.ToolStripButton saveBinaryMemoryButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripButton saveNcProcessData;
|
||||
private System.Windows.Forms.ToolStripButton addRowsBinaryMemory;
|
||||
private System.Windows.Forms.ToolStripButton deleteRowsBinaryMemory;
|
||||
private System.Windows.Forms.ToolStrip toolStrip5;
|
||||
private System.Windows.Forms.ToolStripButton saveNcDataButton;
|
||||
private System.Windows.Forms.Label serverStatusLabel;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisNameColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisActualColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisProgrammedColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisMachinePositionColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisDistanceToGoColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisProcessColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn followErrorProcessColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessNameColumn;
|
||||
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessStatusColumn;
|
||||
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessModeColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryAddressColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryDecimalColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryBinaryColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryWordColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryIntegerColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmCodeColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmProcessIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmTextColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmIdColumn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
using Nc_Demo_Application.Database;
|
||||
using Nc_Demo_Application.Database.Models;
|
||||
using Nc_Demo_Application.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
public partial class DemoApplicationForm : Form
|
||||
{
|
||||
public DemoApplicationForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void DemoApplicationForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// Start http server
|
||||
ServerController.getInstance().Run();
|
||||
|
||||
// Populate process model and status ComboBox
|
||||
ncProcessModeColumn.DataSource = Enum.GetValues(typeof(PROC_MODE));
|
||||
ncProcessStatusColumn.DataSource = Enum.GetValues(typeof(PROC_STATUS));
|
||||
|
||||
// Read data from database
|
||||
FillNcDataInput();
|
||||
FillNcProcessInput();
|
||||
FillNcAlarmsInput();
|
||||
FillNAxisInput();
|
||||
FillBinaryMemoryInput();
|
||||
|
||||
serverStatusLabel.Text = "Server running on: http://localhost:" + SERVER_PORT + API_URL;
|
||||
}
|
||||
|
||||
private void StopServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Stop Server
|
||||
ServerController.getInstance().Stop();
|
||||
// Reset button status
|
||||
DatabaseController.getInstance().ResetDatabase();
|
||||
|
||||
StartupForm startupForm = new StartupForm();
|
||||
// Close form
|
||||
Close();
|
||||
startupForm.Show();
|
||||
}
|
||||
|
||||
private void FillNcDataInput()
|
||||
{
|
||||
// ReadData from database
|
||||
NcDataModel ncData = DatabaseController.getInstance().ReadNcData();
|
||||
|
||||
// Update user NcData input
|
||||
ncNameTxb.Text = ncData.name;
|
||||
serialNumberTxb.Text = ncData.serialNumber;
|
||||
modelTxb.Text = ncData.model;
|
||||
languageTxb.Text = ncData.language;
|
||||
softwareVersionTxb.Text = ncData.softwareVersion;
|
||||
dateTimeTxb.Text = ncData.dateTime;
|
||||
machineNumberTxb.Text = ncData.machineNumber;
|
||||
processNumberTxb.Text = ncData.processCount.ToString();
|
||||
}
|
||||
|
||||
private void FillNcProcessInput()
|
||||
{
|
||||
// Insert processes' data into Grid View
|
||||
DataTable ncProcesses = DatabaseController.getInstance().ReadNcProcesses();
|
||||
ncProcessGridView.DataSource = ncProcesses;
|
||||
}
|
||||
|
||||
private void FillNcAlarmsInput()
|
||||
{
|
||||
// Insert alarms' data into Grid View
|
||||
DataTable ncAlarmsData = DatabaseController.getInstance().ReadNcAlarms();
|
||||
ncAlarmsGridView.DataSource = ncAlarmsData;
|
||||
}
|
||||
|
||||
private void FillNAxisInput()
|
||||
{
|
||||
// Insert axes' data into Grid View
|
||||
DataTable ncAxisData = DatabaseController.getInstance().ReadNcAxes();
|
||||
ncAxisGridView.DataSource = ncAxisData;
|
||||
}
|
||||
|
||||
private void FillBinaryMemoryInput()
|
||||
{
|
||||
DataTable binaryMemoryData = DatabaseController.getInstance().ReadBinaryMemory();
|
||||
binaryMemoryGridView.DataSource = binaryMemoryData;
|
||||
}
|
||||
|
||||
private void SaveCnDataButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
NcDataModel ncData = new NcDataModel();
|
||||
|
||||
// Read data from user NcData input
|
||||
ncData.name = ncNameTxb.Text;
|
||||
ncData.model = modelTxb.Text;
|
||||
ncData.serialNumber = serialNumberTxb.Text;
|
||||
ncData.machineNumber = machineNumberTxb.Text;
|
||||
ncData.dateTime = dateTimeTxb.Text;
|
||||
ncData.processCount = Convert.ToInt32(processNumberTxb.Text);
|
||||
ncData.softwareVersion = softwareVersionTxb.Text;
|
||||
ncData.language = languageTxb.Text;
|
||||
|
||||
// Update user data
|
||||
DatabaseController.getInstance().UpdateNcData(ncData);
|
||||
}
|
||||
|
||||
private void SaveNcProcessData_Click(object sender, EventArgs e)
|
||||
{
|
||||
DatabaseController.getInstance().UpdateNcProcess((DataTable)ncProcessGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveNcAlarmsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DatabaseController.getInstance().UpdateNcAlarms((DataTable)ncAlarmsGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveNcAxesButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DatabaseController.getInstance().UpdateNcAxes((DataTable)ncAxisGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveBinaryMemory_Click(object sender, EventArgs e)
|
||||
{
|
||||
DatabaseController.getInstance().UpdateBinaryMemory((DataTable)binaryMemoryGridView.DataSource);
|
||||
}
|
||||
|
||||
private void ncProcessGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
||||
{
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
private void BinaryMemoryGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
// Remove startup change
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
// Get cells ref
|
||||
var binaryCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryBinaryColumn"];
|
||||
var decimalCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryDecimalColumn"];
|
||||
|
||||
// If decimal value is changed, by user or programmatically, update all the row cells
|
||||
if (e.ColumnIndex == 1)
|
||||
{
|
||||
// Update binary cell
|
||||
string binaryValue = Convert.ToString(Convert.ToInt32(decimalCell.Value.ToString(), 10), 2).PadLeft(8, '0'); ;
|
||||
if (Convert.ToInt32(decimalCell.Value) < 0)
|
||||
binaryValue = binaryValue.Substring(Math.Max(binaryValue.Length - 8, 0));
|
||||
binaryCell.Value = binaryValue;
|
||||
|
||||
// Update Next Word cell
|
||||
// Find next word index to be updated and which byte of the word replace
|
||||
int nextWordPos = (e.RowIndex + 1) % 2;
|
||||
int stringIndexToReplace = 8 * nextWordPos;
|
||||
|
||||
// Get the word ref
|
||||
var wordCell = binaryMemoryGridView.Rows[e.RowIndex + nextWordPos].Cells["BinaryMemoryWordColumn"];
|
||||
// Get binary value of the word
|
||||
string binaryWordCellValue = Convert.ToString(Convert.ToInt16(wordCell.Value.ToString(), 10), 2).PadLeft(16, '0');
|
||||
// Replace with the new value
|
||||
binaryWordCellValue = binaryWordCellValue.Remove(stringIndexToReplace, 8).Insert(stringIndexToReplace, binaryValue);
|
||||
// Update cell
|
||||
wordCell.Value = Convert.ToInt16(binaryWordCellValue, 2).ToString();
|
||||
|
||||
// Update next integer cell
|
||||
// Find next integer index to be updated
|
||||
// nextIntegerPos = max position next integer - edited row position
|
||||
int nextIntegerPos = 3 - (e.RowIndex % 4);
|
||||
// Find which byte of the integer replace
|
||||
stringIndexToReplace = 8 * nextIntegerPos;
|
||||
// Get the word ref
|
||||
var integerCell = binaryMemoryGridView.Rows[e.RowIndex + nextIntegerPos].Cells["BinaryMemoryIntegerColumn"];
|
||||
// Get binary value of the word
|
||||
string binaryIntegerCellValue = Convert.ToString(Convert.ToInt32(integerCell.Value.ToString(), 10), 2).PadLeft(32, '0');
|
||||
// Replace edited byte with the new value
|
||||
binaryIntegerCellValue = binaryIntegerCellValue.Remove(stringIndexToReplace, 8).Insert(stringIndexToReplace, binaryValue);
|
||||
// Update cell
|
||||
integerCell.Value = Convert.ToInt32(binaryIntegerCellValue, 2).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BinaryMemoryGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
var decimalCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryDecimalColumn"];
|
||||
|
||||
// Find which column user has changed
|
||||
switch (e.ColumnIndex)
|
||||
{
|
||||
// Case: user change binary column
|
||||
case 2:
|
||||
{
|
||||
var binaryCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryBinaryColumn"];
|
||||
// Update decimal Value
|
||||
decimalCell.Value = Convert.ToSByte(binaryCell.Value.ToString(), 2);
|
||||
// Insert zeros up to a lenght of 8
|
||||
binaryCell.Value = binaryCell.Value.ToString().PadLeft(8, '0');
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
var wordCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryWordColumn"];
|
||||
// Convert integer word into a binary string (0-15)
|
||||
string binary = Convert.ToString(Convert.ToInt32(wordCell.Value.ToString(), 10), 2).PadLeft(16, '0');
|
||||
|
||||
// Set the current edited current row value with the first half of the binary string (0-8)
|
||||
decimalCell.Value = Convert.ToByte(binary.Substring(0, 8), 2);
|
||||
|
||||
// Set the previus row value with the second half of the binary string (8-15)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 1].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(8, 8), 2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
var integerCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryIntegerColumn"];
|
||||
// Convert integer word into a binary string (0-32)
|
||||
string binary = Convert.ToString(Convert.ToInt32(integerCell.Value.ToString(), 10), 2).PadLeft(32, '0');
|
||||
|
||||
// Set the current edited current row value with the first part of the binary string (0-8)
|
||||
decimalCell.Value = Convert.ToByte(binary.Substring(0, 8), 2);
|
||||
|
||||
// Set the -1 row value with the second part of the binary string (8-15)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 1].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(8, 8), 2);
|
||||
|
||||
// Set the -2 row value with the third pard of the binary string (16-23)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 2].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(16, 8), 2);
|
||||
|
||||
// Set the -3 row value with the fourth part of the binary string (24-31)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 3].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(24, 8), 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void addRowsBinaryMemory_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataTable dt = binaryMemoryGridView.DataSource as DataTable;
|
||||
//Create new 4 rows with empty value
|
||||
int startAddress = binaryMemoryGridView.RowCount;
|
||||
|
||||
//Populate the rows with data
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
DataRow row = dt.NewRow();
|
||||
|
||||
row["address"] = startAddress + i;
|
||||
row["value"] = 0;
|
||||
row["binary"] = "00000000";
|
||||
|
||||
// Every 2 row set word value
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
row["word"] = 0;
|
||||
}
|
||||
// Every 4 row set integer value
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
row["integer"] = 0;
|
||||
}
|
||||
|
||||
//Add the row to data table
|
||||
dt.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
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--)
|
||||
{
|
||||
binaryMemoryGridView.Rows.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+76
@@ -0,0 +1,76 @@
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
partial class StartupForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StartupForm));
|
||||
this.serverPort = new System.Windows.Forms.TextBox();
|
||||
this.startServer = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// serverPort
|
||||
//
|
||||
this.serverPort.Location = new System.Drawing.Point(12, 40);
|
||||
this.serverPort.MaxLength = 5;
|
||||
this.serverPort.Name = "serverPort";
|
||||
this.serverPort.Size = new System.Drawing.Size(150, 20);
|
||||
this.serverPort.TabIndex = 0;
|
||||
this.serverPort.Text = "8080";
|
||||
this.serverPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// startServer
|
||||
//
|
||||
this.startServer.Location = new System.Drawing.Point(12, 155);
|
||||
this.startServer.Name = "startServer";
|
||||
this.startServer.Size = new System.Drawing.Size(150, 64);
|
||||
this.startServer.TabIndex = 1;
|
||||
this.startServer.Text = "Start Demo Server";
|
||||
this.startServer.UseVisualStyleBackColor = true;
|
||||
this.startServer.Click += new System.EventHandler(this.startServer_Click);
|
||||
//
|
||||
// Startup
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(174, 262);
|
||||
this.Controls.Add(this.startServer);
|
||||
this.Controls.Add(this.serverPort);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "Startup";
|
||||
this.Text = "Startup";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox serverPort;
|
||||
private System.Windows.Forms.Button startServer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
|
||||
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
public partial class StartupForm : Form
|
||||
{
|
||||
public StartupForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void startServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
SERVER_PORT = serverPort.Text;
|
||||
Hide();
|
||||
DemoApplicationForm serverForm = new DemoApplicationForm();
|
||||
serverForm.Show();
|
||||
serverForm.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
54262f7fb30151a95c96fbd0e2851c87bdd4e629
|
||||
7b1ab503ade871757e5ea55988138537112eedfa
|
||||
|
||||
+2
-1
@@ -32,9 +32,10 @@ C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\b
|
||||
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
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.DemoApplicationForm.resources
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.StartupForm.resources
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user