"景先生毕设|www.jxszl.com

C# BusAttachment类代码示例

2023-12-29 17:36编辑: www.jxszl.com景先生毕设
本文整理汇总了C#中BusAttachment类的典型用法代码示例。如果您正苦于以下问题:C#BusAttachment类的具体用法?C#BusAttachment怎么用?C#BusAttachment使用的例子?这里精选的类代码示例或许可以为您提供帮助。 示例1:ChatSessionObject /// ///InitializesanewinstanceoftheChatSessionObjectclass. /// ///TheBusAttachmenttobeassociatedwith. ///ThepathfortheBusObject. ///TheinstanceoftheMainPagewhichhandlestheUIforthis ///application. publicChatSessionObject(BusAttachmentbus,stringpath,MainPagehost) { try { this.hostPage=host; this.busObject=newBusObject(bus,path,false); /*Addtheinterfacetothisobject*/ InterfaceDescription[]ifaceArr=newInterfaceDescription[1]; bus.CreateInterface(ChatServiceInterfaceName,ifaceArr,false); ifaceArr[0].AddSignal("Chat","s","str",0,string.Empty); ifaceArr[0].Activate(); InterfaceDescriptionchatIfc=bus.GetInterface(ChatServiceInterfaceName); this.busObject.AddInterface(chatIfc); this.chatSignalReceiver=newMessageReceiver(bus); this.chatSignalReceiver.SignalHandler+=newMessageReceiverSignalHandler(this.ChatSignalHandler); this.chatSignalMember=chatIfc.GetMember("Chat"); bus.RegisterSignalHandler(this.chatSignalReceiver,this.chatSignalMember,path); } catch(System.Exceptionex) { QStatuserrCode=AllJoyn.AllJoynException.GetErrorCode(ex.HResult); stringerrMsg=AllJoyn.AllJoynException.GetErrorMessage(ex.HResult); this.hostPage.DisplayStatus("CreateChatSessionObjectError:"+errMsg); } }
原文链接:http://www.jxszl.com/biancheng/C/556613.html