Skip to content

Commit c71c234

Browse files
committed
[chore] 添加事件追踪
1 parent 86676d5 commit c71c234

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

FluentWeather.Uwp/Controls/Dialogs/AboutDialog.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public sealed partial class AboutDialog : ContentDialog
2828
public AboutDialog()
2929
{
3030
this.InitializeComponent();
31-
#if (!DEBUG)
32-
Analytics.TrackEvent("AboutOpened");
33-
#endif
31+
Analytics.TrackEvent("AboutOpened", new Dictionary<string, string> { { "CurrentVersion", AppVersion } });
3432
}
3533
[RelayCommand]
3634
public void Close()

FluentWeather.Uwp/Controls/Dialogs/SetLocationDialog.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using Windows.UI.Xaml.Media;
2222
using Windows.UI.Xaml.Navigation;
2323
using FluentWeather.Uwp.Shared;
24+
using Microsoft.AppCenter.Analytics;
2425

2526
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板
2627

@@ -53,6 +54,7 @@ private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialo
5354
{
5455
Common.Settings.DefaultGeolocation = ChosenGeolocation;
5556
Hide();
57+
Analytics.TrackEvent("DefaultLocationChanged", new Dictionary<string, string> { { "CityName", ChosenGeolocation.Name } });
5658
}
5759

5860
private async void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)

FluentWeather.Uwp/Controls/Dialogs/TyphoonDialog.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using FluentWeather.Abstraction.Models;
66
using FluentWeather.DIContainer;
77
using FluentWeather.Uwp.Shared;
8+
using Microsoft.AppCenter.Analytics;
89
using Microsoft.Extensions.DependencyInjection;
910
using System;
1011
using System.Collections.Generic;
@@ -40,6 +41,7 @@ public TyphoonDialog()
4041
GetTyphoons();
4142
ShowWarningLines();
4243
DataContext = this;
44+
Analytics.TrackEvent("TyphoonDialogOpened");
4345
}
4446
public const string MapStyleSheetJson = "{\"version\":\"1.*\",\"settings\":{},\"elements\":{\"transportation\":{\"visible\":false},\"road\":{\"labelVisible\":false}}}";
4547
[ObservableProperty]

FluentWeather.Uwp/Pages/MainPage.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Windows.UI.Xaml.Navigation;
2424
using Microsoft.Graphics.Canvas.Effects;
2525
using System.Threading.Tasks;
26+
using Microsoft.AppCenter.Analytics;
2627

2728
// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“空白页”项模板
2829

@@ -50,6 +51,7 @@ public MainPage()
5051
private void DailyItemClicked(object sender, ItemClickEventArgs e)
5152
{
5253
DailyView.SelectedItem = e.ClickedItem as WeatherDailyBase;
54+
Analytics.TrackEvent("DailyViewEntered");
5355
}
5456

5557
private Visibility GetPrecipChartVisibility(PrecipitationBase precip)

FluentWeather.Uwp/ViewModels/CitiesPageViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Microsoft.Toolkit.Uwp.UI.Controls.TextToolbarSymbols;
2020
using Windows.UI.Xaml;
2121
using FluentWeather.Uwp.Shared;
22+
using Microsoft.AppCenter.Analytics;
2223

2324
namespace FluentWeather.Uwp.ViewModels;
2425

@@ -53,6 +54,7 @@ public void SaveCity(GeolocationBase city)
5354
{
5455
Cities.Add(city);
5556
Query = city.Name;
57+
Analytics.TrackEvent("CitySaved", new Dictionary<string, string> { { "CityName", city.Name } });
5658
}
5759
[RelayCommand]
5860
public void DeleteCity(GeolocationBase item)

FluentWeather.Uwp/ViewModels/MainPageViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using FluentWeather.Tasks;
88
using FluentWeather.Uwp.Helpers;
99
using FluentWeather.Uwp.Shared;
10+
using Microsoft.AppCenter.Analytics;
1011
using Microsoft.Extensions.DependencyInjection;
1112
using System;
1213
using System.Collections.Generic;
@@ -66,7 +67,7 @@ public async Task GetDailyForecast(double lon, double lat)
6667
{
6768
SunRise = astronomic.SunRise;
6869
SunSet = astronomic.SunSet;
69-
}
70+
}
7071
}
7172
public async Task GetHourlyForecast(double lon,double lat)
7273
{
@@ -162,8 +163,7 @@ public async void GetWeather(GeolocationBase geo)
162163
{
163164
await Refresh();
164165
}
165-
166-
166+
Analytics.TrackEvent("WeatherDataObtained", new Dictionary<string, string> { { "CityName", geo.Name } });
167167
}
168168
[RelayCommand]
169169
public void SpeechWeather()

0 commit comments

Comments
 (0)