Beispiel #1
0
        public SayShowModel(ListView listView, IMessageAdd messageAdd, byte type, long fromId = -1, string target = null)
        {
            ListMessages           = new ObservableRangeCollection <MessageTable>();
            messageAdd.MessageAdd += MessageAdd_MessageAdd;

            Current = DependencyService.Get <ClientService>().Client;
            Log     = new DefaultLog(Current.GetLogger <SayShowModel>());
            Loading(type, fromId);

            this.type         = type;
            this.fromId       = fromId;
            this.ShowListView = listView;
            SelectItemCommand = new Command(() => { });
            SendCommand       = new Command(async() =>
            {
                try
                {
                    if (!string.IsNullOrEmpty(OutText))
                    {
                        var(succ, msg) = await Current.Get <IServer>().Say(fromId, OutText);

                        if (!succ)
                        {
                            Log.Error(msg);
                        }
                        else
                        {
                            var database = DependencyService.Get <ChaTDataBaseManager>();

                            if (type != 0)
                            {
                                var t_msg = new MessageTable()
                                {
                                    FromId         = messageAdd.My.UserId,
                                    FromName       = messageAdd.My.NickName,
                                    TargetId       = fromId,
                                    TargetName     = target,
                                    MessageContext = OutText,
                                    MsgType        = type,
                                    Time           = DateTime.Now
                                };

                                await database.SaveMessage(t_msg);

                                ListMessages.Add(t_msg);
                                MoveEnd();
                            }

                            OutText = null;
                        }
                    }
                }
                catch (Exception er)
                {
                    Log.Error(er);
                }
            });
        }
Beispiel #2
0
        public SayShowPage(IMessageAdd messageAdd, byte type, long fromId = -1, string nickname = "")
        {
            InitializeComponent();

            this.Title = nickname;

            this.BindingContext = new SayShowModel(MessagesListView, messageAdd, type, fromId, nickname);

            this.Send.Source = ImageSource.FromResource("ChaTRoomApp.Icon.Send.png", typeof(SayShowPage).GetTypeInfo().Assembly);

            this.MessagesListView.SelectionMode = ListViewSelectionMode.None;
            this.MessagesListView.VerticalScrollBarVisibility = ScrollBarVisibility.Always;
        }
Beispiel #3
0
 public void PlayerJoin(IPlayer player, IMessageAdd message)
 {
     OnPlayerJoin?.Invoke(player, message);
 }
Beispiel #4
0
 public MessageBController(
     IMessageAdd messageAdd)
 {
     _messageAdd = messageAdd;
 }
Beispiel #5
0
 public MessageBHttpTrigger(
     IMessageAdd messageAdd)
 {
     _messageAdd = messageAdd;
 }
 public NamedMessageAdd(IMessageAdd message)
 {
     this.message = message;
 }