Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
RemoteTest.cs
Go to the documentation of this file.
1using System;
2using System.ServiceModel;
3using System.Windows.Forms;
4
6{
10 public partial class MessageTesterForm : Form
11 {
13 {
14 InitializeComponent();
15 }
16
18
23 {
24 get
25 {
26 if (mService == null)
27 {
28 var endpoint = new EndpointAddress(EndpointDef.Endpoint);
29 mService = ChannelFactory<IMockPlugin>.CreateChannel(new NetTcpBinding(), endpoint);
30 }
31 return mService;
32 }
33 }
34
40 private void tbMessage_KeyDown(object sender, KeyEventArgs e)
41 {
42 if (e.KeyCode == Keys.Enter)
43 {
44 try
45 {
46 var retval = Service.DoSomething(tbMessage.Text);
47 lvRequests.Items.Add(string.Format("Request {0}: Result {1}",tbMessage.Text, retval));
48 }
49 catch (Exception ex)
50 {
51 MessageBox.Show("Error accessing plugin: " + ex.Message);
52 }
53 }
54 }
55
56 }
57}
Interaction with Chronos crossing the process barrier. A normal Chronos plugin is a class library loa...
Very basic service, only to show that you can trigger some action from outside and get a response.
bool DoSomething(string someParameter)
To avoid duplicating the endpoint definition in server and client.
Shows how to communicate from an external program with a Plugin in order to trigger actions in Chrono...
Definition RemoteTest.cs:11
IMockPlugin Service
Get the service when it is needed for the first time.
Definition RemoteTest.cs:23
void tbMessage_KeyDown(object sender, KeyEventArgs e)
When enter is pressed, send our parameter to the plugin provided service and show the result.
Definition RemoteTest.cs:40