private Task AddProgressIndicatorAsync(string message, bool isLast = false) { var taskSource = new TaskCompletionSource <bool>(); var indicator = new ProgressIndicator(); indicator.Loaded += OnProgressIndicatorLoaded; indicator.Text = message; indicator.IsLast = isLast; indicator.Visibility = Visibility.Collapsed; indicator.Margin = new Thickness(40, 0, 40, 0); Implicit.SetAnimations(indicator, OffsetImplicitAnimations); Implicit.SetShowAnimations(indicator, IndicatorShowAnimations); CardsPanel.Children.Add(indicator); void OnProgressIndicatorLoaded(object sender, RoutedEventArgs e) { indicator.Loaded -= OnProgressIndicatorLoaded; indicator.Visibility = Visibility.Visible; taskSource.TrySetResult(true); } return(taskSource.Task); }
private async void PlayBtn_Loaded(object sender, RoutedEventArgs e) { await Task.Delay(1000); var showAnimations = new AnimationCollection { new TranslationAnimation { Delay = TimeSpan.FromSeconds(0.3), SetInitialValueBeforeDelay = true, Duration = TimeSpan.FromSeconds(0.6), From = "0,-20,0", To = "0,0,0" }, new OpacityAnimation { Delay = TimeSpan.FromSeconds(0.3), SetInitialValueBeforeDelay = true, Duration = TimeSpan.FromSeconds(0.6), From = 0, To = 1 } }; Implicit.SetShowAnimations(PlayBtn, showAnimations); }
private async Task Init() { var loadDataTask = UpdateSections(); var recentSamplesTask = Samples.GetRecentSamples(); var gitHubTask = Data.GitHub.GetPublishedReleases(); await Task.WhenAll(loadDataTask, recentSamplesTask, gitHubTask); RecentSamples = recentSamplesTask.Result; GitHubReleases = gitHubTask.Result; var counter = 1; var delay = 70; foreach (var child in InnerGrid.Children) { if (child is ItemsControl itemsControl == false) { Implicit.GetShowAnimations(child).Add(new OpacityAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(300), Delay = TimeSpan.FromMilliseconds(counter++ *delay), SetInitialValueBeforeDelay = true }); } } Root.Visibility = Visibility.Visible; }
internal static async Task <bool> ShowNextForPagingWithTestimonials(string site, int pageIndex, int pageSize) { await using var cmd = new SqlCommand("[dbo].[GetWorksPagingWithTestimonials]", new Base().SqlConnection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add("@Site", SqlDbType.NVarChar, 25).Value = site; cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value = pageIndex; cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value = pageSize; SqlParameter showNext = cmd.Parameters.Add("@ShowNext", SqlDbType.Bit); showNext.Direction = ParameterDirection.Output; await cmd.Connection.OpenAsync(); await cmd.ExecuteNonQueryAsync(); await cmd.Connection.CloseAsync(); bool output = Implicit.Bool(showNext.Value); return(output); }
private void SetAnimationsForAppTiles() { int Counter = 1; foreach (AppTile Tile in AppGrid.Children.OfType <AppTile>()) { int Duration = Counter * 80; AnimationCollection Col = new AnimationCollection(); OpacityAnimation O = new OpacityAnimation { Duration = new TimeSpan(0, 0, 0, 0, Duration), From = 0, To = 1.0 }; TranslationAnimation T = new TranslationAnimation { Duration = new TimeSpan(0, 0, 0, 0, Duration), From = "0, 80, 0", To = "0" }; Col.Add(O); Col.Add(T); Implicit.SetShowAnimations(Tile, Col); Counter++; } }
public static void Main(string[] args) { DirectoryHelper.DropAndCreate("Logs"); Basic.Start().Wait(); Console.WriteLine("Basic is finished"); Implicit.Start().Wait(); Console.WriteLine("Implicit is finished"); Hybrid.Start().Wait(); Console.WriteLine("Hybrid is finished"); Console.ReadLine(); }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { var containerVisual = VisualExtensions.GetVisual(args.ItemContainer); if (args.InRecycleQueue) { containerVisual.ImplicitAnimations = null; } else { Implicit.SetAnimations(args.ItemContainer, OffsetImplicitAnimations); } }
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(); }
// 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(); }
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); }
private void Load() { SampleController.Current.RegisterNewCommand("Toggle Visibility", (sender, args) => { if (_element != null) { _element.Visibility = _element.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed; } }); SampleController.Current.RegisterNewCommand("Move Element", (sender, args) => { if (_element != null) { Canvas.SetTop(_element, _random.NextDouble() * this.ActualHeight); Canvas.SetLeft(_element, _random.NextDouble() * this.ActualWidth); } }); SampleController.Current.RegisterNewCommand("Scale Element", (sender, args) => { if (_element != null) { var visual = ElementCompositionPreview.GetElementVisual(_element); visual.Scale = new Vector3( (float)_random.NextDouble() * 2, (float)_random.NextDouble() * 2, 1); } }); SampleController.Current.RegisterNewCommand("Toggle animations", (sender, args) => { if (_element != null) { Implicit.SetAnimations(_element, _areAnimationsToggled ? null : _animationSet); _areAnimationsToggled = !_areAnimationsToggled; } }); }
public async Task <IActionResult> OnPostSaveComment(string author, string email, string text, string exists) { if ((string.IsNullOrWhiteSpace(author)) || (string.IsNullOrWhiteSpace(email)) || (string.IsNullOrWhiteSpace(text)) || (string.IsNullOrWhiteSpace(exists))) { return(ViewComponent("Comments")); } var commentsComponentModel = Session.Json.GetObject <CommentsComponentModel>(HttpContext.Session, Session.Key.CommentsComponentModel); PostDataModel?post = await BlogService.GetPostById(commentsComponentModel.PostId).ConfigureAwait(true); if (post == null) { throw new NullReferenceException("Post could not be derived from session."); } var commentModel = new CommentModel { Author = author, Email = email, IsAdmin = User.Identity.IsAuthenticated, Text = text }; bool elementExists = Implicit.Bool(exists); // the website form key should have been removed by javascript unless the comment was posted by a spam robot // ReSharper disable once InvertIf if (!elementExists) { post.Comments.Add(commentModel); await BlogService.SavePost(post).ConfigureAwait(false); } return(ViewComponent("Comments")); }
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)); }
internal static async Task <int> PagingCountWithTestimonials(string site) { await using var cmd = new SqlCommand("[dbo].[GetWorksPagingWithTestimonialsReturnCount]", new Base().SqlConnection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add("@Site", SqlDbType.NVarChar, 25).Value = site; SqlParameter countParameter = cmd.Parameters.Add("@Count", SqlDbType.Int); countParameter.Direction = ParameterDirection.Output; await cmd.Connection.OpenAsync(); await cmd.ExecuteNonQueryAsync(); await cmd.Connection.CloseAsync(); int output = Implicit.Int32(countParameter.Value, 0); return(output); }
public void OnXamlRendered(FrameworkElement control) { _element = control.FindChild("Element"); _animationSet = Implicit.GetAnimations(_element); _areAnimationsToggled = true; }
public void ImplicitConversion(Implicit i) { Assert.Equal("abc", i.Value); }
private void OnAdjusterListLoaded(object sender, RoutedEventArgs e) => Implicit.SetAnimations(AdjusterList, OffsetImplicitAnimations);