public static void GetLastMessages(ClientInfo clientInfo) { PushClient client = new PushClient(); try { client.GetLastMessagesCompleted += new EventHandler <GetLastMessagesCompletedEventArgs>(client_GetLastMessagesCompleted); client.GetLastMessagesAsync(clientInfo); client.CloseAsync(); } catch (Exception e) { client.Abort(); } finally { client.CloseAsync(); } }
public static void Disconnect(string uri) { PushClient client = new PushClient(); try { client.DisconnectAsync(uri); client.CloseAsync(); } catch (Exception e) { client.Abort(); } finally { client.CloseAsync(); } }
public static void SendMessage(ClientInfo clientInfo, string message) { PushClient client = new PushClient(); try { client.SendMessageCompleted += new EventHandler <SendMessageCompletedEventArgs>(client_SendMessageCompleted); client.SendMessageAsync(clientInfo, message); client.CloseAsync(); } catch (Exception e) { client.Abort(); } finally { client.CloseAsync(); } }
public static void Connect(ClientInfo clientInfo, string application) { PushClient client = new PushClient(); try { client.ConnectCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(client_ConnectCompleted); client.ConnectAsync(clientInfo, application, 1, false); client.CloseAsync(); } catch (Exception e) { client.Abort(); } finally { client.CloseAsync(); } }