Exemplo n.º 1
0
        private async void List_View_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            ListView       lst_view = (ListView)sender;
            ChatRoomLoader item     = (ChatRoomLoader)lst_view.SelectedItem;

            if (item == null)
            {
                return;
            }

            lst_view.SelectedItem = null;

            string name = await Logic.GetChatName();

            await Logic.CreateroomID(item.Id);

            if (item.IamMember & name != null)
            {
                Navigation.PushModalAsync(new ChatPage(item));
            }
            else
            {
                Navigation.PushModalAsync(new CreateName(item));
            }
        }
Exemplo n.º 2
0
 internal static void UpdateMembership(string roomId, string count)
 {
     if (Local.ChatRoomLoader.Exists(d => d.Id == roomId))
     {
         ChatRoomLoader room = Local.ChatRoomLoader.FindOne(d => d.Id == roomId);
         room.MembersCount = count;
         Local.ChatRoomLoader.Update(room);
     }
 }
Exemplo n.º 3
0
        public ChatPage(ChatRoomLoader _chatRoomLoader)
        {
            InitializeComponent();
            titleLabel.Text = $"{_chatRoomLoader.Title} Room";
            current_context = new ChatPageViewModel()
            {
                Room_ID = _chatRoomLoader.Id
            };
            this.BindingContext = current_context;
            chatRoomLoader      = _chatRoomLoader;
            Settings_Label.Text = Constants.FontAwe.Cog;

            ScrollListCommand = new Command(() =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    if ((this.BindingContext as ChatPageViewModel).Messages.Count > 0)
                    {
                        ChatList.ScrollTo((this.BindingContext as ChatPageViewModel).Messages.LastOrDefault(), ScrollToPosition.End, false);
                    }
                });
            });

            FocusCommand = new Command(() =>
            {
                chatInput.FocusEntry();
            });

            GetPhotoCommand = new Command(async() =>
            {
                await Navigation.PushModalAsync(new CameraPage(chatRoomLoader));
                chatInput.UnFocusEntry();
            });
            MessagingCenter.Subscribe <object>(this, Constants.go_back, (sender) =>
            {
                Navigation.PopModalAsync();
            });

            MessagingCenter.Subscribe <object>(this, Constants.scroll_chat, (sender) =>
            {
                ScrollListCommand.Execute(null);
            });
        }
Exemplo n.º 4
0
 public CreateName(ChatRoomLoader item)
 {
     InitializeComponent();
     this.item = item;
     LoadData();
 }
Exemplo n.º 5
0
 public CameraPage(ChatRoomLoader _chatRoomLoader)
 {
     InitializeComponent();
     this.chatRoomLoader = _chatRoomLoader;
 }