private void ConnectRemoteObject() { if (mfcctype == "VD") { robj = (I_MFCC_VD)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_VD), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_VD")); } else if (mfcctype == "RGS") { robj = (I_MFCC_RGS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_RGS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_RGS")); } else if (mfcctype == "CMS") { robj = (I_MFCC_CMS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_CMS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_CMS")); } else if (mfcctype == "WIS") { robj = (I_MFCC_WIS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_WIS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_WIS")); } else if (mfcctype == "RMS") { robj = (I_MFCC_RMS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_RMS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_RMS")); } else if (mfcctype == "LCS") { robj = (I_MFCC_LCS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_LCS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_LCS")); } else if (mfcctype == "CSLS") { robj = (I_MFCC_CSLS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_CSLS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_CSLS")); } else if (mfcctype == "AVI") { robj = (I_MFCC_AVI)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_AVI), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_AVI")); } else if (mfcctype == "RD") { robj = (I_MFCC_RD)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_RD), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_RD")); } else if (mfcctype == "VI") { robj = (I_MFCC_VI)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_VI), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_VI")); } else if (mfcctype == "WD") { robj = (I_MFCC_WD)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_WD), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_WD")); } else if (mfcctype == "TTS") { robj = (I_MFCC_TTS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_TTS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_TTS")); } else if (mfcctype == "FS") { robj = (I_MFCC_FS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_FS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_FS")); } else if (mfcctype == "MAS") { robj = (I_MFCC_MAS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_MAS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_MAS")); } else if (mfcctype == "IID") { robj = (I_MFCC_IID)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_IID), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_IID")); } else if (mfcctype == "ETTU") { robj = (I_MFCC_ETTU)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_ETTU), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_ETTU")); } else if (mfcctype == "LS") { robj = (I_MFCC_LS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_LS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_LS")); } else if (mfcctype == "TEM") { robj = (I_MFCC_TEM)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_TEM), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_TEM")); } else if (mfcctype == "SCM") { robj = (I_MFCC_TEM)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_TEM), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_SCM")); } else if (mfcctype == "CMSRST") { robj = (I_MFCC_CMSRST)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_CMSRST), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_CMSRST")); } else if (mfcctype == "BS") { robj = (I_MFCC_BS)RemoteBuilder.GetRemoteObj(typeof(I_MFCC_BS), RemoteBuilder.getRemoteUri(hostip, remoteport, "MFCC_BS")); } }
private void Form2_Shown(object sender, EventArgs e) { try { if (mfccid.StartsWith("MFCC_VD")) mfccid = "MFCC_VD"; else if (mfccid.StartsWith("MFCC_CMS")) mfccid = "MFCC_CMS"; else if (mfccid.StartsWith("MFCC_CSLS")) mfccid = "MFCC_CSLS"; robj = (RemoteInterface.MFCC.I_MFCC_Base)RemoteInterface.RemoteBuilder.GetRemoteObj(typeof(RemoteInterface.MFCC.I_MFCC_Base), RemoteInterface.RemoteBuilder.getRemoteUri(ip, port + 1000, mfccid)); robj.setDeviceCommMointer(devName,true); this.nclient = new RemoteInterface.EventNotifyClient(ip, port - 5000, false); nclient.OnConnect += new RemoteInterface.OnConnectEventHandler(nclient_OnConnect); } catch (Exception ex) { MessageBox.Show(ex.Message); try { this.Close(); this.Dispose(); } catch (Exception ex1) { MessageBox.Show(ex1.Message); } } }
void tmr1min_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (robj == null) return; if (isIntmr1min) return; try { isIntmr1min = true; ((RemoteClassBase)robj).HelloWorld(); } catch { robj = null; new System.Threading.Thread(RemoteObjectConnectTask).Start(); ;} finally { isIntmr1min = false; } //throw new Exception("The method or operation is not implemented."); }