Esempio n. 1
0
        public void ExecuteDeleteCommand(string nsName)
        {
            DistributionVM delDistribution = FindByNsName(nsName);

            UserSource.Add(new User(delDistribution.UserID, delDistribution.UserFio));
            CompSource.Add(new Computer(delDistribution.ComputerID, delDistribution.NsName));
            sourceDistr.Remove(delDistribution);
        }
 /// <summary>
 /// 实体数据消息接收
 /// </summary>
 /// <param name="message"></param>
 public void Handle(Message <User> message)
 {
     if (message.Name == "ViewToViewModel")
     {
         //进行一些操作
         UserSource.Add(message.Value);
         this.ShowMessage($"ViewModel:刚刚收到View发过来的User类型的通知!\r\n消息内容为:{message.Value.Name},并添加到了GridView里");
     }
 }
        private void OnAddStudent()
        {
            var num = (UserSource.Count + 1).As <string>();

            UserSource.Add(new User
            {
                Number = num,
                Name   = $"小{num}",
                Remark = "新增的"
            });
        }
        /// <summary>
        /// 获取表的最新数据
        /// </summary>
        private async void Refresh()
        {
            var result = await CustomDataApi.GetCustomDataListAsync(_tableName);

            if (!result.IsOk)
            {
                return;
            }
            UserSource.Clear();
            var records = result.GetRecords();

            foreach (var record in records)
            {
                UserSource.Add(record.As <User>());
            }
        }
        /// <summary>
        /// 获取表的最新数据
        /// </summary>
        private async void Refresh()
        {
            var result = await CustomDataApi.GetCustomDataListAsync(_tableName);

            if (!result.IsOk)
            {
                return;
            }
            UserSource.Clear();
            var records = result.GetRecords();

            foreach (var record in records)
            {
                //UserSource.Add(record.As<User>());
                UserSource.Add(new User
                {
                    _id    = record["_id"].As <Id>(),
                    Number = record["Number"].As <string>(),
                    Name   = record["Name"].As <string>(),
                    Remark = record["Remark"].As <string>()
                });
            }
        }
Esempio n. 6
0
 public void DeleteDistribution(DistributionVM deletedItem)
 {
     UserSource.Add(new User(deletedItem.UserID, deletedItem.UserFio));
     CompSource.Add(new Computer(deletedItem.ComputerID, deletedItem.NsName));
     sourceDistr.Remove(deletedItem);
 }