private void btnUpdate_Click(object sender, RoutedEventArgs e) { if (selectedGateway == null) { return; } try { Mouse.OverrideCursor = Cursors.Wait; IndoorPositioningClient.UpdateGateway(selectedGateway); /* Load the list again */ Load(); /* Select the same item from the list. */ lstGateways.SelectedIndex = selectedIndex; Mouse.OverrideCursor = Cursors.Arrow; } catch (Exception ex) { Mouse.OverrideCursor = Cursors.Arrow; MessageBox.Show(ex.ToString()); } }