Esempio n. 1
0
        public static void EnableNotifications(string username)
        {
            _username = username;
            if (_channel != null)
                return;

            _channel = HttpNotificationChannel.Find(CHANNEL);

            if (_channel == null)
            {
                _channel = new HttpNotificationChannel(CHANNEL);
                WireChannel(_channel);
                _channel.Open();
            }
            else
                WireChannel(_channel);

            if (!_channel.IsShellToastBound)
                _channel.BindToShellToast();

            if (_channel.ChannelUri != null)
            {
                var ns = new NotificationServiceClient();
                ns.RegisterEndpointAsync(username, _channel.ChannelUri.ToString());
            }
        }
        static void Main(string[] args)
        {
            Console.Write("Please enter app id(com.exampleCompany.exampleApp): ");
            var appId = Console.ReadLine();

            if (string.IsNullOrEmpty(appId))
            {
                appId = "com.exampleCompany.exampleApp";
            }

            while (true)
            {
                Console.Write("Please enter email address to send: ");
                var token = Console.ReadLine();

                Task.Run(async() =>
                {
                    var client = new NotificationServiceClient("http://notificationservice.example.com/api");
                    //var not = Notification.CreatePushNotification(token, "TEST NOTIFICATION TITLE", "TEST PUSH MESSAGE", Core.Service.Abstract.Platform.iOS, appId, 0);
                    var htmlMes  = "<html xmlns='http://www.w3.org/1999/xhtml' xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'><head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><meta name='viewport' content='width=device-width'><!--[if !mso]><!--><meta http-equiv='X-UA-Compatible' content='IE=edge'><!--<![endif]--><title></title><!--[if !mso]><!--><!--<![endif]--><style type='text/css'>body { margin: 0; padding: 0; }table,td,tr { vertical-align: top; border-collapse: collapse; }* { line-height: inherit; }a[x-apple-data-detectors=true] { color: inherit !important; text-decoration: none !important; }.ie-browser table { table-layout: fixed; }[owa] .img-container div, [owa] .img-container button { display: block !important; }[owa] .fullwidth button { width: 100% !important; }[owa] .block-grid .col { display: table-cell; float: none !important; vertical-align: top; }.ie-browser .block-grid,.ie-browser .num12,[owa] .num12,[owa] .block-grid { width: 700px !important; }.ie-browser .mixed-two-up .num4,[owa] .mixed-two-up .num4 { width: 232px !important; }.ie-browser .mixed-two-up .num8,[owa] .mixed-two-up .num8 { width: 464px !important; }.ie-browser .block-grid.two-up .col,[owa] .block-grid.two-up .col { width: 348px !important; }.ie-browser .block-grid.three-up .col,[owa] .block-grid.three-up .col { width: 348px !important; }.ie-browser .block-grid.four-up .col[owa] .block-grid.four-up .col { width: 174px !important; }.ie-browser .block-grid.five-up .col[owa] .block-grid.five-up .col { width: 140px !important; }.ie-browser .block-grid.six-up .col,[owa] .block-grid.six-up .col { width: 116px !important; }.ie-browser .block-grid.seven-up .col,[owa] .block-grid.seven-up .col { width: 100px !important; }.ie-browser .block-grid.eight-up .col,[owa] .block-grid.eight-up .col { width: 87px !important; }.ie-browser .block-grid.nine-up .col,[owa] .block-grid.nine-up .col { width: 77px !important; }.ie-browser .block-grid.ten-up .col,[owa] .block-grid.ten-up .col { width: 60px !important; }.ie-browser .block-grid.eleven-up .col,[owa] .block-grid.eleven-up .col { width: 54px !important; }.ie-browser .block-grid.twelve-up .col,[owa] .block-grid.twelve-up .col { width: 50px !important; }</style><style type='text/css' id='media-query'>@media only screen and (min-width: 720px) { .block-grid { width: 700px !important; } .block-grid .col { vertical-align: top; } .block-grid .col.num12 { width: 700px !important; } .block-grid.mixed-two-up .col.num3 { width: 174px !important; } .block-grid.mixed-two-up .col.num4 { width: 232px !important; } .block-grid.mixed-two-up .col.num8 { width: 464px !important; } .block-grid.mixed-two-up .col.num9 { width: 522px !important; } .block-grid.two-up .col { width: 350px !important; } .block-grid.three-up .col { width: 233px !important; } .block-grid.four-up .col { width: 175px !important; } .block-grid.five-up .col { width: 140px !important; } .block-grid.six-up .col { width: 116px !important; } .block-grid.seven-up .col { width: 100px !important; } .block-grid.eight-up .col { width: 87px !important; } .block-grid.nine-up .col { width: 77px !important; } .block-grid.ten-up .col { width: 70px !important; } .block-grid.eleven-up .col { width: 63px !important; } .block-grid.twelve-up .col { width: 58px !important; }}@media (max-width: 720px) { .block-grid,.col { min-width: 320px !important; max-width: 100% !important; display: block !important; } .block-grid { width: 100% !important; } .col { width: 100% !important; } .col > div { margin: 0 auto; } img.fullwidth,img.fullwidthOnMobile { max-width: 100% !important; } .no-stack .col { min-width: 0 !important; display: table-cell !important; } .no-stack.two-up .col { width: 50% !important; } .no-stack .col.num4 { width: 33% !important; } .no-stack .col.num8 { width: 66% !important; } .no-stack .col.num4 { width: 33% !important; } .no-stack .col.num3 { width: 25% !important; } .no-stack .col.num6 { width: 50% !important; } .no-stack .col.num9 { width: 75% !important; } .video-block { max-width: none !important; } .mobile_hide { min-height: 0px; max-height: 0px; max-width: 0px; display: none; overflow: hidden; font-size: 0px; } .desktop_hide { display: block !important; max-height: none !important; }}</style></head><body class='clean-body' style='margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #81D4DF;'><style type='text/css' id='media-query-bodytag'>@media (max-width: 720px) { .block-grid { min-width: 320px!important; max-width: 100%!important; width: 100%!important; display: block!important; } .col { min-width: 320px!important; max-width: 100%!important; width: 100%!important; display: block!important; } .col > div { margin: 0 auto; } img.fullwidth { max-width: 100%!important; height: auto!important; } img.fullwidthOnMobile { max-width: 100%!important; height: auto!important; } .no-stack .col { min-width: 0!important; display: table-cell!important; } .no-stack.two-up .col { width: 50%!important; } .no-stack.mixed-two-up .col.num4 { width: 33%!important; } .no-stack.mixed-two-up .col.num8 { width: 66%!important; } .no-stack.three-up .col.num4 { width: 33%!important } .no-stack.four-up .col.num3 { width: 25%!important }}</style><!--[if IE]><div class='ie-browser'><![endif]--><table class='nl-container' style='table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #81D4DF; width: 100%;' cellpadding='0' cellspacing='0' role='presentation' width='100%' bgcolor='#81D4DF' valign='top'><tbody><tr style='vertical-align: top;' valign='top'><td style='word-break: break-word; vertical-align: top; border-collapse: collapse;' valign='top'><!--[if (mso)|(IE)]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' style='background-color:#81D4DF'><![endif]--> <div style='background-image:url('https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/pattern_top.gif');background-position:top center;background-repeat:repeat;background-color:transparent;'><div class='block-grid ' style='Margin: 0 auto; min-width: 320px; max-width: 700px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;;'><div style='border-collapse: collapse;display: table;width: 100%;background-color:transparent;'><!--[if (mso)|(IE)]><table width='100%' cellpadding='0' cellspacing='0' border='0' style='background-image:url('https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/pattern_top.gif');background-position:top center;background-repeat:repeat;background-color:transparent;'><tr><td align='center'><table cellpadding='0' cellspacing='0' border='0' style='width:700px'><tr class='layout-full-width' style='background-color:transparent'><![endif]--><!--[if (mso)|(IE)]><td align='center' width='700' style='background-color:transparent;width:700px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;' valign='top'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 0px; padding-left: 0px; padding-top:55px; padding-bottom:5px;'><![endif]--><div class='col num12' style='min-width: 320px; max-width: 700px; display: table-cell; vertical-align: top;;'><div style='width:100% !important;'><!--[if (!mso)&(!IE)]><!--><div style='border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:55px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;'><!--<![endif]--><div class='img-container center fixedwidth' align='center' style='padding-right: 0px;padding-left: 0px;'><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr style='line-height:0px'><td style='padding-right: 0px;padding-left: 0px;' align='center'><![endif]--><img class='center fixedwidth' align='center' border='0' src='https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/Logo_question.png' alt='Image' title='Image' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; border: 0; height: auto; float: none; width: 100%; max-width: 140px; display: block;' width='140'><!--[if mso]></td></tr></table><![endif]--></div><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 10px; padding-left: 10px; padding-top: 25px; padding-bottom: 0px; font-family: Arial, sans-serif'><![endif]--><div style='color:#FFFFFF;font-family:'Poppins', Arial, Helvetica, sans-serif;line-height:120%;padding-top:25px;padding-right:10px;padding-bottom:0px;padding-left:10px;'><div style='line-height: 14px; font-family: 'Poppins', Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF;'><p style='line-height: 40px; text-align: center; font-size: 12px; margin: 0;'><span style='font-size: 34px;'><strong><span style='line-height: 40px; font-size: 34px;'>- UNCOVER THE -</span></strong></span></p></div></div><!--[if mso]></td></tr></table><![endif]--><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 10px; padding-left: 10px; padding-top: 0px; padding-bottom: 10px; font-family: Arial, sans-serif'><![endif]--><div style='color:#FFFFFF;font-family:'Abril Fatface', Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height:120%;padding-top:0px;padding-right:10px;padding-bottom:10px;padding-left:10px;'><div style='font-size: 12px; line-height: 14px; font-family: 'Abril Fatface', Arial, 'Helvetica Neue', Helvetica, sans-serif; color: #FFFFFF;'><p style='font-size: 14px; line-height: 76px; text-align: center; margin: 0;'><span style='font-size: 64px;'>Mystery of Easter!</span></p></div></div><!--[if mso]></td></tr></table><![endif]--><!--[if (!mso)&(!IE)]><!--></div><!--<![endif]--></div></div><!--[if (mso)|(IE)]></td></tr></table><![endif]--><!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]--></div></div></div><div style='background-color:transparent;'><div class='block-grid ' style='Margin: 0 auto; min-width: 320px; max-width: 700px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;;'><div style='border-collapse: collapse;display: table;width: 100%;background-color:transparent;'><!--[if (mso)|(IE)]><table width='100%' cellpadding='0' cellspacing='0' border='0' style='background-color:transparent;'><tr><td align='center'><table cellpadding='0' cellspacing='0' border='0' style='width:700px'><tr class='layout-full-width' style='background-color:transparent'><![endif]--><!--[if (mso)|(IE)]><td align='center' width='700' style='background-color:transparent;width:700px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;' valign='top'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 0px; padding-left: 0px; padding-top:10px; padding-bottom:0px;'><![endif]--><div class='col num12' style='min-width: 320px; max-width: 700px; display: table-cell; vertical-align: top;;'><div style='width:100% !important;'><!--[if (!mso)&(!IE)]><!--><div style='border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:10px; padding-bottom:0px; padding-right: 0px; padding-left: 0px;'><!--<![endif]--><div class='img-container center fixedwidth' align='center' style='padding-right: 0px;padding-left: 0px;'><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr style='line-height:0px'><td style='padding-right: 0px;padding-left: 0px;' align='center'><![endif]--><img class='center fixedwidth' align='center' border='0' src='https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/easter_egg_3.gif' alt='Image' title='Image' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; border: 0; height: auto; float: none; width: 100%; max-width: 525px; display: block;' width='525'><!--[if mso]></td></tr></table><![endif]--></div><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 45px; padding-left: 45px; padding-top: 15px; padding-bottom: 5px; font-family: Arial, sans-serif'><![endif]--><div style='color:#F2F2F2;font-family:'Poppins', Arial, Helvetica, sans-serif;line-height:180%;padding-top:15px;padding-right:45px;padding-bottom:5px;padding-left:45px;'><div style='font-size: 12px; line-height: 21px; color: #F2F2F2; font-family: 'Poppins', Arial, Helvetica, sans-serif;'><p style='font-size: 14px; line-height: 36px; text-align: center; margin: 0;'><span style='font-size: 20px;'>Suspendisse nec libero sit amet dui auctor lobortis ac ut dui. Sed commodo, mauris sit amet sagittis molestie, easter egg.</span></p></div></div><!--[if mso]></td></tr></table><![endif]--><!--[if (!mso)&(!IE)]><!--></div><!--<![endif]--></div></div><!--[if (mso)|(IE)]></td></tr></table><![endif]--><!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]--></div></div></div><div style='background-image:url('https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/pattern_bottom_1.gif');background-position:top center;background-repeat:repeat;background-color:transparent;'><div class='block-grid ' style='Margin: 0 auto; min-width: 320px; max-width: 700px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;;'><div style='border-collapse: collapse;display: table;width: 100%;background-color:transparent;'><!--[if (mso)|(IE)]><table width='100%' cellpadding='0' cellspacing='0' border='0' style='background-image:url('https://d1oco4z2z1fhwp.cloudfront.net/templates/default/226/pattern_bottom_1.gif');background-position:top center;background-repeat:repeat;background-color:transparent;'><tr><td align='center'><table cellpadding='0' cellspacing='0' border='0' style='width:700px'><tr class='layout-full-width' style='background-color:transparent'><![endif]--><!--[if (mso)|(IE)]><td align='center' width='700' style='background-color:transparent;width:700px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;' valign='top'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 0px; padding-left: 0px; padding-top:15px; padding-bottom:30px;'><![endif]--><div class='col num12' style='min-width: 320px; max-width: 700px; display: table-cell; vertical-align: top;;'><div style='width:100% !important;'><!--[if (!mso)&(!IE)]><!--><div style='border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:15px; padding-bottom:30px; padding-right: 0px; padding-left: 0px;'><!--<![endif]--><div class='button-container' align='center' style='padding-top:25px;padding-right:10px;padding-bottom:10px;padding-left:10px;'><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0' style='border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;'><tr><td style='padding-top: 25px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px' align='center'><v:roundrect xmlns:v='urn:schemas-microsoft-com:vml' xmlns:w='urn:schemas-microsoft-com:office:word' href='' style='height:48pt; width:204pt; v-text-anchor:middle;' arcsize='79%' stroke='false' fillcolor='#f76b8f'><w:anchorlock/><v:textbox inset='0,0,0,0'><center style='color:#ffffff; font-family:Arial, sans-serif; font-size:24px'><![endif]--><div style='text-decoration:none;display:inline-block;color:#ffffff;background-color:#f76b8f;border-radius:50px;-webkit-border-radius:50px;-moz-border-radius:50px;width:auto; width:auto;;border-top:1px solid #f76b8f;border-right:1px solid #f76b8f;border-bottom:1px solid #f76b8f;border-left:1px solid #f76b8f;padding-top:8px;padding-bottom:8px;font-family:'Poppins', Arial, Helvetica, sans-serif;text-align:center;mso-border-alt:none;word-break:keep-all;'><span style='padding-left:50px;padding-right:50px;font-size:24px;display:inline-block;'><span style='font-size: 16px; line-height: 32px;'><span style='font-size: 24px; line-height: 48px;'><strong>Crack the egg!</strong></span></span></span></div><!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]--></div><table class='divider' border='0' cellpadding='0' cellspacing='0' width='100%' style='table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;' role='presentation' valign='top'><tbody><tr style='vertical-align: top;' valign='top'><td class='divider_inner' style='word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-collapse: collapse;' valign='top'><table class='divider_content' border='0' cellpadding='0' cellspacing='0' width='100%' style='table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; border-top: 0px solid transparent; height: 70px;' align='center' role='presentation' height='70' valign='top'><tbody><tr style='vertical-align: top;' valign='top'><td style='word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; border-collapse: collapse;' height='70' valign='top'><span></span></td></tr></tbody></table></td></tr></tbody></table><!--[if (!mso)&(!IE)]><!--></div><!--<![endif]--></div></div><!--[if (mso)|(IE)]></td></tr></table><![endif]--><!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]--></div></div></div><div style='background-color:#f76b8f;'><div class='block-grid ' style='Margin: 0 auto; min-width: 320px; max-width: 700px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;;'><div style='border-collapse: collapse;display: table;width: 100%;background-color:transparent;'><!--[if (mso)|(IE)]><table width='100%' cellpadding='0' cellspacing='0' border='0' style='background-color:#f76b8f;'><tr><td align='center'><table cellpadding='0' cellspacing='0' border='0' style='width:700px'><tr class='layout-full-width' style='background-color:transparent'><![endif]--><!--[if (mso)|(IE)]><td align='center' width='700' style='background-color:transparent;width:700px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;' valign='top'><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 0px; padding-left: 0px; padding-top:30px; padding-bottom:30px;'><![endif]--><div class='col num12' style='min-width: 320px; max-width: 700px; display: table-cell; vertical-align: top;;'><div style='width:100% !important;'><!--[if (!mso)&(!IE)]><!--><div style='border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:30px; padding-bottom:30px; padding-right: 0px; padding-left: 0px;'><!--<![endif]--><!--[if mso]><table width='100%' cellpadding='0' cellspacing='0' border='0'><tr><td style='padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif'><![endif]--><div style='color:#FFFFFF;font-family:'Poppins', Arial, Helvetica, sans-serif;line-height:120%;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;'><div style='font-size: 12px; line-height: 14px; color: #FFFFFF; font-family: 'Poppins', Arial, Helvetica, sans-serif;'><p style='font-size: 14px; line-height: 16px; text-align: center; margin: 0;'>EasterEgg, made with love by Bee&nbsp;🐰</p></div></div><!--[if mso]></td></tr></table><![endif]--><table class='social_icons' cellpadding='0' cellspacing='0' width='100%' role='presentation' style='table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;' valign='top'><tbody><tr style='vertical-align: top;' valign='top'><td style='word-break: break-word; vertical-align: top; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; border-collapse: collapse;' valign='top'><table class='social_table' align='center' to='to' activate='activate' alignment='alignment' cellpadding='0' cellspacing='0' role='presentation' style='table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: undefined; mso-table-tspace: 0; mso-table-rspace: 0; mso-table-bspace: 0; mso-table-lspace: 0;' valign='top'><tbody><tr style='vertical-align: top; display: inline-block; text-align: center;' align='center' valign='top'><td style='word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 10px; padding-left: 10px; border-collapse: collapse;' valign='top'><a href='https://www.facebook.com/' target='_blank'><img width='32' height='32' src='https://d2fi4ri5dhpqd1.cloudfront.net/public/resources/social-networks-icon-sets/t-circle-white/[email protected]' alt='Facebook' title='Facebook' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; height: auto; float: none; border: none; display: block;'></a></td><td style='word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 10px; padding-left: 10px; border-collapse: collapse;' valign='top'><a href='https://twitter.com/' target='_blank'><img width='32' height='32' src='https://d2fi4ri5dhpqd1.cloudfront.net/public/resources/social-networks-icon-sets/t-circle-white/[email protected]' alt='Twitter' title='Twitter' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; height: auto; float: none; border: none; display: block;'></a></td><td style='word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 10px; padding-left: 10px; border-collapse: collapse;' valign='top'><a href='https://instagram.com/' target='_blank'><img width='32' height='32' src='https://d2fi4ri5dhpqd1.cloudfront.net/public/resources/social-networks-icon-sets/t-circle-white/[email protected]' alt='Instagram' title='Instagram' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; height: auto; float: none; border: none; display: block;'></a></td><td style='word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 10px; padding-left: 10px; border-collapse: collapse;' valign='top'><a href='https://www.youtube.com/' target='_blank'><img width='32' height='32' src='https://d2fi4ri5dhpqd1.cloudfront.net/public/resources/social-networks-icon-sets/t-circle-white/[email protected]' alt='YouTube' title='YouTube' style='outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; height: auto; float: none; border: none; display: block;'></a></td></tr></tbody></table></td></tr></tbody></table><!--[if (!mso)&(!IE)]><!--></div><!--<![endif]--></div></div><!--[if (mso)|(IE)]></td></tr></table><![endif]--><!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]--></div></div></div><!--[if (mso)|(IE)]></td></tr></table><![endif]--></td></tr></tbody></table><!--[if (IE)]></div><![endif]--></body></html>";
                    var emailNot = Notification.CreateEmailNotification(token, "UNCOVER THE - Mystery of Easter!", "- UNCOVER THE - Mystery of Easter! Image Suspendisse nec libero sit amet dui auctor lobortis ac ut dui.Sed commodo, mauris sit amet sagittis molestie, easter egg. Crack the egg! EasterEgg, made with love by Bee 🐰", "com.exampleCompany.exampleApp", htmlMes);

                    try
                    {
                        var result = await client.SendAsync(emailNot);
                        Console.WriteLine("Notification sent successfully!");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Notification sending error: " + ex.Message);
                    }
                }).Wait();
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hi from Suscriber Console!");
            InstanceContext site = new InstanceContext(null, new Program());

            NotificationServiceClient client = new NotificationServiceClient(site);

            //create a unique callback address so multiple clients can run on one machine
            WSDualHttpBinding binding = (WSDualHttpBinding)client.Endpoint.Binding;
            string            clientcallbackaddress = binding.ClientBaseAddress.AbsoluteUri;

            clientcallbackaddress    += Guid.NewGuid().ToString();
            binding.ClientBaseAddress = new Uri(clientcallbackaddress);

            //Subscribe.
            Console.WriteLine("Subscribing");
            client.Subscribe();

            Console.WriteLine();
            Console.WriteLine("Press ENTER to unsubscribe and shut down client");
            Console.ReadLine();

            Console.WriteLine("Unsubscribing");
            client.Unsubscribe();

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();
        }
Esempio n. 4
0
        private int[] PushProducts(Article[] products, bool isStage, string userName, int userId, string method, bool localize, bool autopublish, string[] forcedСhannels)
        {
            var notifications = GetNotifications(products, isStage, forcedСhannels, localize, autopublish);

            if (notifications == null)
            {
                return(null);
            }

            if (notifications.Any())
            {
                var customerCode = _identityProvider.Identity.CustomerCode;
                if (!String.IsNullOrEmpty(_integrationProperties.RestNotificationUrl))
                {
                    var client  = _httpClientFactory.CreateClient();
                    var json    = JsonConvert.SerializeObject(notifications);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    var url     = GetRestUrl(isStage, userName, userId, method, customerCode);
                    var result  = client.PutAsync(url, content).Result;
                    if (!result.IsSuccessStatusCode)
                    {
                        throw new ApplicationException("Notification sending failed with status code " + result.StatusCode);
                    }
                }
                else if (!String.IsNullOrEmpty(_integrationProperties.WcfNotificationUrl))
                {
                    var myBinding  = new BasicHttpBinding();
                    var myEndpoint = new EndpointAddress(_integrationProperties.WcfNotificationUrl);
                    var service    = new NotificationServiceClient(myBinding, myEndpoint);
                    service.PushNotifications(notifications, isStage, userId, userName, method, customerCode);
                }
            }

            return(notifications.Select(n => n.ProductId).ToArray());
        }
Esempio n. 5
0
        public MessageOutput SendEmail(MessageInput messageInput)
        {
            var client = new NotificationServiceClient();

            client.OpenAsync();

            var obj = new SendEmailRequest()
            {
                ServiceToken = new ServiceToken
                {
                    Token = _Token
                },
                Message = new Email()
                {
                    Destination  = messageInput.Destination,
                    EmailMessage = messageInput.Message
                }
            };

            var reply = client.EmailAsync(obj.ServiceToken, obj.Message).Result;

            client.CloseAsync();

            return(_NotificationMapping.MapNotificationOutput(reply));
        }
Esempio n. 6
0
        public MainWindowForm(Common.Solver solver)
        {
            InitializeComponent();

            this.solver   = solver;
            ticketService = new TicketsServiceClient();
            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;


            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);



            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }
            UI_Init();
        }
        private void ShowAnimation(object state)
        {
            try
            {
                HasNotification = NotificationServiceClient.HasNotification(this.ItemsAioViewModel.ItemId);

                Dispatcher.Invoke(new Action(ShowAnimationUI));
            }
            catch (Exception ex)
            {
                Logger.LogIndustrialMonitoring(ex);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes the notification service client.
        /// </summary>
        private void InitializeClient(string addressText)
        {
            IPAddress ipAddress;

            if (!IPAddress.TryParse(addressText, out ipAddress))
            {
                Messages.Text += "Invalid Machine Address entered.";
                return;
            }
            var callbackClass = new NotificationServiceCallback();

            callbackClass.NotificationReceived += OnNotificationReceived;
            var notificationServiceBinding = new NetTcpBinding(SecurityMode.Message);

            notificationServiceBinding.ReceiveTimeout = TimeSpan.FromSeconds(10);
            notificationServiceBinding.SendTimeout    = TimeSpan.FromSeconds(10);

            AddressHeader          header  = AddressHeader.CreateAddressHeader("machine-connect", "hurco.com", "machine-connect");
            EndpointAddressBuilder builder = new EndpointAddressBuilder(new EndpointAddress("net.tcp://" + ipAddress + "/NotificationService"));

            builder.Headers.Add(header);
            builder.Identity = EndpointIdentity.CreateDnsIdentity("machine-connect.hurco.com");

            notificationServiceClient = new NotificationServiceClient(new InstanceContext(callbackClass), notificationServiceBinding, builder.ToEndpointAddress()); //create local service

            ab = false;
            if (notificationServiceClient.ClientCredentials == null)
            {
                Messages.Text += "Invalid client. Please try again.";
                return;
            }

            ////turn on security
            notificationServiceBinding.Security.Mode = SecurityMode.Message;
            notificationServiceBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
            ///turn on security


            notificationServiceClient.ClientCredentials.UserName.UserName = "******"; // your VendorID (1234)
            notificationServiceClient.ClientCredentials.UserName.Password = "******";
            HeartbeatTimer = new Timer(PingWinmax, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
            try
            {
                notificationServiceClient.Open();
            }
            catch (Exception e)
            {
                Messages.Text += "Failed to Connect:\n" + e.Message + "\n" + e.StackTrace;
            }
        }
Esempio n. 9
0
        public MessageOutput SendSMS(MessageInput messageInput)
        {
            //var basicHttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None)
            //{
            //    Name = "BasicHttpBinding_IBlogService",
            //    MaxReceivedMessageSize = 2147483646,
            //    MaxBufferSize = 2147483646,
            //    MaxBufferPoolSize = 2147483646,
            //    ReaderQuotas = new XmlDictionaryReaderQuotas()
            //    {
            //        MaxArrayLength = 2147483646,
            //        MaxStringContentLength = 5242880
            //    },
            //    SendTimeout = new TimeSpan(0, 5, 0),
            //    CloseTimeout = new TimeSpan(0, 5, 0),
            //    Security = new BasicHttpSecurity
            //    {
            //        Mode = BasicHttpSecurityMode.None,
            //        Transport = new HttpTransportSecurity
            //        {
            //            ClientCredentialType = HttpClientCredentialType.None
            //        }
            //    }
            //};

            //var endpointAddress = new EndpointAddress("http://localhost:8000");

            var client = new NotificationServiceClient();

            client.OpenAsync();

            var obj = new SendSMSRequest()
            {
                ServiceToken = new ServiceToken
                {
                    Token = _Token
                },
                Message = new SMS()
                {
                    Destination = messageInput.Destination,
                    Message     = messageInput.Message
                }
            };

            var reply = client.SMSAsync(obj.ServiceToken, obj.Message).Result;

            client.CloseAsync();

            return(_NotificationMapping.MapNotificationOutput(reply));
        }
Esempio n. 10
0
 public static void Notify(string email, string message)
 {
     try
     {
         using (var notification = new NotificationServiceClient())
         {
             notification.SendEmail(email, message);
         }
     }
     catch
     {
         // if it fails ignore.
     }
 }
Esempio n. 11
0
        protected MainViewModel()
        {
            unitOfWork = new UnitOfWork()
            {
                ConnectionString = "XpoProvider=MSSqlServer;data source=(localdb)\\MSSQLLocalDB;integrated security=SSPI;initial catalog=SampleData",
                AutoCreateOption = AutoCreateOption.DatabaseAndSchema
            };
            PersonCollection = new XPCollection <Person>(unitOfWork);

            m_originId            = Guid.NewGuid().ToString();
            m_notificationService = new NotificationServiceClient();
            consoleLock           = new object();
            StartReadingNotificationServer();
        }
Esempio n. 12
0
        private static void StartManufacturing(NotificationServiceClient notificationClient)
        {
            BackendServiceClient client = new BackendServiceClient();

            WriteConsole("Start Manufactoring Triggered!");
            List <FactoryStatistic> stats = client.GetFactoryStats(null, null).ToList();

            WriteConsole("**************************Current Statistics***************");
            stats.ForEach(stat => WriteConsole(string.Format("{0}:{1}", stat.Status, stat.Count)));
            WriteConsole("*************************************************************");
            Request request = client.GetNextRequest();

            if (stats.First(s => s.Status.ToLower() == "inprogress").Count > 0)
            {
                notificationClient.PublishMachineChange(0, 0, 0, "Error-AlreadyInProgress");
                WriteConsole("There is an Item already in production");
                WriteConsole("Enter C  clear production or Q to exit:");
                string c = Console.ReadLine();
                if (c.ToLower() == "c" || c.ToLower() == "clear")
                {
                    client.ClearInProgress();
                }
                else
                {
                    return;
                }
            }
            if (stats.First(s => s.Status.ToLower() == "done").Count > 300)
            {
                notificationClient.PublishMachineChange(0, 0, 0, "DailyLimit");

                WriteConsole("Maximuim number of items to produce per day exceeded");
                return;
            }
            if (request != null)
            {
                WriteConsole("Will start processing Request Number: " + request.Id.ToString());
                RequestStatus currentStatus = Statuses.First(s => s.Id == request.StatusId);
                WriteConsole("Current Status of the request is " + currentStatus.Name);
                notificationClient.PublishMachineChange(request.Id.Value, request.StatusId.Value, 0, "Manufacturing");

                TransitionRequest(request, currentStatus);
                StartManufacturing(notificationClient);
            }
            else
            {
                WriteConsole("No more requests!");
            }
        }
Esempio n. 13
0
        public NotificationController(IIdentityProvider identityProvider, IOptions <IntegrationProperties> props, IHttpClientFactory factory, QPHelper helper)
        {
            _identityProvider = identityProvider;
            _factory          = factory;
            _restUrl          = props.Value.RestNotificationUrl;
            _wcfUrl           = props.Value.WcfNotificationUrl;
            _qpHelper         = helper;

            if (String.IsNullOrEmpty(_restUrl) && !String.IsNullOrEmpty(_wcfUrl))
            {
                var myBinding  = new BasicHttpBinding();
                var myEndpoint = new EndpointAddress(_wcfUrl);
                _service = new NotificationServiceClient(myBinding, myEndpoint);
            }
        }
Esempio n. 14
0
        public Form1()
        {
            InstanceContext context = new InstanceContext(new Notify());

            notifyProxy = new NotificationServiceClient(context);
            notifyProxy.CallCallback();
            this.Subscribe <NotificationModel>(x => { if (x.A == 1)
                                                      {
                                                          button1.PerformClick();
                                                      }
                                               });
            InitializeComponent();
            InitializeTable();
            client = new FtpClient("deliverit.westeurope.cloudapp.azure.com");
            client.Connect();
        }
Esempio n. 15
0
 public void TestNotificar(string message)
 {
     if (!string.IsNullOrEmpty(message))
     {
         try
         {
             if (notificationServiceClient.State == CommunicationState.Faulted)
             {
                 notificationServiceClient.Abort();
                 notificationServiceClient = new NotificationServiceClient(instanceContext);
             }
             //notificationServiceClient.SendMessage(userId, message);
             Console.WriteLine("--------Enviei uma msg nova--------");
         }
         catch
         { }
     }
 }
Esempio n. 16
0
        static void Main(string[] args)
        {
            /////////////////////////////////Set up Publish Events
            InstanceContext           site   = new InstanceContext(new Program());
            NotificationServiceClient client = new NotificationServiceClient(site);

            ////////////////////////////////End Setup

            BackendServiceClient backendClient = new BackendServiceClient();

            Statuses = backendClient.GetRequestStatuses().ToList();
            WriteConsole("Launching the Microship Machine.. Hold on");
            WriteConsole("Hi... I'm you Microship manufacturing machine.");
            WriteConsole("I can only process one request at a time. No multiThreading required here!");
            client.PublishMachineChange(0, 0, 0, "StartManufacturing");

            StartManufacturing(client);
            Console.ReadLine();
        }
        private void ShowLiveData(object state)
        {
            try
            {
                LatestData      = ProcessDataServiceClient.GeItemsLogLatest(this.ItemsAioViewModel.ItemId);
                HasNotification = NotificationServiceClient.HasNotification(this.ItemsAioViewModel.ItemId);

                if (LatestData == null)
                {
                    return;
                }

                Dispatcher.Invoke(new Action(ShowLiveDataUI));
            }
            catch (Exception ex)
            {
                Logger.LogIndustrialMonitoring(ex);
            }
        }
Esempio n. 18
0
        public void PlaceOrder(OrderModel order)
        {
            if (order.Quantity <= 0)
                throw new NotSupportedException();

            using (var transaction = new TransactionScope(TransactionScopeOption.Required))
            {
                CustomerBase customer;
                ProductBase prod;
                using (var mappers = new OrdersDataMapperContainer())
                {
                    prod = EnsureProductExistance(mappers.ProductMapper, order.ProductCode);

                    customer = EnsureCustomerExistance(mappers.CustomerMapper, order.CustomerId);

                    using (var orderService = new CustomerOrderReceiverServiceClient())
                    {
                        orderService.HandleOrder(new CustomerOrderModel
                                                     {
                                                         CustomerId = order.CustomerId,
                                                         ProductCode = order.ProductCode,
                                                         Quantity = order.Quantity
                                                     });
                    }
                    try
                    {
                        using (var notification = new NotificationServiceClient())
                        {
                            notification.SendEmail(customer.Email, "Your order was .");
                        }
                    }
                    catch
                    {
                        // if it fails ignore.
                    }

                    transaction.Complete();
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ticketsService = new TicketsService.TicketsServiceClient();

            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;


            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);

            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }

            LoadWorkers();


            if (!Page.IsPostBack)
            {
                UpdateWorkersList();
            }

            if (workersList != null)
            {
                if (workersList.Count > 0)
                {
                    UpdateQuestionsListBox(workersList[workersDropDownList.SelectedIndex].id);
                }
            }

            //TODO remover, Isto é para DEBUG
            //DebugLabel.Text = ticketsService.DebugTests();
        }
        private static void Main(string[] args)
        {
            var originId = Guid.NewGuid().ToString();

            System.Console.WriteLine($"Joined as {originId}");
            var notificationServiceClient = new NotificationServiceClient();
            var consoleLock = new object();

            // subscribe (asynchronous)
            _ = notificationServiceClient.NotificationLogs()
                .ForEachAsync(x =>
            {
                // if the user is writing something, wait until it finishes.
                lock (consoleLock)
                {
                    System.Console.WriteLine($"{x.At.ToDateTime().ToString("HH:mm:ss")} {x.OriginId}: {x.Content}");
                }
            });

            // write
            while (true)
            {
                var key = System.Console.ReadKey();

                // A key input starts writing mode
                lock (consoleLock)
                {
                    var content = key.KeyChar + System.Console.ReadLine();

                    notificationServiceClient.Write(new NotificationLog
                    {
                        OriginId = originId,
                        Content  = content,
                        At       = Timestamp.FromDateTime(DateTime.Now.ToUniversalTime())
                    }).Wait();
                }
            }
        }
Esempio n. 21
0
        public MainWindowForm()
        {
            InitializeComponent();


            QueueService.UI_Updater = UI_UpdateList; //Calls UI_UpdateList When new question is received

            ticketService = new TicketsServiceClient();

            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;

            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);



            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }

            ServiceHost host = new ServiceHost(typeof(QueueService));

            host.Open();



            UI_LBOX();

            //TODO remover
            //DebugTestes();
        }
Esempio n. 22
0
 public BantumiGamePage()
 {
     InitializeComponent();
     _nsc = new NotificationServiceClient();
 }
Esempio n. 23
0
 public static void DisableNotification()
 {
     _channel = null;
     var ns = new NotificationServiceClient();
     ns.UnregisterEndpointAsync(_username);
 }
Esempio n. 24
0
 public BantumiGamePage()
 {
     InitializeComponent();
     _nsc = new NotificationServiceClient();
 }
Esempio n. 25
0
        public NotificationClientTests()
        {
            var factory = new NotificationFactory();

            _client = new NotificationServiceClient(factory);
        }
Esempio n. 26
0
 private static void ChannelUpdated(object sender, NotificationChannelUriEventArgs args)
 {
     var ns = new NotificationServiceClient();
     ns.RegisterEndpointAsync(_username, args.ChannelUri.ToString());
 }