Exemple #1
0
        //第一个参数点击确认回调,第二个物料种类,第三个个数
        public ConfirmNumWindow(MaterialNumberCallback mNum, MaterialNumber materialNumber)
        {
            InitializeComponent();
            this.materialNumCallback = mNum;
            this.materialNumber      = materialNumber;

            tbName.Text = materialNumber.m.mname;
            tbCode.Text = materialNumber.m.mid;

            tbNum.DataContext = this.materialNumber;
        }
        // 物料列表中的条目被点击
        private void MaterialItemClicked(object sender, SelectionChangedEventArgs e)
        {
            MaterialNumberCallback callback = new MaterialNumberCallback();

            callback.ModifyNumEvent += OnGetConfirmBack;
            MaterialNumber materialNumber = new MaterialNumber {
                m = lvMaterials.SelectedItem as material, Count = 1
            };

            new ConfirmNumWindow(callback, materialNumber).Show();
        }
        // 确认添加物料数量后返回
        public void OnGetConfirmBack(MaterialNumber materialNumber)
        {
            if (choosedMaterials == null)
            {
                choosedMaterials = new ObservableCollection <MaterialNumber>();
            }

            // 如果已经添加了,需要修改数量而不是再次添加。
            foreach (MaterialNumber c in choosedMaterials)
            {
                if (c.m.mid.Equals(materialNumber.m.mid))
                {
                    c.Count = materialNumber.Count;
                    return;
                }
            }

            choosedMaterials.Add(materialNumber);
            lvChoosed.ItemsSource = choosedMaterials;
        }
Exemple #4
0
 public void Modify(MaterialNumber materialNumber)
 {
     ModifyNumEvent(materialNumber);
 }