private void Confirm_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Get Text
                LineNum      = LineNumText.Text.ToString();
                LineName     = LineNameText.Text.ToString();
                TotalMileage = Convert.ToSingle(TotalMileageText.Text);
                CreateTime   = DateTime.Now;
            }
            catch (System.FormatException)
            {
                WarningLabel.Content = "输入内容无效, 请重新输入";
                return;
            }
            if (!isEdit)
            {
                // Check LineNum is New
                List <libMetroTunnelDB.Line> line_list = new List <libMetroTunnelDB.Line>();
                Database.QueryLine(ref line_list, LineNum);
                if (line_list.Count > 0)
                {
                    WarningLabel.Content = "线路已存在,请直接选择该线路";
                    return;
                }
            }
            // Confirm Dialog
            List <String> confirm_list = new List <String>();

            if (!isEdit)
            {
                confirm_list.Add("请确认以下输入信息无误:");
            }
            else
            {
                confirm_list.Add("请确认以下修改信息无误:");
            }
            confirm_list.Add("线路编号: " + LineNum);
            confirm_list.Add("线路名称: " + LineName);
            confirm_list.Add("总里程: " + TotalMileage + "公里");
            confirm_list.Add("记录创建时间:" + CreateTime.ToString());
            ConfirmDialog confirmDialog = new ConfirmDialog(confirm_list);

            confirmDialog.true_false_event += new ConfirmDialog.TrueFalseDelegate(Confirm_Process);
            confirmDialog.ShowDialog();
        }
Exemplo n.º 2
0
        private void Confirm_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DetectDeviceNum  = DetectDeviceNumText.Text.ToString();
                DetectDeviceName = DetectDeviceNameText.Text.ToString();
                CreateTime       = DateTime.Now;
            }
            catch (System.FormatException)
            {
                WarningLabel.Content = "输入内容无效,请重新输入";
                return;
            }
            if (!isEdit)
            {
                // Check DetectDeviceNum is New
                List <libMetroTunnelDB.DetectDevice> detectDevices = new List <DetectDevice>();
                Database.QueryDetectDevice(ref detectDevices, DetectDeviceNum);
                if (detectDevices.Count > 0)
                {
                    WarningLabel.Content = "设备已存在,请直接选择该设备";
                    return;
                }
            }
            List <String> confirm_list = new List <String>();

            if (!isEdit)
            {
                confirm_list.Add("请确认以下输入信息无误:");
            }
            else
            {
                confirm_list.Add("请确认以下修改信息无误:");
            }
            confirm_list.Add("线路编号: " + DetectDeviceNum);
            confirm_list.Add("线路名称: " + DetectDeviceName);
            confirm_list.Add("记录创建时间:" + CreateTime.ToString());
            ConfirmDialog confirmDialog = new ConfirmDialog(confirm_list);

            confirmDialog.true_false_event += new ConfirmDialog.TrueFalseDelegate(Confirm_Process);
            confirmDialog.ShowDialog();
        }
Exemplo n.º 3
0
        private void Confirm_Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DatabaseAddress = DatabaseAddressText.Text;
                DatabaseUser    = DatabaseUserText.Text;
                DatabaseKey     = DatabaseKeyText.Password;
            }
            catch (System.Exception)
            {
                WarningLabel.Content = "输入内容无效,请重新输入";
                return;
            }
            // Address processing
            String[] Address_list = DatabaseAddress.Split(":");
            if (Address_list.Length == 2)
            {
                DatabaseIP   = Address_list[0];
                DatabasePort = Address_list[1];
            }
            else
            {
                WarningLabel.Content = "输入地址无效,请按如127.0.0.1:3306的格式输入";
                return;
            }

            List <String> confirm_list = new List <string>();

            confirm_list.Add("请确认以下输入信息无误: ");
            confirm_list.Add("数据库地址:" + DatabaseIP);
            confirm_list.Add("用户名:" + DatabasePort);
            ConfirmDialog confirmDialog = new ConfirmDialog(confirm_list);

            confirmDialog.true_false_event += new ConfirmDialog.TrueFalseDelegate(ConfirmProcess);
            confirmDialog.ShowDialog();
        }