コード例 #1
0
        private void cmdSubmit_FF_Click(object sender, EventArgs e)
        {
            if ((txtDeviceId.Text.Trim() != String.Empty) && (txtMessage.Text.Trim() != String.Empty))
            {
                String fcmSenderId  = ConfigurationManager.AppSettings["FCM_SenderId"];
                String fcmServerKey = ConfigurationManager.AppSettings["FCM_ServerKey"];

                var result = WebPush.SendNotification_Firefox(fcmServerKey, fcmSenderId, txtDeviceId.Text.Trim(), txtMessage.Text);
            }
        }
コード例 #2
0
        private void cmdViaPushSharp_Click(object sender, EventArgs e)
        {
            if ((txtDeviceId.Text.Trim() != String.Empty) && (txtMessage.Text.Trim() != String.Empty))
            {
                String fcmSenderId  = ConfigurationManager.AppSettings["FCM_SenderId"];
                String fcmServerKey = ConfigurationManager.AppSettings["FCM_ServerKey"];

                String    endpoint      = txtDeviceId.Text.Trim();
                String [] endpointParts = endpoint.Split('/');
                String    deviceId      = (endpointParts.Length > 1) ? endpointParts[endpointParts.Length - 1] : endpoint;

                WebPush.ViaPushSharp(fcmServerKey, fcmSenderId, deviceId, txtMessage.Text);
            }
        }