bool IsValid() { bool isValid = true; if (string.IsNullOrEmpty(TextBoxAcronym.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Acronym", SystemMessage = "Please provide valid Acronym.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAcronym.Focus(); }); #if !SILVERLIGHT #endif sm.ShowPopup(); return(isValid); } if (!TextBoxIDCode.Text.IsInteger() || Convert.ToInt32(TextBoxIDCode.Text) < 0) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid ID Code", SystemMessage = "Please provide valid integer value for ID Code.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxIDCode.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxNominalFrequency.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Nominal Frequency", SystemMessage = "Please provide valid integer value for Nominal Frequency.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxNominalFrequency.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxFramesPerSecond.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Frames Per Second", SystemMessage = "Please provide valid integer value for Frames Per Second.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxFramesPerSecond.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxLagTime.Text.IsDouble()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Lag Time", SystemMessage = "Please provide valid numeric value for Lag Time.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxLagTime.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxLeadTime.Text.IsDouble()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Lead Time", SystemMessage = "Please provide valid numeric value for Lead Time.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxLeadTime.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxLoadOrder.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Load Order", SystemMessage = "Please provide valid integer value for Load Order.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxLoadOrder.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxTimeResolution.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Time Resolution", SystemMessage = "Please provide valid integer value for Time Resolution.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxTimeResolution.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxCurrentScalingValue.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Current Scaling Value", SystemMessage = "Please provide valid integer value for Current Scaling Value.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxCurrentScalingValue.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxVoltageScalingValue.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Voltage Scaling Value", SystemMessage = "Please provide valid integer value for Voltage Scaling Value.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxVoltageScalingValue.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxAnalogScalingValue.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Analog Scaling Value", SystemMessage = "Please provide valid integer value for Analog Scaling Value.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAnalogScalingValue.Focus(); }); sm.ShowPopup(); return(isValid); } if (!TextBoxDigitalMaskValue.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Digital Mask Value", SystemMessage = "Please provide valid integer value for Digital Mask Value.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxDigitalMaskValue.Focus(); }); sm.ShowPopup(); return(isValid); } return(isValid); }
bool IsValid() { bool isValid = true; if (string.IsNullOrEmpty(TextBoxAcronym.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Acronym", SystemMessage = "Please provide valid Acronym.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAcronym.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); return(isValid); } if (!TextBoxLoadOrder.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Load Order", SystemMessage = "Please provide valid integer value for Load Order.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxLoadOrder.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); return(isValid); } if (!TextBoxIDCode.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid ID Code", SystemMessage = "Please provide valid integer value for ID Code.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxIDCode.Focus(); TextBoxIDCode.Text = "0"; }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); sm.WindowStartupLocation = WindowStartupLocation.CenterOwner; #endif sm.ShowPopup(); return(isValid); } return(isValid); }