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 for a device.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAcronym.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxAccessID.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Access ID", SystemMessage = "Please provide valid integer value for Access ID.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAccessID.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxTimeAdjustmentTicks.Text.IsLong()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Time Adjustment Ticks", SystemMessage = "Please provide valid integer value for Time Adjustment Ticks.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxTimeAdjustmentTicks.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxDataLossInterval.Text.IsDouble()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Data Loss Interval", SystemMessage = "Please provide valid numeric value for Data Loss Interval.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxDataLossInterval.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #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); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxAllowedParsingExceptions.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Allowed Parsing Exceptions", SystemMessage = "Please provide valid integer value for Allowed Parsing Exceptions.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAllowedParsingExceptions.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxParsingExceptionWindow.Text.IsDouble()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Parsing Exception Window", SystemMessage = "Please provide valid numeric value for Parsing Exception Window.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxParsingExceptionWindow.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxDelayedConnectionInterval.Text.IsDouble()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Delayed Connection Interval", SystemMessage = "Please provide valid numeric value for Delayed Connection Interval.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxDelayedConnectionInterval.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxMeasurementReportingInterval.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Measurement Reporting Interval", SystemMessage = "Please provide valid integer value for Measurement Reporting Interval.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxMeasurementReportingInterval.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif 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); #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); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxMeasurementReportingInterval.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Measurement Reporting Interval", SystemMessage = "Please provide valid integer value for Measurement Reporting Interval.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxMeasurementReportingInterval.Text = "100000"; TextBoxMeasurementReportingInterval.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } return(isValid); }