using System; using System.Collections.Generic; using System.Linq; using System.Text; 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; using System.Xml; namespace SiaSun.LMS.WPFClient.SYS { /// /// INIT_TABLE_DATA.xaml 的交互逻辑 /// public partial class INIT_TABLE_DATA : AvalonDock.DocumentContent { public INIT_TABLE_DATA() { InitializeComponent(); } /// /// 窗体加载 /// private void DocumentContent_Loaded(object sender, RoutedEventArgs e) { //加载所有可初始化对象 this.LoadInitObjects(); } //加载所有可初始化的对象 private void LoadInitObjects() { try { IList listTable = null; //MainApp._I_SystemService.SYS_TABLE_GetList(); var query = from ls in listTable orderby ls.TABLE_NAME select ls; foreach (Model.SYS_TABLE mSYS_TABLE in query) { TextBlock txtContent = new TextBlock(); txtContent.VerticalAlignment = System.Windows.VerticalAlignment.Center; txtContent.Text = mSYS_TABLE.TABLE_NAME; CheckBox chkBox = new CheckBox(); chkBox.Width = 200; chkBox.FontSize = 18; chkBox.Margin = new Thickness(10); chkBox.Content = txtContent; this.panelTableName.Children.Add(chkBox); } } catch (Exception ex) { MainApp._MessageDialog.ShowException(ex); } } /// /// 点击按钮初始化 /// private void Border_Click(object sender, RoutedEventArgs e) { Button btn = e.OriginalSource as Button; if (btn != null) { switch (btn.Name) { case "btnOK": this.StartExecute(); break; } } } /// /// 开始执行初始化操作 /// private void StartExecute() { if (MainApp._MessageDialog.ShowDialog("ConfirmExecute",null) == Sid.Windows.Controls.TaskDialogResult.Ok) { List listTable = new List(); foreach (CheckBox chkBox in this.panelTableName.Children) { if (chkBox.IsChecked == true) { listTable.Add((chkBox.Content as TextBlock).Text.ToString()); } } bool boolResult = true; string strResult = string.Empty; string[] arTable = listTable.ToArray(); try { MainApp._I_SystemService.SYS_Initialize(arTable, (this.chkInitCell.IsChecked == true)); } catch (Exception ex) { boolResult = false; strResult = ex.Message; } MainApp._MessageDialog.ShowResult(boolResult,strResult); } } /// /// 全选或反选 /// private void chkAllCheck_Click(object sender, RoutedEventArgs e) { foreach (CheckBox chkBox in this.panelTableName.Children) { chkBox.IsChecked = !chkBox.IsChecked; } } } }