You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
1.7 KiB

using B3DealerClient.BL;
using B3DealerClient.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace B3DealerClient.Dialogs
{
/// <summary>
/// BaseInfoDialog.xaml 的交互逻辑
/// </summary>
public partial class BaseInfoDialog : Window
{
public NameIDPair Result { get; private set; }
private string mTypeName;
public BaseInfoDialog(string typeName)
{
mTypeName = typeName;
InitializeComponent();
this.Loaded += BaseInfoDialog_Loaded;
}
void BaseInfoDialog_Loaded(object sender, RoutedEventArgs e)
{
switch (mTypeName)
{
case "Supplier":
this.Title = "供应商";
break;
case "Store":
this.Title = "仓库";
break;
default:
break;
}
var list = BaseInfoBL.GetBaseInfoList(mTypeName);
foreach (var item in list)
{
var content = new TextBlock() { TextWrapping = TextWrapping.Wrap };
content.Text = item.Name;
var btn = new Button() { Content = content, Tag = item };
btn.PreviewMouseDown += btn_PreviewMouseDown;
this.wrapPanel.Children.Add(btn);
}
}
void btn_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var btn = sender as Button;
Result = btn.Tag as NameIDPair;
DialogResult = true;
}
}
}