Ejemplo n.º 1
0
        private async void StartSearchingTags(string style, string text, double x, double y)
        {
            // loading container
            var container = new StackPanel {
                Orientation = Orientation.Horizontal
            };

            // setup loading indicator
            var loadingNotebookIcon = new LoadingIndicator
            {
                SpeedRatio = 1,
                IsActive   = true,
                Width      = ICON_SIZE_BIGGER,
                Height     = ICON_SIZE_BIGGER
            };

            loadingNotebookIcon.SetResourceReference(StyleProperty, style);
            container.Children.Add(loadingNotebookIcon);

            // setup loading text
            var textBlock = new TextBlock
            {
                Text              = text,
                FontFamily        = new System.Windows.Media.FontFamily("Segoe UI Light"),
                FontSize          = FONT_SIZE_BIGGER,
                VerticalAlignment = VerticalAlignment.Center,
                Margin            = new Thickness(10, 0, 0, 0)
            };

            textBlock.SetResourceReference(ForegroundProperty, "AccentColorBrush");
            container.Children.Add(textBlock);

            // setup and run
            Canvas.SetLeft(container, x);
            Canvas.SetTop(container, y);
            MainCanvas.Children.Add(container);

            // wait a coupe of seconds and show notebooks
            await Task.Delay(TAG_EXTRACT_TIME_MS);

            await Dispatcher.InvokeAsync(() =>
            {
                if (!_reseted)
                {
                    MainCanvas.Children.Remove(container);

                    SetupTagIcons(x + 100, y);
                }
            });
        }