Ejemplo n.º 1
0
        private void Header_Effects_Click(object sender, RoutedEventArgs e)
        {
            Implicit.SetShowAnimations(sequence, (AnimationCollection)Resources["PullFromLeft"]);
            Implicit.SetHideAnimations(sequence, (AnimationCollection)Resources["PushLeft"]);

            instrument.Visibility = Visibility.Collapsed;
            sequence.Visibility   = Visibility.Collapsed;
            effects.Visibility    = Visibility.Visible;

            _instrument.FontWeight = FontWeights.Normal;
            _sequence.FontWeight   = FontWeights.Normal;
            _effects.FontWeight    = FontWeights.Bold;

            HeaderAnim.Offset((float)(HeaderAnim.ActualWidth * 2)).Start();
        }
Ejemplo n.º 2
0
        // Header
        private void Header_Instrument_Click(object sender, RoutedEventArgs e)
        {
            // Ensure that the middle tab animates correctly
            Implicit.SetShowAnimations(sequence, (AnimationCollection)Resources["PullFromRight"]);
            Implicit.SetHideAnimations(sequence, (AnimationCollection)Resources["PushRight"]);

            instrument.Visibility = Visibility.Visible;
            sequence.Visibility   = Visibility.Collapsed;
            effects.Visibility    = Visibility.Collapsed;

            _instrument.FontWeight = FontWeights.Bold;
            _sequence.FontWeight   = FontWeights.Normal;
            _effects.FontWeight    = FontWeights.Normal;

            HeaderAnim.Offset(0).Start();
        }
Ejemplo n.º 3
0
        private Task RenderCardElementAsync(AdaptiveCardRenderer renderer, AdaptiveCardParseResult card)
        {
            var taskSource = new TaskCompletionSource <bool>();

            // Get the RenderedAdaptiveCard from the parse result.
            var renderResult = renderer.RenderAdaptiveCard(card.AdaptiveCard);

            renderResult.Action += OnRenderResultAction;

            // Add the AdaptiveCard UIElement to the Visual Tree.
            if (renderResult.FrameworkElement is FrameworkElement cardElement)
            {
                cardElement.Loaded    += OnCardElementLoaded;
                cardElement.Visibility = Visibility.Collapsed;
                cardElement.Margin     = new Thickness(12, 0, 12, 0);

                Implicit.SetAnimations(cardElement, OffsetImplicitAnimations);
                Implicit.SetShowAnimations(cardElement, CardElementShowAnimations);
                Implicit.SetHideAnimations(cardElement, CardElementHideAnimations);

                CardsPanel.Children.Add(cardElement);
            }

            void OnCardElementLoaded(object sender, RoutedEventArgs e)
            {
                cardElement.Loaded -= OnCardElementLoaded;

                cardElement.Visibility = Visibility.Visible;
            }

            async void OnRenderResultAction(RenderedAdaptiveCard sender, AdaptiveActionEventArgs args)
            {
                renderResult.Action -= OnRenderResultAction;

                if (args.Action.ActionType == ActionType.Submit)
                {
                    sender.FrameworkElement.Visibility = Visibility.Collapsed;
                    await Task.Delay(600);

                    taskSource.TrySetResult(true);
                }
            }

            return(taskSource.Task);
        }
Ejemplo n.º 4
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // Don't show animation when the app is first loaded - this still goes into effect too soon
            Implicit.SetShowAnimations(instrument, (AnimationCollection)Resources["PullFromLeft"]);

            chaosColors = new List <SolidColorBrush>()
            {
                (SolidColorBrush)Resources["red"], (SolidColorBrush)Resources["orange"],
                (SolidColorBrush)Resources["yellow"], (SolidColorBrush)Resources["lime"],
            };

            List <(string, string, string)> chaosText = new List <(string, string, string)>()
            {
                ("Attack + Release", "Attack", "Release"), ("Delay", "Delay Feedback", "Delay Volume"),
                ("Volume + Filter", "Volume", "Filter Cutoff"), ("Chorus + Crush", "Chorus", "Crush")
            };

            for (int i = 0; i < 4; i++)
            {
                ChaosControl cc = new ChaosControl(500, 80, chaosColors[i], new SolidColorBrush((Windows.UI.Color)Application.Current.Resources["SystemBaseMediumColor"]), chaosText[i].Item1, chaosText[i].Item2, chaosText[i].Item3);
                Implicit.SetShowAnimations(cc.ChaosCanvas, (AnimationCollection)Resources["Shower"]);
                Implicit.SetHideAnimations(cc.ChaosCanvas, (AnimationCollection)Resources["Hider"]);
                Implicit.SetShowAnimations(cc.GhostCanvas, (AnimationCollection)Resources["Ghost-Shower"]);
                Implicit.SetHideAnimations(cc.GhostCanvas, (AnimationCollection)Resources["Ghost-Hider"]);

                Chaos.Children.Add(cc.GhostCanvas);
                Chaos.Children.Add(cc.ChaosCanvas);

                ChaosControlsPanel.Children.Add(cc.ChaosButtons);
            }

            // Navigate to the Web Synth
            // Since this only hanldes audio processing - it does not get added to the grid
            string src = "ms-appx-web:///Assets/web/index.html";

            WebSynth = new WebView(WebViewExecutionMode.SeparateProcess); // This seems to help reduce UI/Audio hangs
            WebSynth.NavigationCompleted += Navigation_Completed;
            WebSynth.Navigate(new Uri(src));
        }