예제 #1
0
        public void Join(string name, string topic, RoomVersion roomVersion)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "name");

            if (string.IsNullOrEmpty(topic))
                throw new ArgumentException(Resources.Client_Join_Cannot_be_empty_or_null, "topic");

            if (this._lobby == null)
                throw new ApplicationException("Lobby is null");

            ObjectAdapter adapter = this.Communicator.createObjectAdapter(string.Empty);
            this._jobQueue = new JobQueue();
            Listener listener = new ListenerI(this._outputTxtBx, this._jobQueue);
            ObjectPrx listenerPrx = adapter.addWithUUID(listener);
            this._jobQueue.Start();
            adapter.activate();
            this._lobby.ice_getConnection().setAdapter(adapter);

            this._roomAccess = this._lobby.Join(name, topic, listenerPrx.ice_getIdentity());
            this._context = new Dictionary<string, string> { { SESSIONCTXPROP.value, topic }, {AUTHORCTXPROP.value, name} };
        }
예제 #2
0
 public void Leave()
 {
     try
     {
         switch (this._roomVersion)
         {
             case RoomVersion.Base:
                 RoomPrx room = RoomPrxHelper.checkedCast(this._roomAccess.RoomProxy.ice_context(this._context));
                 room.LeaveRoom();
                 break;
             case RoomVersion.V1:
                 RoomAdmPrx roomAdm = RoomAdmPrxHelper.checkedCast(this._roomAccess.RoomProxy.ice_context(this._context), "V1");
                 roomAdm.LeaveRoom();
                 break;
             case RoomVersion.V2:
                 RoomV2Prx roomV2 = RoomV2PrxHelper.checkedCast(this._roomAccess.RoomProxy.ice_context(this._context), "V2");
                 roomV2.LeaveRoom();
                 break;
         }
     }
     finally
     {
         this._jobQueue.Destroy();
         this._jobQueue.Join();
         this._jobQueue = null;
     }
 }
예제 #3
0
 public ListenerI(TextBox outputTxtBx, JobQueue jobQueue)
 {
     this._output = outputTxtBx;
     this._jobQueue = jobQueue;
 }