Beispiel #1
0
 static async Task Initialize()
 {
     ServerConnection = new HubConnection(ClientUrl);
     MessageHub       = ServerConnection.CreateHubProxy <IServerHub, IClientContract>("MessageHub");
     MessageHub.SubscribeOn <NewMessageArgs>(hub => hub.NewMessage, HandleNewMessage);
     await ServerConnection.Start();
 }
 private void SetUpHubConnectionSubscriptions()
 {
     hubProxy.SubscribeOn <InsertDocumentIntoRemoteBackOfficeCommand>(
         hub => hub.InsertDocument,
         SendInsertDocumentCommand);
 }
Beispiel #3
0
        public void Run()
        {
            try {
                ID = AppDomain.CurrentDomain.GetData("id").ToString();
                PlayerName = AppDomain.CurrentDomain.GetData("player").ToString();

                var qsData = new Dictionary<string, string>();
                qsData["id"] = ID;
                var url = string.Format("http://localhost:{0}/ZMachine", ZMachineSettings.Settings.Port);
                _hubConn = new HubConnection(url, qsData);
                _proxy = _hubConn.CreateHubProxy<IZMachineHub, IZMachineClient>("ZMachineHub");
                _proxy.SubscribeOn<string>(hub => hub.StartGame, StartGame);
                _proxy.SubscribeOn<string>(hub => hub.AddInput, AddInput);
                _proxy.SubscribeOn(hub => hub.Quit, Quit);
                _hubConn.Start().Wait();

                SetupLogging();

                _frotz = new UcmaFrotzScreen(PlayerName);
                Frotz.os_.SetScreen(_frotz);
                _frotz.MessageReady += (o, s) => { SendMessage(s); };
            } catch (AggregateException aex) {
                var ex1 = aex.InnerException;
                Log.Error("Exception in " + ex1.TargetSite.Name, ex1);
            } catch (Exception ex) {
                Log.Error("Exception in " + ex.TargetSite.Name, ex);
            }
        }