private object ReceiveMessage(MessageOne action) { if (action.Status == true) { Client = action.tcpClient; } return(null); }
private object SendMessage() { var msg = new MessageOne() { Status = true }; Messenger.Default.Send <MessageOne>(msg); return(null); }
public void CheckRuleExecution2() { var messageOne = new MessageOne("sometext"); var result = false; Bouncer .ForExecution(() => messageOne) .Assert(x => x.Content == "othertext") .ExecuteOnSuccess(() => { result = true; }); Assert.IsFalse(result); }
private object ReceiveMessage(MessageOne action) { if (action.Status == true) { Client = action.tcpClient; } if (Client.Connected == true) { IsConnected = "true"; } return(null); }
private object ReceiveMessage(MessageOne action) { if (action.Status == true) { Client = action.tcpClient; wifi = action.wifi; if (Client.Connected) { ConnectionStatus = "Połączono."; } else { ConnectionStatus = "Brak połączenia."; } WifiSearch(wifi); } return(null); }
public void Consume(MessageOne message) { }
private object ReceiveMessage(MessageOne action) { return(null); }
public void CheckRuleSet1() { var messageOne = new MessageOne("sometext"); Bouncer.ForCheckData(() => messageOne).Assert(new SampleRuleSet <MessageOne>()); }
static void Main(string[] args) { Thread.Sleep(2000); Console.Write("Connecting to ChannelListener..."); ClientConnection client = new ClientConnection(new PlainEnvelope(), new SocketTransport()); //TcpClient client = new TcpClient(); //client.Connect("localhost", port); client.ClientClosed += new EventHandler <DisconnectedArgs>(client_ClientClosed); client.MessageReceived += new EventHandler <MessageEventArgs>(client_MessageReceived); client.Connect("localhost", port); Console.WriteLine("connected!"); DateTime connectTime = DateTime.Now; Console.WriteLine(string.Format("Connected at {0}", connectTime)); int count = 1; while (true) { Dictionary <string, string> headers = new Dictionary <string, string>(); string command = ""; while (true) { command = Console.ReadLine(); headers.Clear(); while (true) { string line = Console.ReadLine(); // check for termination if (line.Length == 0) { break; } string[] pieces = line.Split(':'); headers.Add(pieces[0].ToUpper(), pieces[1].ToUpper()); } break; } MessageOne msg = new MessageOne(); msg.MessageID = "MessageOne"; msg.Value = 23; //scm.ControlMode = ControlMode.ChannelController; try { var env = client.Envelope; using (StreamWrapper wrapper = new StreamWrapper(client.Transport.Stream)) { env.Serialize(msg, wrapper); //((SocketTransport)client.Transport) //IMessage response = client.Send<Message>(msg); //Console.WriteLine(msg.Name); } } catch (Exception pex) { Console.WriteLine(pex.Message); } //CustomMessage message = new CustomMessage(command); //foreach (string key in headers.Keys) // message.AddKeyValue(key, headers[key]); //Message response; //{ // try // { // response = client.SendAndReceive(message); // Console.WriteLine("Message received: " + response.Name); // Console.WriteLine(response.ToString()); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message + "\r\n"); // Console.WriteLine("Reconnecting..."); // Console.WriteLine(client.Connect()); // connectTime = DateTime.Now; // Console.WriteLine(string.Format("Connected at {0}", connectTime)); // } //} TimeSpan ts = DateTime.Now - connectTime; Console.WriteLine(string.Format(" connection open for {0:D2}:{1:D2}:{2:D2} [{3} messages processed]\r\n", ts.Hours, ts.Minutes, ts.Seconds, count++)); } }
public override int GetHashCode() { return((MessageOne == null ? 0 : MessageOne.GetHashCode()) + (MessageTwo == null ? 0 : MessageTwo.GetHashCode())); }