private void InitializeTipGroups() { var groups = GetTipGroups(); TipGroupsListBox.Children.Clear(); foreach (var g in groups) { var checkbox = new CheckBox() { IsChecked = g.Value, Content = g.Key }; checkbox.Checked += Checkbox_Tip_Group_Checked; checkbox.Unchecked += Checkbox_Tip_Group_Unchecked; TipGroupsListBox.Children.Add(checkbox); } ShowAgainComboBox.ItemsSource = DisplayCadence.KnownDisplayCadences; ShowAgainComboBox.SelectedValue = VSTipHistoryManager.GetInstance().GetCadence(); LastDisplayTime = VSTipHistoryManager.GetInstance().GetLastDisplayTime(); ShowAgainComboBox.SelectionChanged += ShowAgainComboBox_SelectionChanged; UpdateShowAgainUI(); }
private void Checkbox_Checked(object sender, RoutedEventArgs e) { if (e.Source is CheckBox checkbox) { VSTipHistoryManager.Instance().MarkTipGroupAsIncluded(checkbox.Content.ToString().Trim()); } }
private async void ShowAgainComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { UpdateShowAgainUI(); await VSTipHistoryManager.GetInstance().SetCadenceAsync(DisplayCadence.FromName(ShowAgainComboBox.SelectedValue.ToString())); } catch { } }
private void CheckBox_Tip_Level_Checked(object sender, RoutedEventArgs e) { if (e.Source is CheckBox checkbox) { if (Enum.TryParse(checkbox.Content.ToString(), out TipLevel level)) { VSTipHistoryManager.GetInstance().MarkTipLevelAsIncluded(level); } } }
private Dictionary <string, bool> GetTipGroups() { var tipManager = new TipManager(); var allTipGroups = tipManager.GetPrioritizedTipGroups(); var tipGroupStatus = new Dictionary <string, bool>(StringComparer.OrdinalIgnoreCase); foreach (var tipGroup in allTipGroups.Where(t => t != null).SelectMany(t => t)) { tipGroupStatus[tipGroup.groupId] = !VSTipHistoryManager.Instance().IsTipGroupExcluded(tipGroup.groupId); } return(tipGroupStatus); }
private void InitializeTipLevels() { var tipLevels = Enum.GetValues(typeof(TipLevel)); TipLevelsListBox.Children.Clear(); foreach (var l in tipLevels) { var checkbox = new CheckBox() { IsChecked = !VSTipHistoryManager.GetInstance().IsTipLevelExcluded((TipLevel)l), Content = (TipLevel)l }; checkbox.Checked += CheckBox_Tip_Level_Checked; checkbox.Unchecked += Checkbox_Tip_Level_Unchecked; TipLevelsListBox.Children.Add(checkbox); } }
public static void LogTelemetryEvent(VSTipHistoryManager manager, string eventName, params object[] nameAndProperties) { var excludedGroups = manager.GetAllExcludedTipGroups(); var excludedTipLevels = manager.GetAllExcludedTipLevels(); var tipHistory = manager.GetTipHistory(); string excludedGroupStr = string.Join(";", excludedGroups); string excludedLevelStr = string.Join(";", excludedTipLevels.Select(l => l.ToString())); string tipHistoryStr = string.Join(";", tipHistory); var properties = nameAndProperties.Concat( new[] { "ExcludedTipGroups", excludedGroupStr, "ExcludedTipLevels", excludedLevelStr, "TipHistory", tipHistoryStr }).ToArray(); VSTelemetryHelper.PostEvent(eventName, properties); }