1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using DevExpress.XtraEditors;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Documents;
- using System.Windows.Forms;
- using DW5S.Entity;
- using DW5S.Repostory;
- using Serilog;
- using DW5S.Service;
- using DW5S.ViewModel;
- namespace DW5S.App.PopupControl
- {
- public partial class ShowCheckCtrl : DevExpress.XtraEditors.XtraUserControl
- {
- PosResViewModel posItem;
- List<CheckRes> list = new List<CheckRes>();
- public ShowCheckCtrl()
- {
- InitializeComponent();
- gridShowCheck.UseDefault(list);
- }
- public ShowCheckCtrl(PosResViewModel posItem)
- : this()
- {
- this.posItem = posItem;
- }
- private async void ShowCxCtrl_Load(object sender, EventArgs e)
- {
- var repsPos = IocContainer.UnitOfWork.OfLong<PosRes>();
- var pos = await repsPos.GetByIdAsync(this.posItem.Id);
- var unitOfWork = IocContainer.UnitOfWork;
- var repsCheck = unitOfWork.OfLong<CheckRes>();
- var items = await repsCheck.FindAsync(p => p.Id == pos.CheckResID);
- this.list.AddRange(items);
- gridView1.RefreshData();
- }
- private void gridView1_CustomDrawEmptyForeground(object sender, DevExpress.XtraGrid.Views.Base.CustomDrawEventArgs e)
- {
- if (gridView1.RowCount == 0)
- {
- string txt = "没有检测结果信息";
- var s = e.Appearance.CalcTextSize(e.Cache, txt, e.Bounds.Width).ToSize();
- var x = (e.Bounds.Width - s.Width) / 2;
- var y = (e.Bounds.Height - s.Height) / 2;
- e.Appearance.ForeColor = Color.Gray;
- e.Appearance.DrawString(e.Cache, txt, new Rectangle(x, y, s.Width, s.Height));
- }
- }
- }
- }
|