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); } return(isValid); }
void PopulateFormFields(OutputStream selectedOutputStream) { GridOutputStreamDetail.DataContext = selectedOutputStream; ComboBoxNode.SelectedItem = new KeyValuePair <string, string>(selectedOutputStream.NodeID, selectedOutputStream.NodeName); if (selectedOutputStream.Type == 0) { ComboBoxType.SelectedItem = new KeyValuePair <int, string>(0, "IEEE C37.118"); } else { ComboBoxType.SelectedItem = new KeyValuePair <int, string>(1, "BPA"); } ComboboxCoordinateFormat.SelectedItem = selectedOutputStream.CoordinateFormat; ComboboxDownsamplingMethod.SelectedItem = selectedOutputStream.DownsamplingMethod; ComboboxDataFormat.SelectedItem = selectedOutputStream.DataFormat; CheckBoxAllowSortsByArrival.IsChecked = selectedOutputStream.AllowSortsByArrival; CheckBoxAutoPublishConfigFrame.IsChecked = selectedOutputStream.AutoPublishConfigFrame; CheckBoxAutoStartDataChannel.IsChecked = selectedOutputStream.AutoStartDataChannel; CheckBoxEnabled.IsChecked = selectedOutputStream.Enabled; CheckBoxUseLocalClockAsRealTime.IsChecked = selectedOutputStream.UseLocalClockAsRealTime; CheckBoxPerformTimestampCheck.IsChecked = selectedOutputStream.PerformTimestampReasonabilityCheck; m_oldAcronym = selectedOutputStream.Acronym; m_oldName = selectedOutputStream.Name; #if !SILVERLIGHT if (m_inEditMode) { ButtonInitialize.Visibility = System.Windows.Visibility.Visible; } #endif TextBoxAcronym.SelectAll(); TextBoxAcronym.Focus(); }
void AddNew_Loaded(object sender, RoutedEventArgs e) { #if !SILVERLIGHT GetDevices(DeviceType.Concentrator, ((App)Application.Current).NodeValue, true); GetCompanies(); GetNodes(); GetHistorians(); GetInterconnections(); GetVendorDevices(); GetProtocols(); GetTimeZones(); #endif if (hasQueryString || m_deviceID > 0) { m_activityWindow = new ActivityWindow("Loading Data... Please Wait..."); #if SILVERLIGHT m_activityWindow.Show(); #else m_activityWindow.Owner = Window.GetWindow(this); m_activityWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; m_activityWindow.Show(); ButtonInitialize.Visibility = System.Windows.Visibility.Visible; #endif m_inEditMode = true; GetDeviceByDeviceID(m_deviceID); } else if (m_deviceToCopy == null) { ClearForm(); } else { PopulateFormFields(m_deviceToCopy); //TextBoxAcronym.Focus(); TextBoxAcronym.SelectAll(); } }
void PopulateFormFields(Device device) { GridDeviceDetail.DataContext = device; if (ComboboxNode.Items.Count > 0) { ComboboxNode.SelectedItem = new KeyValuePair <string, string>(device.NodeID, device.NodeName); } if (device.CompanyID.HasValue) { ComboboxCompany.SelectedItem = new KeyValuePair <int, string>((int)device.CompanyID, device.CompanyName); } else if (ComboboxCompany.Items.Count > 0) { ComboboxCompany.SelectedIndex = 0; } if (device.HistorianID.HasValue) { ComboboxHistorian.SelectedItem = new KeyValuePair <int, string>((int)device.HistorianID, device.HistorianAcronym); } else if (ComboboxHistorian.Items.Count > 0) { ComboboxHistorian.SelectedIndex = 0; } if (device.InterconnectionID.HasValue) { ComboboxInterconnection.SelectedItem = new KeyValuePair <int, string>((int)device.InterconnectionID, device.InterconnectionName); } else if (ComboboxInterconnection.Items.Count > 0) { ComboboxInterconnection.SelectedIndex = 0; } if (device.ParentID.HasValue) { ComboboxParent.SelectedItem = new KeyValuePair <int, string>((int)device.ParentID, device.ParentAcronym); } else if (ComboboxParent.Items.Count > 0) { ComboboxParent.SelectedIndex = 0; } if (device.ProtocolID.HasValue) { ComboboxProtocol.SelectedItem = new KeyValuePair <int, string>((int)device.ProtocolID, device.ProtocolName); } else if (ComboboxProtocol.Items.Count > 0) { ComboboxProtocol.SelectedIndex = 0; } if (string.IsNullOrEmpty(device.TimeZone) && ComboboxTimeZone.Items.Count > 0) { ComboboxTimeZone.SelectedIndex = 0; } else { foreach (KeyValuePair <string, string> item in ComboboxTimeZone.Items) { if (item.Key == device.TimeZone) { ComboboxTimeZone.SelectedItem = item; break; } } } if (device.VendorDeviceID.HasValue) { ComboboxVendorDevice.SelectedItem = new KeyValuePair <int, string>((int)device.VendorDeviceID, device.VendorDeviceName); } else if (ComboboxVendorDevice.Items.Count > 0) { ComboboxVendorDevice.SelectedIndex = 0; } if (device.IsConcentrator) //then display list of devices. { GetDeviceListByParentID(device.ID); StackPanelDeviceList.Visibility = Visibility.Visible; StackPanelPhasorsMeassurements.Visibility = Visibility.Collapsed; TextBlockTitle.Text = "Devices For Concentrator: " + device.Acronym; } else { StackPanelPhasorsMeassurements.Visibility = Visibility.Visible; StackPanelDeviceList.Visibility = Visibility.Collapsed; } //Get rid of alternate command channel from connection string to display it in it's own textbox. int indexOfCommandChannel = device.ConnectionString.ToLower().IndexOf("commandchannel"); if (indexOfCommandChannel > 0) { TextBoxConnectionString.Text = device.ConnectionString.Substring(0, indexOfCommandChannel); TextBoxAlternateCommandChannel.Text = device.ConnectionString.Substring(indexOfCommandChannel + 15).Replace("{", "").Replace("}", ""); } else { TextBoxConnectionString.Text = device.ConnectionString; } TextBlockRuntimeID.Text = CommonFunctions.GetRuntimeID(null, "Device", device.ID); TextBoxAcronym.SelectAll(); TextBoxAcronym.Focus(); }
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 for a comapny.", 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 (string.IsNullOrEmpty(TextBoxMapAcronym.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Map Acronym", SystemMessage = "Please provide valid Map Acronym for a company.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxMapAcronym.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (string.IsNullOrEmpty(TextBoxName.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Name", SystemMessage = "Please provide valid Name for a company.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxName.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.Text = "0"; TextBoxLoadOrder.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } return(isValid); }
private void DeviceUserControl_Loaded(object sender, RoutedEventArgs e) { TextBoxAcronym.Focus(); }
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 (string.IsNullOrEmpty(TextBoxAssemblyName.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Assembly Name", SystemMessage = "Please provide valid Assembly Name.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxAssemblyName.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (string.IsNullOrEmpty(TextBoxTypeName.Text.CleanText())) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Type Name", SystemMessage = "Please provide valid Type Name.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxTypeName.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif sm.ShowPopup(); return(isValid); } if (!TextBoxMinMeasurements.Text.IsInteger()) { isValid = false; SystemMessages sm = new SystemMessages(new Message() { UserMessage = "Invalid Minimum Measurements to Use", SystemMessage = "Please provide valid integer value for Minimum Measurements to Use.", UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.Closed += new EventHandler(delegate(object sender, EventArgs e) { TextBoxMinMeasurements.Focus(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif 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(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif 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(); }); #if !SILVERLIGHT sm.Owner = Window.GetWindow(this); #endif 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(); }); #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 (!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.Text = "330000"; TextBoxTimeResolution.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 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); }