Files
cms-core-active/CMS_CORE_Application/Form1.cs
T
Lucio Maranta 8474d98967 New feature:
- Added new form where user can insert a custom port.
- Added custom ip in the demo constructor
Fixed minor problems
2017-11-07 15:38:15 +00:00

73 lines
1.9 KiB
C#

using CMS_CORE;
using CMS_CORE.Exceptions;
using CMS_CORE.Osai;
using CMS_CORE.Demo;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CMS_CORE_Application
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
SKGL.SerialKeyConfiguration conf = new SKGL.SerialKeyConfiguration();
conf.Features[0] = true;
SKGL.Generate gg = new SKGL.Generate(conf);
gg.secretPhase = "test";
string ss = gg.doKey(999);
SKGL.Validate vv = new SKGL.Validate(conf);
vv.secretPhase = "test";
vv.Key = ss;
Boolean tt= vv.IsValid;
Nc N = new Nc_Osai("192.168.157.2", 8080, 2);
try
{
N.Connect();
}
catch(Nc_Exception e)
{
MessageBox.Show(e.Message);
}
}
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);
}
}
}
}