1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
-
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Runtime.InteropServices;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Channels.Ipc;
- using OTSMeasureApp.ServiceCenter;
- namespace ServiceInterface
- {
- public class SemController
- {
-
- //[DllImport("user32.dll", EntryPoint = "SendMessage")]
- //private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
- private IpcSEMController remoteObj;
- public SemController()
- {
-
-
- }
- public bool Connect()
- {
- IpcClientChannel channel = new IpcClientChannel();
- //Register the channel with ChannelServices.
- ChannelServices.RegisterChannel(channel, false);
- remoteObj = (IpcSEMController)Activator.GetObject(typeof(IpcSEMController), "ipc://ServerChannel/RemoteObject");
-
- if (remoteObj == null)
- {
- return false;
-
- }
- return true;
- }
- public bool DisConnect()
- {
- remoteObj = null;
- return true;
- }
- public bool MoveSEMToPoint(Point poi, double rotation)
- {
- //Connect();
- if (remoteObj == null)
- {
- return false;
- }
- return remoteObj.MoveSEMToPoint(poi , rotation);
- }
- public bool GetSemPositionXY(ref double ls_PositionX, ref double ls_PositionY, ref double ls_PositionR)
- {
- //Connect();
- if (remoteObj == null)
- {
- return false;
- }
- return remoteObj.GetSemPositionXY(ref ls_PositionX,ref ls_PositionY, ref ls_PositionR);
- }
-
- }
- }
|