TrackEvent() публичный статический Метод

public static TrackEvent ( string category, string action, string label = "", long value ) : void
category string
action string
label string
value long
Результат void
Пример #1
0
 private async void DocumentationTextblock_OnLinkClicked(object sender, LinkClickedEventArgs e)
 {
     TrackingManager.TrackEvent("Link", e.Link);
     if (Uri.TryCreate(e.Link, UriKind.Absolute, out Uri result))
     {
         await Launcher.LaunchUriAsync(new Uri(e.Link));
     }
 }
        private async void InfoAreaPivot_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (InfoAreaPivot.SelectedItem != null)
            {
                if (DataContext is Sample sample)
                {
                    TrackingManager.TrackEvent("PropertyGrid", (InfoAreaPivot.SelectedItem as FrameworkElement)?.Name, sample.Name);
                }
            }

            if (CurrentSample == null)
            {
                return;
            }

            if (InfoAreaPivot.SelectedItem == PropertiesPivotItem)
            {
                // If we switch to the Properties Panel, we want to use a binded version of the Xaml Code.
                if (CurrentSample.HasXAMLCode)
                {
                    _lastRenderedProperties = true;

                    UpdateXamlRender(CurrentSample.BindedXamlCode);
                }

                return;
            }

            if (CurrentSample.HasXAMLCode && InfoAreaPivot.SelectedItem == XamlPivotItem && _lastRenderedProperties)
            {
                // Use this flag so we don't re-render the XAML tab if we're switching from tabs other than the properties one.
                _lastRenderedProperties = false;

                // If we switch to the Live Preview, then we want to use the Value based Text
                XamlCodeEditor.Text = CurrentSample.UpdatedXamlCode;

                UpdateXamlRender(CurrentSample.UpdatedXamlCode);
                await XamlCodeEditor.ResetPosition();

                XamlCodeEditor.Focus(FocusState.Programmatic);
                return;
            }

            if (CurrentSample.HasXAMLCode && InfoAreaPivot.SelectedItem == XamlReadOnlyPivotItem)
            {
                // Update Read-Only XAML tab on non-desktop devices to show changes to Properties
                XamlReadOnlyCodeRenderer.SetCode(CurrentSample.UpdatedXamlCode, "xaml");
            }

            if (CurrentSample.HasCSharpCode && InfoAreaPivot.SelectedItem == CSharpPivotItem)
            {
                var code = await CurrentSample.GetCSharpSourceAsync();

                CSharpCodeRenderer.SetCode(code, "c#");

                return;
            }
        }
Пример #3
0
 /// <summary>
 /// Navigates to a Sample
 /// </summary>
 /// <param name="sample">Sample to navigate to</param>
 public void NavigateToSample(Sample sample)
 {
     if (sample == null)
     {
         NavigationFrame.Navigate(typeof(About), null, new SuppressNavigationTransitionInfo());
     }
     else
     {
         NavigationFrame.Navigate(typeof(SampleController), sample);
         TrackingManager.TrackEvent("sample", "navigation", sample.Name);
     }
 }
        private async void GitHub_OnClick(object sender, RoutedEventArgs e)
        {
            var url = CurrentSample.CodeUrl;

            TrackingManager.TrackEvent("Link", url);
            try
            {
                await Launcher.LaunchUriAsync(new Uri(url));
            }
            catch
            {
            }
        }
Пример #5
0
 /// <summary>
 /// Navigates to a Sample
 /// </summary>
 /// <param name="sample">Sample to navigate to</param>
 public void NavigateToSample(Sample sample)
 {
     if (sample == null)
     {
         System.Console.WriteLine($"Navigating to about");
         NavigationFrame.Navigate(typeof(About), null, new SuppressNavigationTransitionInfo());
         System.Console.WriteLine($"Navigated to about");
     }
     else
     {
         NavigationFrame.Navigate(typeof(SampleController), sample);
         TrackingManager.TrackEvent("sample", "navigation", sample.Name);
     }
 }
Пример #6
0
        private async void DocumentationTextBlock_OnLinkClicked(object sender, LinkClickedEventArgs e)
        {
            TrackingManager.TrackEvent("Link", e.Link);
            var link = e.Link;

            if (e.Link.EndsWith(".md"))
            {
                link = string.Format("https://docs.microsoft.com/en-us/windows/communitytoolkit/{0}/{1}", CurrentSample.CategoryName.ToLower(), link.Replace(".md", string.Empty));
            }

            if (Uri.TryCreate(link, UriKind.Absolute, out Uri result))
            {
                await Launcher.LaunchUriAsync(result);
            }
        }
        private void ProcessSampleEditorTime()
        {
            if (CurrentSample != null &&
                CurrentSample.HasXAMLCode &&
                _xamlCodeRendererSupported)
            {
                if (XamlCodeEditor.TimeSampleEditedFirst != DateTime.MinValue &&
                    XamlCodeEditor.TimeSampleEditedLast != DateTime.MinValue)
                {
                    int secondsEditingSample = (int)Math.Floor((XamlCodeEditor.TimeSampleEditedLast - XamlCodeEditor.TimeSampleEditedFirst).TotalSeconds);
                    TrackingManager.TrackEvent("xamleditor", "edited", CurrentSample.Name, secondsEditingSample);
                }
                else
                {
                    TrackingManager.TrackEvent("xamleditor", "not_edited", CurrentSample.Name);
                }
            }

            XamlCodeEditor.ResetTimer();
        }
Пример #8
0
        private void ProcessSampleEditorTime()
        {
            if (HamburgerMenu.CurrentSample != null &&
                HamburgerMenu.CurrentSample.HasXAMLCode &&
                _xamlCodeRendererSupported)
            {
                if (_timeSampleEditedFirst != DateTime.MinValue &&
                    _timeSampleEditedLast != DateTime.MinValue)
                {
                    int secondsEdditingSample = (int)Math.Floor((_timeSampleEditedLast - _timeSampleEditedFirst).TotalSeconds);
                    TrackingManager.TrackEvent("xamleditor", "edited", HamburgerMenu.CurrentSample.Name, secondsEdditingSample);
                }
                else
                {
                    TrackingManager.TrackEvent("xamleditor", "not_edited", HamburgerMenu.CurrentSample.Name);
                }
            }

            _timeSampleEditedFirst = _timeSampleEditedLast = DateTime.MinValue;
        }
        private async void DocumentationTextBlock_OnLinkClicked(object sender, LinkClickedEventArgs e)
        {
            TrackingManager.TrackEvent("Link", e.Link);
            var link = e.Link;

            if (link.EndsWith(".md"))
            {
                // Link to one of our other documents, so we'll construct the proper link here
                link = string.Format("https://docs.microsoft.com/windows/communitytoolkit/{0}/{1}", CurrentSample.RemoteDocumentationPath, link.Replace(".md", string.Empty));
            }
            else if (link.StartsWith("/"))
            {
                // We don't root our links to other docs.microsoft.com pages anymore, so we'll add it here.
                link = string.Format("https://docs.microsoft.com{0}", link);
            }

            if (Uri.TryCreate(link, UriKind.Absolute, out Uri result))
            {
                await Launcher.LaunchUriAsync(result);
            }
        }
Пример #10
0
        private async void InfoAreaPivot_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (InfoAreaPivot.SelectedItem != null)
            {
                var sample = DataContext as Sample;

                if (sample != null)
                {
                    TrackingManager.TrackEvent("PropertyGrid", (InfoAreaPivot.SelectedItem as FrameworkElement)?.Name, sample.Name);
                }
            }

            if (InfoAreaPivot.SelectedItem == PropertiesPivotItem)
            {
                return;
            }

            if (_currentSample == null)
            {
                return;
            }

            if (_currentSample.HasXAMLCode)
            {
                XamlCodeRenderer.XamlSource = _currentSample.UpdatedXamlCode;
            }

            if (_currentSample.HasCSharpCode)
            {
                CSharpCodeRenderer.CSharpSource = await _currentSample.GetCSharpSourceAsync();
            }

            if (_currentSample.HasJavaScriptCode)
            {
                JavaScriptCodeRenderer.JavaScriptSource = await _currentSample.GetJavaScriptSourceAsync();
            }
        }
Пример #11
0
 private void GitHub_OnClick(object sender, RoutedEventArgs e)
 {
     TrackingManager.TrackEvent("Link", GitHub.NavigateUri.ToString());
 }
Пример #12
0
 private async void DocumentationTextblock_OnLinkClicked(object sender, LinkClickedEventArgs e)
 {
     TrackingManager.TrackEvent("Link", e.Link);
     await Launcher.LaunchUriAsync(new Uri(e.Link));
 }
Пример #13
0
        private async void InfoAreaPivot_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (InfoAreaPivot.SelectedItem != null)
            {
                if (DataContext is Sample sample)
                {
                    TrackingManager.TrackEvent("PropertyGrid", (InfoAreaPivot.SelectedItem as FrameworkElement)?.Name, sample.Name);
                }
            }

            if (_currentSample == null)
            {
                return;
            }

            if (InfoAreaPivot.SelectedItem == PropertiesPivotItem)
            {
                // If we switch to the Properties Panel, we want to use a binded version of the Xaml Code.
                if (_currentSample.HasXAMLCode)
                {
                    _lastRenderedProperties = true;

                    var t = UpdateXamlRenderAsync(_currentSample.BindedXamlCode);
                }

                return;
            }

            if (_currentSample.HasXAMLCode && InfoAreaPivot.SelectedItem == XamlPivotItem && _lastRenderedProperties)
            {
                // Use this flag so we don't re-render the XAML tab if we're switching from tabs other than the properties one.
                _lastRenderedProperties = false;

                // If we switch to the Live Preview, then we want to use the Value based Text
                XamlCodeRenderer.Text = _currentSample.UpdatedXamlCode;

                var t = UpdateXamlRenderAsync(_currentSample.UpdatedXamlCode);
                await XamlCodeRenderer.RevealPositionAsync(new Position(1, 1));

                return;
            }

            if (_currentSample.HasXAMLCode && InfoAreaPivot.SelectedItem == XamlReadOnlyPivotItem)
            {
                // Update Read-Only XAML tab on non-desktop devices to show changes to Properties
                XamlReadOnlyCodeRenderer.XamlSource = _currentSample.UpdatedXamlCode;
            }

            if (_currentSample.HasCSharpCode && InfoAreaPivot.SelectedItem == CSharpPivotItem)
            {
                CSharpCodeRenderer.CSharpSource = await _currentSample.GetCSharpSourceAsync();

                return;
            }

            if (_currentSample.HasJavaScriptCode && InfoAreaPivot.SelectedItem == JavaScriptPivotItem)
            {
                JavaScriptCodeRenderer.JavaScriptSource = await _currentSample.GetJavaScriptSourceAsync();

                return;
            }
        }