public SendMainChatOrPMToHub() { UpdateBase = new FlowLib.Events.FmdcEventHandler(SendMainChatOrPMToHub_UpdateBase); HubSetting settings = new HubSetting(); settings.Address = "127.0.0.1"; settings.Port = 411; settings.DisplayName = "FlowLib"; settings.Protocol = "Auto"; Hub hubConnection = new Hub(settings, this); hubConnection.Connect(); // YOU should really listen for regmode change here. // Im not doing it here to make example more easy to understand. // Wait 10 seconds and hope we are connected. System.Threading.Thread.Sleep(10 * 1000); // Create mainchat message. MainMessage msg = new MainMessage(hubConnection.Me.ID, "Testing"); // message will here be converted to right format and then be sent. UpdateBase(this, new FlowLib.Events.FmdcEventArgs(FlowLib.Events.Actions.MainMessage, msg)); // Create private message. PrivateMessage privMsg = new PrivateMessage("DCpp706", hubConnection.Me.ID, "Testing"); // message will here be converted to right format and then be sent. UpdateBase(this, new FlowLib.Events.FmdcEventArgs(FlowLib.Events.Actions.PrivateMessage, privMsg)); }
public RetrievingUserInfoWhenReceivingPrivateMessage() { UpdateBase = new FlowLib.Events.FmdcEventHandler(OnUpdateBase); HubSetting settings = new HubSetting(); settings.Address = "127.0.0.1"; settings.Port = 411; settings.DisplayName = "FlowLib"; settings.Protocol = "Nmdc"; Hub hubConnection = new Hub(settings, this); hubConnection.ProtocolChange += new FlowLib.Events.FmdcEventHandler(hubConnection_ProtocolChange); hubConnection.Connect(); }