public EditDiamondShoppingItemWindow(DiamondShoppingItemUIModel oldItem) { InitializeComponent(); this.Title = "修改钻石商品"; isAdd = false; _syn = SynchronizationContext.Current; Init(); this._oldItem = oldItem; this.oldID = oldItem.ID; this.txtID.Text = oldItem.ID.ToString(); this.txtTitle.Text = oldItem.Name; this.txtRemark.Text = oldItem.Remark; this.numPrice.Value = (double)oldItem.ValueDiamonds; this.txtDetailText.Text = oldItem.DetailText; this.numStockCount.Value = oldItem.StocksCount; this.imgIcon.Source = oldItem.Icon; this._iconBuffer = oldItem.IconBuffer; if (oldItem.DetailImageNames != null) { this.ListDetailImageNames = new ObservableCollection <string>(oldItem.DetailImageNames); } this.cmbItemType.SelectedValue = (int)oldItem.ItemType; GlobalData.Client.UpdateDiamondShoppingItemCompleted += Client_UpdateDiamondShoppingItemCompleted; }
public DiamondShoppingItemDetailWindow(DiamondShoppingItemUIModel item) { InitializeComponent(); this.shoppingItem = item; this.DataContext = this.shoppingItem; if (item.DetailImageNames != null) { detailImageSources = new BitmapSource[item.DetailImageNames.Length]; } }
private void DiamondShoppingItem_MouseDown(object sender, MouseButtonEventArgs e) { Border btn = sender as Border; DiamondShoppingItemUIModel shoppingItem = btn.DataContext as DiamondShoppingItemUIModel; if (shoppingItem == null) { MyMessageBox.ShowInfo("请选择要购买的商品"); return; } DiamondShoppingItemDetailWindow win = new DiamondShoppingItemDetailWindow(shoppingItem); win.Show(); }