void client_GetVendorsCompleted(object sender, GetVendorsCompletedEventArgs e) { if (e.Error == null) { ComboBoxVendor.ItemsSource = e.Result; } else { SystemMessages sm; if (e.Error is FaultException <CustomServiceFault> ) { FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else { sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Vendors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } if (ComboBoxVendor.Items.Count > 0) { ComboBoxVendor.SelectedIndex = 0; } }
void client_GetVendorsCompleted(object sender, GetVendorsCompletedEventArgs e) { if (e.Error == null) ComboBoxVendor.ItemsSource = e.Result; else { SystemMessages sm; if (e.Error is FaultException<CustomServiceFault>) { FaultException<CustomServiceFault> fault = e.Error as FaultException<CustomServiceFault>; sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } else sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Vendors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.ShowPopup(); } if (ComboBoxVendor.Items.Count > 0) ComboBoxVendor.SelectedIndex = 0; }