Esempio n. 1
0
 public MainPage()
 {
     InitializeComponent();
     CollectionMessage = new ObservableCollection <Message>();
     HubConnect        = new HubConnection(URLServer);
     ChatHub           = HubConnect.CreateHubProxy("ChatHub");
     ChatHub.On("Ready", OnReady);
     ChatHub.On <string, string>("Message", OnMessage);
     MainListView.ItemsSource = CollectionMessage;
 }
        protected override void CreateHubConnection()
        {
            base.CreateHubConnection();

            ChatHub    = HubConnection.CreateHubProxy("ChatHub");
            AccountHub = HubConnection.CreateHubProxy("AccountHub");
            ContactHub = HubConnection.CreateHubProxy("ContactHub");
            ChatHub.On("update", () =>
            {
                if (OnRequestUpdate != null)
                {
                    OnRequestUpdate();
                }
            });
        }