public void SaveUserSettings(ExtensionSettings settings) { try { SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider); WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists("Team Room Extension")) { userSettingsStore.CreateCollection("Team Room Extension"); } userSettingsStore.SetInt32("Team Room Extension", "RoomId", settings.TeamRoomId); userSettingsStore.SetString("Team Room Extension", "TeamProjectUri", settings.ProjectCollectionUri != null ? settings.ProjectCollectionUri.ToString() : ""); } catch (Exception ex) { } }
// Set the background worker to poll for messages for the selected room. private void cmbRoomList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { // Clear messages and Room Users messages.Clear(); RefreshMessages(); RoomUsers.Clear(); RefreshRoomUsers(); int oldRoomId = teamRoom == null ? 0 : teamRoom.Id; if (cmbRoomList.SelectedValue == null || projectCollectionUri == null) { return; } teamRoom = cmbRoomList.SelectedValue as Room; if (teamRoom != null) { SignIntoRoom(oldRoomId, teamRoom.Id); TfsMonitor.Instance.DoWork(projectCollectionUri, teamRoom.Id); RoomWorker.Instance.PollRoomUsers(projectCollectionUri, teamRoom.Id, PollRoomUsers_NewUsers, PollRoomUsers_Complete); var settings = new ExtensionSettings { ProjectCollectionUri = projectCollectionUri, TeamRoomId = teamRoom.Id }; TeamRoomWindowCommand.Instance.SaveUserSettings(settings); } } catch (Exception ex) { // Log errors TeamRoomWindowCommand.Instance.LogError(ex); } }