Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can i set windows form over other programs at the desktop in c# Pin
Eddy Vluggen6-Mar-18 2:04
professionalEddy Vluggen6-Mar-18 2:04 
AnswerRe: how can i set windows form over other programs at the desktop in c# Pin
Gerry Schmitz6-Mar-18 6:07
mveGerry Schmitz6-Mar-18 6:07 
AnswerRe: how can i set windows form over other programs at the desktop in c# Pin
Dave Kreskowiak8-Mar-18 4:16
mveDave Kreskowiak8-Mar-18 4:16 
Questionapple push notification Pin
Member 108437285-Mar-18 20:22
Member 108437285-Mar-18 20:22 
AnswerRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 20:28
mvePete O'Hanlon5-Mar-18 20:28 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 20:35
Member 108437285-Mar-18 20:35 
GeneralRe: apple push notification Pin
Pete O'Hanlon5-Mar-18 20:54
mvePete O'Hanlon5-Mar-18 20:54 
GeneralRe: apple push notification Pin
Member 108437285-Mar-18 21:11
Member 108437285-Mar-18 21:11 
this is my code

int port = 2195;
            String hostname = "gateway.push.apple.com";

try
           {
               TcpClient client = new TcpClient(hostname, port);
               SslStream sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);

               try
               {
                   sslStream.AuthenticateAsClient(hostname, certificatesCollection, System.Security.Authentication.SslProtocols.Tls, false);

                   for (int i = 0; i < Token.Length; i++)
                   {
                       HttpContext.Current.Trace.Warn("inside sendPushNotificationApple, dt=" + Token[i]);
                       MemoryStream memoryStream = new MemoryStream();
                       BinaryWriter writer = new BinaryWriter(memoryStream);
                       writer.Write((byte)0);
                       writer.Write((byte)0);
                       writer.Write((byte)32);

                       writer.Write(HexStringToByteArray(Token[i]));
                       String payload = "{ \"aps\" : { \"alert\" : {\"title\" : \"" + szAppName + "\",\"body\" : \"" + message + "\",\"Type\" : \"" + szType + "\"} }}";
                       HttpContext.Current.Trace.Warn("inside sendPushNotificationApple, payload=" + payload.ToString());
                       writer.Write((byte)0);
                       //writer.Write((byte)payload.Length);
                       byte[] b1 = System.Text.Encoding.UTF8.GetBytes(payload);
                       writer.Write((byte)b1.Length);
                       writer.Write(b1);
                       writer.Flush();
                       byte[] array = memoryStream.ToArray();
                       sslStream.Write(array);
                       sslStream.Flush();
                   }

                   client.Close();
               }
               catch (System.Security.Authentication.AuthenticationException ex)
               {
                   HttpContext.Current.Trace.Warn("inside sendPushNotificationApple, AuthenticationException=" + ex.ToString());
                   client.Close();
               }
               catch (Exception exp)
               {
                   HttpContext.Current.Trace.Warn("inside sendPushNotificationApple, Exception=" + exp.ToString());
                   client.Close();
               }
           }
           catch (Exception ex)
           {
               HttpContext.Current.Trace.Warn("inside sendPushNotificationApple, Exception1=" + ex.ToString());
           }

GeneralRe: apple push notification Pin
Gerry Schmitz6-Mar-18 5:58
mveGerry Schmitz6-Mar-18 5:58 
QuestionTaskFactory Class Pin
Member 137105305-Mar-18 16:37
Member 137105305-Mar-18 16:37 
AnswerRe: TaskFactory Class Pin
Pete O'Hanlon5-Mar-18 20:20
mvePete O'Hanlon5-Mar-18 20:20 
GeneralRe: TaskFactory Class Pin
Member 137105307-Mar-18 6:13
Member 137105307-Mar-18 6:13 
AnswerRe: TaskFactory Class Pin
Gerry Schmitz7-Mar-18 7:40
mveGerry Schmitz7-Mar-18 7:40 
GeneralRe: TaskFactory Class Pin
Member 1371053019-Mar-18 18:00
Member 1371053019-Mar-18 18:00 
Questionc# parsing CAN dbc files Pin
Member 135713645-Mar-18 4:05
Member 135713645-Mar-18 4:05 
AnswerRe: c# parsing CAN dbc files Pin
Maciej Los5-Mar-18 20:27
mveMaciej Los5-Mar-18 20:27 
GeneralRe: c# parsing CAN dbc files Pin
Member 135713645-Mar-18 20:34
Member 135713645-Mar-18 20:34 
Questiontextbox input Pin
User 136751143-Mar-18 13:01
User 136751143-Mar-18 13:01 
AnswerRe: textbox input Pin
BillWoodruff3-Mar-18 14:31
professionalBillWoodruff3-Mar-18 14:31 
GeneralRe: textbox input Pin
User 136751143-Mar-18 23:56
User 136751143-Mar-18 23:56 
GeneralRe: textbox input PinPopular
OriginalGriff4-Mar-18 1:21
mveOriginalGriff4-Mar-18 1:21 
GeneralRe: textbox input Pin
BillWoodruff4-Mar-18 2:18
professionalBillWoodruff4-Mar-18 2:18 
GeneralRe: textbox input Pin
Luc Pattyn4-Mar-18 7:19
sitebuilderLuc Pattyn4-Mar-18 7:19 
GeneralRe: textbox input Pin
OriginalGriff4-Mar-18 19:27
mveOriginalGriff4-Mar-18 19:27 
GeneralRe: textbox input Pin
Pete O'Hanlon4-Mar-18 20:56
mvePete O'Hanlon4-Mar-18 20:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.