Exemplo n.º 1
0
        private void HandleAddData()
        {
            var msg = new NotificationMessageAction <DateTime>("请输入新增数据的日期及时间", (result) =>
            {
                try
                {
                    //检查是否有数据存在


                    if (DbContext.CheckExistData(_appInfo.CurrentApp.Id, result))
                    {
                        throw new Exception("该时刻的数据已存在,无法添加");
                    }

                    DataRow newRow = AppDataTable.NewRow();
                    newRow[PubConstant.timeColumnName] = result;
                    AppDataTable.Rows.Add(newRow);
                    AppDataTable.AcceptChanges();
                }
                catch (Exception ex)
                {
                    Messenger.Default.Send <Exception>(ex);
                }
            });

            Messenger.Default.Send <NotificationMessageAction <DateTime> >(msg);
        }