diff --git a/MainWindow.xaml b/MainWindow.xaml index 65ed723..44886a5 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -68,7 +68,7 @@ - + @@ -115,9 +115,15 @@ - + + + + + + + + + + diff --git a/WindowsView/User.xaml.cs b/WindowsView/User.xaml.cs new file mode 100644 index 0000000..c230873 --- /dev/null +++ b/WindowsView/User.xaml.cs @@ -0,0 +1,85 @@ +using SunlightCentralizedControlManagement_SCCM_.View; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Text.RegularExpressions; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace SunlightCentralizedControlManagement_SCCM_.WindowsView +{ + /// + /// Machine.xaml 的交互逻辑 + /// + public partial class User : Window + { + + CheckBox[] checkBoxes = new CheckBox[99]; + string[] strings = new string[0] { }; + public User() + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + InitializeComponent(); + } + + private async void user_Loaded(object sender, RoutedEventArgs e)//打开页面执行 + { + for (int i = 0; i < strings.Length; i++) + { + checkBoxes[i] = new CheckBox(); + checkBoxes[i].Content = strings[i].ToString(); + checkBoxes[i].FontSize = 20; + checkBoxes[i].Width = 80; + checkBoxes[i].Height = 50; + checkBoxes[i].IsEnabled = false; + Capacity.Children.Add(checkBoxes[i]); + } + } + + + + private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件 + { + //Regex re = new Regex("[^0-9.-]+"); + Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数 + e.Handled = !re.IsMatch(e.Text); + } + string Capacity_; + private void DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 + { + int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量 + if (rownum != -1)//判断鼠标定位是否有效 + { + /*定位选中行及指定列单元格文本信息*/ + _Name.Text = (DataGriduser.Columns[0].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();//定位第列 + GROUP.Text = (DataGriduser.Columns[1].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim(); + Capacity_ = (DataGriduser.Columns[2].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim(); + Note.Text = (DataGriduser.Columns[3].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim(); + } + + Pasword.Text = null; //清除密码框 + } + + private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件 + { + Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数 + Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串 + + string name = _Name.Text; + string password = Pasword.Text; + string Group = GROUP.Text; + int Cap = 0; + string note = Note.Text; + string Stuff_sql; + + + + } + + private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件 + { + + } + } +}