protected async override void OnClick() { //int test = await AddPortalItem(); string stationTriplet = "Example: 13202000:ID:USGS"; System.Windows.Forms.DialogResult res = GeneralTools.ShowInputDialog("Enter station triplet", ref stationTriplet, 400, 80); if (res == System.Windows.Forms.DialogResult.OK) { string[] pieces = stationTriplet.Split(':'); if (pieces.Length != 3) { MessageBox.Show("Please enter a valid station triplet!"); return; } Webservices ws = new Webservices(); var success = await ws.UpdateAoiItemsAsync(stationTriplet.Trim()); if (success == BA_ReturnCode.Success) { MessageBox.Show("PDF items successfully updated for " + stationTriplet, "BAGIS-PRO"); } else { MessageBox.Show("PDF item update failed for " + stationTriplet + "!!", "BAGIS-PRO"); } } }
protected override void OnClick() { Webservices ws = new Webservices(); ws.AddPortalItem(); //MessageBox.Show("Create AOI from a shapefile"); }
async void SendRegistrationToServer(string token) { if (registerRequest != null) { registerRequest.deviceToken = token;//.Split(':')[1]; registerRequest.installationId = token.Split(':')[0]; await Webservices.RegisterPush(registerRequest); } }
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId) { string text = intent.GetStringExtra("ack") ?? "no data"; if (text != "no data") { _ack = JsonConvert.DeserializeObject <AckRequest>(text); Webservices.SilenceAlarm(_ack); } StopSelf(); return(StartCommandResult.NotSticky); }
public DFeServiceInfo <TTIpo, TVersao> this[TVersao versao, DFeTipoEmissao emissao] { get { return(Webservices?.SingleOrDefault(x => x.Versao.Equals(versao) && x.TipoEmissao == emissao)); } }
//// And do this, instead of creating a seperate delegate //#region IUNUserNotificationCenterDelegate //[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")] //public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) //{ // var manager = BITHockeyManager.SharedHockeyManager; // manager.MetricsManager.TrackEvent("iOS Notification Ack"); // // Take action based on Action ID // switch (response.ActionIdentifier) // { // case "snooze": // AckRequest ack = new AckRequest(); // var userInfo = response.Notification.Request.Content.UserInfo; // if (userInfo.ContainsKey(new NSString("level"))) // { // ack.level = userInfo.ValueForKey(new NSString("level")) as NSString; // //ack.Level = level.Int32Value; // } // if (userInfo.ContainsKey(new NSString("group"))) // { // ack.group = (userInfo.ValueForKey(new NSString("group")) as NSString).ToString(); // } // if (userInfo.ContainsKey(new NSString("key"))) // { // ack.key = (userInfo.ValueForKey(new NSString("key")) as NSString).ToString(); // } // ack.time = 15; // Webservices.SilenceAlarm(ack); // break; // // default: // // Take action based on identifier // //switch (response.ActionIdentifier) // //{ // // case UNActionIdentifier.Default: // //// Handle default // //... // //break; // // case UNActionIdentifier.Dismiss: // // Handle dismiss // //... // //break; // //} // //break; // } // // Inform caller it has been handled // completionHandler(); //} //#endregion public async override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) { string s = deviceToken.Description.Replace("<", "").Replace(">", "").Replace(" ", ""); //Byte[] tokenBytes = deviceToken.Bytes; //for (int i = 0; i < 8;i++) //{ // s += String.Format("%08x%08x%08x%08x%08x%08x%08x%08x", deviceToken.Bytes[i]) //} RegisterRequest registration = new RegisterRequest(); //added on 1/7/17 by aditmer to unregister and reregister if the app gets a new device token //if (s != ApplicationSettings.InstallationID && ApplicationSettings.InstallationID != "") //{ // await Webservices.UnregisterPush(ApplicationSettings.InstallationID); //} await CheckInstallationID.CheckNewInstallationID(s); if (PushNotificationsImplementation.registerRequest != null) { registration = PushNotificationsImplementation.registerRequest; } else { registration.platform = Xamarin.Forms.Device.RuntimePlatform.ToString(); registration.settings = new RegistrationSettings(); registration.settings.info = ApplicationSettings.InfoNotifications; registration.settings.alert = ApplicationSettings.AlertNotifications; registration.settings.announcement = ApplicationSettings.AnouncementNotifications; } registration.deviceToken = s; ApplicationSettings.DeviceToken = s; await Webservices.RegisterPush(registration); //Commented out on 11/29/16 by aditmer so we can register for notifications on the server //Hub = new SBNotificationHub(Constants.ConnectionString, Constants.NotificationHubPath); //Hub.UnregisterAllAsync(deviceToken, (error) => //{ // if (error != null) // { // Console.WriteLine("Error calling Unregister: {0}", error.ToString()); // return; // } //}); // //adds a tag for the current Nightscout URL in the App Settings // NSSet tags = new NSSet(ApplicationSettings.AzureTag); // //const string template = "{\"aps\":{\"alert\":\"$(message)\"},\"request\":\"$(requestid)\"}"; // const string templateBodyAPNS = "{\"aps\":{\"alert\":\"$(message)\",\"sound\":\"$(sound)\"},\"eventName\":\"$(eventName)\",\"group\":\"$(group)\",\"key\":\"$(key)\",\"level\":\"$(level)\",\"title\":\"$(title)\"}"; // //var alert = new JObject( // //new JProperty("aps", new JObject(new JProperty("alert", notificationText))), // //new JProperty("inAppMessage", notificationText)) // //.ToString(Newtonsoft.Json.Formatting.None); // //JObject templates = new JObject(); // //templates["genericMessage"] = new JObject // //{ // // {"body", templateBodyAPNS} // //}; // var expiryDate = DateTime.Now.AddDays(90).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); //Hub.RegisterTemplateAsync(deviceToken,"nightscout",templateBodyAPNS, // expiryDate,tags,(errorCallback) => // { // if (errorCallback != null) // Console.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString()); // }); }
public async override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) { //changed on 8/12/18 by aditmer. Replaces HockeyApp analytics w/ AppCenter Analytics.TrackEvent("iOS Notification Ack"); Debug.WriteLine("Snooze me"); Console.WriteLine("Snoozed"); // Take action based on Action ID AckRequest ack = new AckRequest(); ack.time = -1; switch (response.ActionIdentifier) { case "snooze1": ack.time = ApplicationSettings.AlarmUrgentLowMins1; break; case "snooze2": ack.time = ApplicationSettings.AlarmUrgentLowMins2; break; case "snooze3": ack.time = ApplicationSettings.AlarmUrgentMins1; break; case "snooze4": ack.time = ApplicationSettings.AlarmUrgentMins2; break; // default: // Take action based on identifier //switch (response.ActionIdentifier) //{ // case UNActionIdentifier.Default: //// Handle default //... //break; // case UNActionIdentifier.Dismiss: // Handle dismiss //... //break; //} //break; } if (ack.time != -1) { var userInfo = response.Notification.Request.Content.UserInfo; if (userInfo.ContainsKey(new NSString("level"))) { ack.level = userInfo.ValueForKey(new NSString("level")) as NSString; //ack.Level = level.Int32Value; } if (userInfo.ContainsKey(new NSString("group"))) { ack.group = (userInfo.ValueForKey(new NSString("group")) as NSString).ToString(); } if (userInfo.ContainsKey(new NSString("key"))) { ack.key = (userInfo.ValueForKey(new NSString("key")) as NSString).ToString(); } await Webservices.SilenceAlarm(ack); } // Inform caller it has been handled completionHandler(); }