public void SendMessageDataChanged(SignalREventArgs @event) { using (var scope = IoCGlobal.NewScope()) { this.Clients.All.DataChanged(@event); } }
private async void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Add to local ChatRoom. this.chatDialogue.Text += "\r\n" + e.ChatMessageFromServer; }); }
protected void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { // Add to local ChatRoom. chatDialog.Text += "\r\n" + e.ChatMessageFromServer; })); }
protected void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { // Update scores on phone. teamAScore.Text = e.TeamAScore.ToString(); teamBScore.Text = e.TeamBScore.ToString(); })); }
private static void Service_OnLeft(object sender, SignalREventArgs e) { if (e.Sender == name) { return; } Console.WriteLine($"{e.Message}"); }
protected async void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { // Update scores on phone. teamAScore.Text = e.TeamAScore.ToString(); teamBScore.Text = e.TeamBScore.ToString(); }); }
protected async void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { // Update object properties on phone. prop1Txt.Text = e.CustomObject.Property1.ToString(); prop2Txt.Text = e.CustomObject.Property2.ToString(); prop3Chk.IsChecked = e.CustomObject.Property3; }); }
protected void SignalRHub_SignalRServerNotification(object sender, SignalREventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { // Update object properties on phone. prop1Txt.Text = e.CustomObject.Property1.ToString(); prop2Txt.Text = e.CustomObject.Property2.ToString(); prop3Chk.IsChecked = e.CustomObject.Property3; })); }
public IActionResult Post([FromBody] CustomerInsertCommandInputDTO model) { var appResult = this.InsertCommand.Execute(model); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), nameof(DomainModel.Company.Customer.Customer), appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); }
public IActionResult Delete(int id) { var appResult = this.DeleteCommand.Execute(id); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.DELETED_ITEM), "FlowerProductCategory", appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); }
public IActionResult Put([FromBody] ProductCategoryUpdateCommandInputDTO model) { var appResult = this.UpdateCommand.Execute(model); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.UPDATED_ITEM), "FlowerProductCategory", appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); }
public IActionResult Post([FromBody] ProductCategoryAllowedSizeInsertCommandInputDTO model) { var appResult = this.InsertCommand.Execute(model); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), nameof(ProductCategoryAllowedColorType), appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); }
//[Authorization.Authorize(Policy = PermissionsEnum.SaleOpportunity_Manage)] public IActionResult Post([FromBody] SampleBoxProductInsertCommandInputDTO model) { var appResult = this.InsertCommand.Execute(model); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), "SaleOpportunity", appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); }
public IActionResult Get(int id) { var appResult = this.GetByIdCommand.Execute(id); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.DELETED_ITEM), nameof(ProductCategory), appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(this.Ok(appResult)); }
public IActionResult PageQuery([FromBody] PageQuery <BasicProductAliasPageQueryCommandInputDTO> input) { var appResult = this.PageQueryCommand.Execute(input); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), nameof(BasicProductAlias), appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(this.Ok(appResult)); }
///////////////////////////////////////////////// /// Handles a message received over SignalR. /// Spawns a new MessageHandler /// depending on calling- or target module, and /// handles the message ///////////////////////////////////////////////// private void SignalROnCommandReceived(object sender, SignalREventArgs signalREventArgs) { Task.Factory.StartNew(() => { try { IMessageHandler msgHandler = MessageHandlerFactory.GetMessageHandler(signalREventArgs.Module); msgHandler.HandleMessage(signalREventArgs.Obj.ToString(), signalREventArgs.Topic); } catch (MessageHandlerCreationException ex) { Console.WriteLine(ex.Message); } }); }
public IActionResult Post([FromBody] ProductMediaInsertCommandInputDTO model) { try { var appResult = this.InsertCommand.Execute(model); if (appResult.IsSucceed) { var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), nameof(ProductMedia), appResult.Bag); this.SignalRHubContext.Clients.All.DataChanged(signalArgs); } return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult)); } catch (Exception ex) { this.Logger.Error("Error adding ProductMedia", ex); throw; } }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); HubConnection chatConnection = new HubConnection("http://localhost:1141/"); SignalRChatHub = chatConnection.CreateHubProxy("ChatHub"); // Wire-up to listen to custom event from SignalR Hub. SignalRServerNotification += new SignalRServerHandler(SignalRHub_SignalRServerNotification); // Start connection back to Hub. try { await chatConnection.Start(); if (chatConnection.State == Microsoft.AspNet.SignalR.Client.ConnectionState.Connected) { // Join the ChatRoom. await SignalRChatHub.Invoke("JoinChat", "DeviceID123", "ChatUserSam"); // Listen to chat events on SignalR Server & wire them up appropriately. SignalRChatHub.On <string>("addChatMessage", message => { SignalREventArgs chatArgs = new SignalREventArgs(); chatArgs.ChatMessageFromServer = message; // Raise custom event & let it bubble up. SignalRServerNotification(this, chatArgs); }); } } catch (Exception) { // Do some error handling. } }
public async virtual void UserLogin(User tabletChatClient) { // Fire up SignalR Connection & join chatroom. try { await gameConnection.Start(); if (gameConnection.State == Microsoft.AspNet.SignalR.Client.ConnectionState.Connected) { await SignalRGameHub.Invoke("Login", tabletChatClient); } } catch (Exception ex) { // Do some error handling. Could not connect to Sever Error. Debug.WriteLine("Error: "+ ex.Message); } // On // Listen to chat events on SignalR Server & wire them up appropriately. SignalRGameHub.On<User, ServerMessage>("addNewUpdate", (user, message) => { SignalREventArgs userArgs = new SignalREventArgs(); userArgs.UserUpdate = user; userArgs.CustomServerMessage = message; // Raise custom event & let it bubble up. SignalRServerNotification(this, userArgs); }); SignalRGameHub.On<string, string>("addNewMessageToPage", (message, word) => { SignalREventArgs chatArgs = new SignalREventArgs(); chatArgs.ChatMessageFromServer = message; chatArgs.ChatMessageFromServer = word; // Raise custom event & let it bubble up. SignalRServerNotification(this, chatArgs); }); SignalRGameHub.On<User, List<Game>, List<User>, ServerMessage>("update", (user, agl, ul, sm) => { SignalREventArgs uArgs = new SignalREventArgs(); uArgs.UserUpdate = user; uArgs.CustomGameList = agl; uArgs.CustomAvailableOpponents = ul; uArgs.CustomServerMessage = sm; // Raise custom event & let it bubble up. SignalRServerNotification(this, uArgs); }); SignalRGameHub.On<Game, ServerMessage>("gameCreated", (g, sm) => { SignalREventArgs gArgs = new SignalREventArgs(); gArgs.CustomGameObject = g; gArgs.CustomServerMessage = sm; // Raise custom event & let it bubble up. SignalRServerNotification(this, gArgs); }); SignalRGameHub.On<User, Game, ServerMessage>("lobbyMessage", (u, g, sm) => { SignalREventArgs gArgs = new SignalREventArgs(); gArgs.UserUpdate = u; gArgs.CustomGameObject = g; gArgs.CustomServerMessage = sm; // Raise custom event & let it bubble up. SignalRServerNotification(this, gArgs); }); SignalRGameHub.On<Game, InGameMessage>("inGameMessage", (g, im) => { SignalREventArgs gArgs = new SignalREventArgs(); gArgs.CustomGameObject = g; gArgs.InGameActionMessageEvent = im; // Raise custom event & let it bubble up. SignalRServerNotification(this, gArgs); }); }
public virtual void OnSignalRServerNotificationReceived(SignalREventArgs e) { if (SignalRServerNotification != null) { SignalRServerNotification(this, e); } }