public MessageThreadPage() { InitializeComponent(); if (Application.Current.Properties.ContainsKey("PARTYNAME")) { txtPartyName = Convert.ToString(Application.Current.Properties["PARTYNAME"]); lblPartyName.Text = txtPartyName; } if (Application.Current.Properties.ContainsKey("TOPIC")) { txtTopic = Convert.ToString(Application.Current.Properties["TOPIC"]); lblTopic.Text = txtTopic; } if (Application.Current.Properties.ContainsKey("THREADID")) { threadId = (int)Application.Current.Properties["THREADID"]; } if (NetworkCheck.IsInternet()) { ViewModel = new MessageThreadViewModel(); ViewModel.FetchThreadUserData(); BindingContext = ViewModel; } else { DisplayAlert("Simon", "No network is available.", "Ok"); } GetJSON(); }
protected async override void OnAppearing() { base.OnAppearing(); Xamarin.Forms.Application.Current.On <Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize); this.BindingContext = new MessageThreadViewModel(); vm = this.BindingContext as MessageThreadViewModel; if (vm != null) { if (!string.IsNullOrEmpty(Settings.TypedMessage)) { txtMessage.Text = Settings.TypedMessage; } if (NetworkCheck.IsInternet()) { await vm.PostReadThreadData(); await vm.FetchThreadUserData(); } else { await DisplayAlert("Simon", "No network is available.", "OK"); } } }
public MessageThreadViewPage() { InitializeComponent(); this.BindingContext = new MessageThreadViewModel(); vm = this.BindingContext as MessageThreadViewModel; //Commemted by Ekta - Date: 28 September, 2020 //if (Device.RuntimePlatform == Device.iOS) //{ // //Divyesh - Date: 28 July, 2020 // //Embeded all controls inside scrollview to avoid header shifting up when keyboard is open. // var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; // if (mainDisplayInfo.Height <= 1334) // { // // iPhone 6, 7, 8 // MessagesThreadStackLayout.HeightRequest = 465; // } // else // { // //iPhone X, XS, XR, 11 // MessagesThreadStackLayout.HeightRequest = 565; // } // txtMessage.Focused += (sender, e) => PlaceHolder.HeightRequest = 20; // txtMessage.Unfocused += (sender, e) => PlaceHolder.HeightRequest = 0; // ScrollView scroll = new ScrollView // { // Content = WrapperStackLayout // }; // MainStackLayout.Children.Add(scroll); //} }
public ActionResult Details(Guid id, Guid?context = null) { var message = _messageDao.GetMessageById(id); // only private messages can be perma linked if (message.MessageType != MessageType.Private) { throw new NotFoundException(); } if (message.FirstMessage.HasValue) { // the user is looking at the wrong page. // the user should never get here return(Redirect(Url.MessageDetails(message))); } // this will return all the messages for this thread, including the first message that started the conversation var messages = _messageDao.GetMessagesForThread(message.Id); // let's make sure that the user is involved with at least one of these messages if (!_userContext.CurrentUser.IsAdmin) { var userModeratingSubs = _moderationDao.GetSubsModeratoredByUserWithPermissions(_userContext.CurrentUser.Id) .Where(x => x.Value.HasPermission(ModeratorPermissions.Mail)).Select(x => x.Key).ToList(); // NOTE: Should we check for the user being involved with any message in the thread, or is the first message enough? if (message.ToUser.HasValue && message.ToUser.Value == _userContext.CurrentUser.Id || message.AuthorId == _userContext.CurrentUser.Id || message.FromSub.HasValue && userModeratingSubs.Contains(message.FromSub.Value) || message.ToSub.HasValue && userModeratingSubs.Contains(message.ToSub.Value)) { // the user is involved in these discussions! } else { throw new UnauthorizedException(); } } var model = new MessageThreadViewModel(); model.IsModerator = _moderationDao.GetSubsModeratoredByUser(_userContext.CurrentUser.Id).Count > 0; model.Messages.AddRange(_messageWrapper.Wrap(messages, _userContext.CurrentUser)); if (context.HasValue) { model.ContextMessage = model.Messages.SingleOrDefault(x => x.Message.Id == context.Value); } model.FirstMessage = model.Messages.Single(x => !x.Message.FirstMessage.HasValue); return(View(model)); }