public async void ProcessRemoteNotification(PushNotificationMessage message, bool isAppStartingOrAwakening) { Console.WriteLine("Navigator.ProcessRemoteNotification - message.Text=" + message.Text); Console.WriteLine("Navigator.ProcessRemoteNotification - message.ObjectID=" + message.ObjectID); PushNotificationMessageTypeEnum?messageType = PushNotificationMessage.ParseType(message.Text); if (messageType == PushNotificationMessageTypeEnum.FriendRequest) { if (isAppStartingOrAwakening) { CheckNotificationsAndOpenNotificationsPage(); } else { notificationsService.CheckForNotificationsIfNecessary(); } } else if (messageType == PushNotificationMessageTypeEnum.PrivateMessage) { if (message.ObjectID > 0) { await GoToPersonProfile(message.ObjectID); } await NavPage.DisplayAlert("Byb Message", message.Text, "OK"); } else if (messageType == PushNotificationMessageTypeEnum.GameInvite) { if (isAppStartingOrAwakening == false) { await NavPage.DisplayAlert("Byb Game Invite", "You were invited for a game of snooker by somebody.", "OK"); } await GoToEvents(); } else if (messageType == PushNotificationMessageTypeEnum.Comment && message.ObjectID > 0) { OpenNewsfeedItemPage(message.ObjectID); } else { await GoToEvents(); } }
private void SetBindings() { PhoneLabel.SetBinding(Label.TextProperty, "Contact"); // Address TimeLabel.SetBinding(Label.TextProperty, "Time"); ValueLabel.SetBinding(Label.TextProperty, "Label"); CapacityLabel.SetBinding(Label.TextProperty, "Count"); //*/ SimLabel.SetBinding(Label.TextProperty, "Sim"); //*/ if (hideSpam == false) { var opacityConverter = new UniversalConverter(b => { if (b is bool isSpam && isSpam) { return(0.1f); } return(1); }); PhoneLabel.SetBinding(Label.OpacityProperty, "IsSpam", BindingMode.OneWay, opacityConverter); ValueLabel.SetBinding(Label.OpacityProperty, "IsSpam", BindingMode.OneWay, opacityConverter); CapacityLabel.SetBinding(Label.OpacityProperty, "IsSpam", BindingMode.OneWay, opacityConverter); TimeLabel.SetBinding(Label.OpacityProperty, nameof(Dialog.IsSpam), BindingMode.OneWay, opacityConverter); } //*/ // SimLabel.SetBinding(Label.TextColorProperty, "SimBackColor");//*/ StateFrame.SetBinding(Frame.BackgroundColorProperty, "LastMsgState", BindingMode.OneWay, new MessageStateConverter()); StateImage.SetBinding(Image.IsVisibleProperty, "LastIsOutGoing"); // StateImage.SetBinding(Image.SourceProperty, "LastMsgState"); spamBtn = new Xamarin.Forms.MenuItem { Text = "В спам", Command = new DialogCommander(d => { d.IsSpam = !d.IsSpam; if (d.IsSpam) { Api.Funcs.Toast("Вы можете скрыть сообщения, помеченные как спам, в настройках приложения, передернув рычаг"); // if (Options.ModelSettings.HideSpam) Options.ModelSettings.HideSpam = false; } }) }; rmBtn = new Xamarin.Forms.MenuItem() { Text = "Удалить", Command = new DialogCommander(async d => { if (await navPage.DisplayAlert("Подтверждение", "Вы уверены, что хотите удалить весь диалог?", "Да", "Нет")) { ((navPage.RootPage as MainPage).Dialogs.ItemsSource as IList <Dialog>).Remove(d); // Cache.database.Execute("DELETE FROM Messages WHERE Address = ?", new string[] { d.Address }); } }) }; this.ContextActions.AddRange(spamBtn, rmBtn); }
public async void ShowInternalOptions() { string strAbout = "About"; string strTestMessage = "Send yourself a message"; string strWebserviceInfo = "Webservice info"; string strTest1 = "Test"; string strUnregister = "Unregister"; string strInput = await NavPage.DisplayActionSheet("Byb - Internal", "Cancel", null, strAbout, strWebserviceInfo, strTestMessage, strUnregister, strTest1); if (strInput == strAbout) { InfoPage page = new InfoPage(); await NavPage.Navigation.PushModalAsync(page); } if (strInput == strWebserviceInfo) { string text = ""; text += "Last exception url: "; if (App.WebService.LastExceptionUrl != null) { text += App.WebService.LastExceptionUrl; } else { text += "none"; } text += "\r\n\r\nLast exception: "; if (App.WebService.LastException == null) { text += "null"; } else { text += TraceHelper.ExceptionToString(App.WebService.LastException); } InfoPage page = new InfoPage(); page.Text = text; await NavPage.Navigation.PushModalAsync(page); } if (strInput == strTestMessage) { string msg = string.Format("Message from '{0}' : {1}", "Miguel", "Some message!!!"); App.MobileNotificationsService.AddLocalNotification("Byb", msg, 0); return; } if (strInput == strUnregister) { string fileName = System.IO.Path.Combine(App.Files.GetWritableFolder(), Config.DatabaseFileName); App.Files.DeleteFile(fileName); await NavPage.DisplayAlert("Byb", "The local database deleted. Pease force-close the app now.", "Done"); return; } if (strInput == strTest1 && Config.IsProduction == false) { OpenNewsfeedItemPage(1098); return; } //var athlete = App.Repository.GetMyAthlete(); // athlete.Country = ""; // athlete.MetroID = 0; // App.Repository.UpdateAthlete(athlete); // App.Navigator.DisplayAlertRegular("Set athlete's metro no empty. Try Edit Profile now."); }