diff --git a/samples/Main.storyboard b/samples/Main.storyboard index 3bfe3f6..e8473fe 100644 --- a/samples/Main.storyboard +++ b/samples/Main.storyboard @@ -1,10 +1,9 @@ - - - - + + - + + @@ -20,26 +19,48 @@ - - + + + + + + + + + + @@ -47,11 +68,15 @@ + + + + diff --git a/samples/ToastSamples.csproj b/samples/ToastSamples.csproj index 8a72460..54bcee8 100644 --- a/samples/ToastSamples.csproj +++ b/samples/ToastSamples.csproj @@ -38,4 +38,10 @@ + + + + SdkOnly + $(MtouchExtraArgs) --weak-framework=NewsstandKit + \ No newline at end of file diff --git a/samples/ViewController.cs b/samples/ViewController.cs index 758efa1..b8817ae 100644 --- a/samples/ViewController.cs +++ b/samples/ViewController.cs @@ -18,8 +18,28 @@ public override void ViewDidLoad() { base.ViewDidLoad(); + CSToastManager.SetQueueEnabled(true); + BasicUsageBtn.TouchUpInside += (sender, e) => MakeBasic(); MakeWithDurationBtn.TouchUpInside += (sender, e) => MakeWithDurationAndPosition(); + HideToastsBtn.TouchUpInside += (s, e) => HideAllToast(); + HideToastsAndClearQueueBtn.TouchUpInside += (s, e) => HideToastAndClearQueue(); + ClearQueueBtn.TouchUpInside += (s, e) => ClearQueue(); + } + + private void ClearQueue() + { + ToastService.ClearToastQueue(View!); + } + + private void HideToastAndClearQueue() + { + ToastService.HideAllToasts(View!); + } + + private void HideAllToast() + { + ToastService.HideAllToasts(View!, false); } private void MakeBasic() diff --git a/samples/ViewController.designer.cs b/samples/ViewController.designer.cs index 851c5eb..4bb9862 100644 --- a/samples/ViewController.designer.cs +++ b/samples/ViewController.designer.cs @@ -15,6 +15,15 @@ partial class ViewController [Outlet] UIKit.UIButton BasicUsageBtn { get; set; } + [Outlet] + UIKit.UIButton ClearQueueBtn { get; set; } + + [Outlet] + UIKit.UIButton HideToastsAndClearQueueBtn { get; set; } + + [Outlet] + UIKit.UIButton HideToastsBtn { get; set; } + [Outlet] UIKit.UIButton MakeWithDurationBtn { get; set; } @@ -25,6 +34,21 @@ void ReleaseDesignerOutlets () BasicUsageBtn = null; } + if (ClearQueueBtn != null) { + ClearQueueBtn.Dispose (); + ClearQueueBtn = null; + } + + if (HideToastsBtn != null) { + HideToastsBtn.Dispose (); + HideToastsBtn = null; + } + + if (HideToastsAndClearQueueBtn != null) { + HideToastsAndClearQueueBtn.Dispose (); + HideToastsAndClearQueueBtn = null; + } + if (MakeWithDurationBtn != null) { MakeWithDurationBtn.Dispose (); MakeWithDurationBtn = null; diff --git a/src/ApiDefinition.cs b/src/ApiDefinition.cs index 88ddea5..8a49235 100644 --- a/src/ApiDefinition.cs +++ b/src/ApiDefinition.cs @@ -42,6 +42,15 @@ void ShowToast( [Export("hideToast:")] void HideToast(UIView view); + + [Export("hideAllToasts")] + void HideAllToasts(); + + [Export("hideAllToasts:clearQueue:")] + void HideAllToasts(bool includeActivity, bool clearQueue); + + [Export("clearToastQueue")] + void ClearToastQueue(); } [BaseType(typeof(NSObject))] diff --git a/src/ToastService.cs b/src/ToastService.cs index d0600eb..4fe2d8a 100644 --- a/src/ToastService.cs +++ b/src/ToastService.cs @@ -15,6 +15,21 @@ public static void HideToast(UIView view, UIView toast) view.HideToast(toast); } + public static void HideAllToasts(UIView view) + { + view.HideAllToasts(); + } + + public static void HideAllToasts(UIView view, bool clearQueue) + { + view.HideAllToasts(false, clearQueue); + } + + public static void ClearToastQueue(UIView view) + { + view.ClearToastQueue(); + } + public static void ShowToast(UIView parentView, UIView toastView, ToastPosition? toastPosition = null,