Beispiel #1
0
        private async void DataAdd(WebMsgEventArgs eventArgs)
        {
            await Task.Delay(300);

            var addId = eventArgs.Data.As <Id>();

            if (addId == null)
            {
                return;
            }
            var result = await DataApi.GetDataInfoAsync(Hubs.Postil.T, addId);

            if (!result.IsOk)
            {
                return;
            }
            var model  = result.GetRecord().As <PostilInfoModel>();
            var urlDic = await Util.Data.GetPictureUrlsAsync(new[] { model.FileId });

            var userDic = await Util.Data.GetUserInfosAsync(new[] { model.CreateUser });

            model.ImageUrl   = urlDic?[model.FileId];
            model.PostilUser = userDic?[model.CreateUser];
            model.FirstTag   = $" {model.Tags[0]} ";
            model.LastTime   = DateDiff(Convert.ToDateTime(model.CreateTime), DateTime.Now);
            PostilInfoModels.Insert(0, model);
            _backupPostilInfoModels.Insert(0, model);
        }