void client_GetOtherDeviceByDeviceIDCompleted(object sender, GetOtherDeviceByDeviceIDCompletedEventArgs e) { deviceToEdit = new OtherDevice(); if (e.Error == null) { deviceToEdit = e.Result; GridOtherDeviceDetail.DataContext = deviceToEdit; if (deviceToEdit.CompanyID.HasValue) { ComboboxCompany.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.CompanyID, deviceToEdit.CompanyName); } else { ComboboxCompany.SelectedIndex = 0; } if (deviceToEdit.InterconnectionID.HasValue) { ComboboxInterconnection.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.InterconnectionID, deviceToEdit.InterconnectionName); } else { ComboboxInterconnection.SelectedIndex = 0; } if (deviceToEdit.VendorDeviceID.HasValue) { ComboboxVendorDevice.SelectedItem = new KeyValuePair <int, string>((int)deviceToEdit.VendorDeviceID, deviceToEdit.VendorDeviceName); } else { ComboboxVendorDevice.SelectedIndex = 0; } } 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 Other Device Information by ID", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); } sm.ShowPopup(); } }
void client_GetOtherDeviceByDeviceIDCompleted(object sender, GetOtherDeviceByDeviceIDCompletedEventArgs e) { deviceToEdit = new OtherDevice(); if (e.Error == null) { deviceToEdit = e.Result; GridOtherDeviceDetail.DataContext = deviceToEdit; if (deviceToEdit.CompanyID.HasValue) ComboboxCompany.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.CompanyID, deviceToEdit.CompanyName); else ComboboxCompany.SelectedIndex = 0; if (deviceToEdit.InterconnectionID.HasValue) ComboboxInterconnection.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.InterconnectionID, deviceToEdit.InterconnectionName); else ComboboxInterconnection.SelectedIndex = 0; if (deviceToEdit.VendorDeviceID.HasValue) ComboboxVendorDevice.SelectedItem = new KeyValuePair<int, string>((int)deviceToEdit.VendorDeviceID, deviceToEdit.VendorDeviceName); else ComboboxVendorDevice.SelectedIndex = 0; } 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 Other Device Information by ID", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error }, ButtonType.OkOnly); sm.ShowPopup(); } }