public async Task EndAsyncOperationAsync(string message = null) { if (this.notificationCount < 1) { return; } if (this.toastIndicator != null) { if (!string.IsNullOrEmpty(message)) { this.toastIndicator.IsAnimated = false; this.toastIndicator.Description = message; this.toastIndicator.ToastType = ToastType.Default; } await Task.Delay(DelayBeforeNormalCloseMs); this.notificationCount--; if (this.toastIndicator != null && this.notificationCount == 0) { this.toastIndicator.Hide(); this.toastIndicator = null; } } }
private void OnIndicatorTapped(object sender, TappedRoutedEventArgs e) { ToastIndicator indicator = (ToastIndicator)sender; if (this.cancelledAction != null) { this.cancelledAction(); this.cancelledAction = null; } indicator.Tapped -= this.OnIndicatorTapped; indicator.Hide(); }
/* * // * Android toasts are now disabled; inbuilt toasts are used instead. * // */ void Start() { Initializer initializer = GameObject.FindGameObjectWithTag("Initializer").GetComponent <Initializer>(); taskManager = initializer.taskManager.GetComponent <TaskManager>(); marksManager = initializer.marksManager; toastIndicator = initializer.toastIndicator; editSubjects = initializer.editSubjects; editTaskHW = initializer.editTaskHW; editTaskAT = initializer.editTaskAT; editTaskRV = initializer.editTaskRV; editMarks = initializer.editMarks; }
private static ToastIndicator GetIndicator() { ToastIndicator indicator = null; var frame = Window.Current.Content as Frame; if (frame != null && frame.Content is Page) { var page = (Page)frame.Content; var indicators = TreeHelper.FindVisualChildren <ToastIndicator>(page); indicator = indicators.FirstOrDefault(i => i.IsEnabled && i.Visibility == Visibility.Visible); } return(indicator); }
public static void ShowToast(string message, string tittle, ToastIndicator indicator) { switch (indicator) { case ToastIndicator.Ok: ShowToast(message, tittle, Color.PaleGreen); break; case ToastIndicator.Warning: ShowToast(message, tittle, Color.PaleGoldenrod); break; case ToastIndicator.Error: ShowToast(message, tittle, Color.PaleVioletRed); break; } }
public void StartAsyncOperation() { this.toastIndicator = GetIndicator(); if (this.toastIndicator != null) { this.notificationCount++; if (this.notificationCount > 1) { return; } if (this.toastIndicator.IsAnimationRunning) { this.toastIndicator.StopAnimation(); } this.toastIndicator.IsAnimated = true; this.toastIndicator.Show(ToastType.Default); } }