public void ShowInView()
    {
        var actionSheet = new UIActionSheet();
        actionSheet.AddButton("OK");
        actionSheet.AddButton("Cancel");
        actionSheet.Dismissed += (sender, e) =>
        {
            Console.WriteLine("Dismissed: " + e.Index);
        };
        actionSheet.Clicked += (sender, e) =>
        {
            Console.WriteLine("Clicked: " + e.Index);
        };
        actionSheet.Canceled += (sender, e) =>
        {
            Console.WriteLine("Canceled!");
        };
        actionSheet.Presented += (sender, e) =>
        {
            Console.WriteLine("Presented!");
        };
        actionSheet.WillDismiss += (sender, e) =>
        {
            Console.WriteLine("WillDismiss: " + e.Index);
        };
        actionSheet.WillPresent += (sender, e) =>
        {
            Console.WriteLine("WillPresent!");
        };

        actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow.RootViewController.View);
    }
 public void ButtonTitle()
 {
     string text = Guid.NewGuid().ToString("N");
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton(text);
     Assert.AreEqual(text, actionSheet.ButtonTitle(0));
 }
    public void NewObject()
    {
        var obj = new UIActionSheet();

        Assert.AreNotEqual(IntPtr.Zero, obj.ClassHandle);
        Assert.AreNotEqual(IntPtr.Zero, obj.Handle);
    }
Beispiel #4
0
    public void UIActionSheetExample()
    {
		if (Application.platform != RuntimePlatform.IPhonePlayer)
		{
			Debug.Log("Only supported on iOS!");
			return;
		}

        var actionSheet = new UIActionSheet();
        actionSheet.AddButton("Option 1");
        actionSheet.AddButton("Option 2");
        actionSheet.Title = "Title";

		actionSheet.Clicked += (sender, e) => 
		{
			int option = e.Index + 1;
			Debug.Log(string.Format ("Option {0} clicked!", option));
		};
		actionSheet.Dismissed += (sender, e) => 
		{
			Debug.Log("Dismissed");
		};

        var controller = GetUnityController();
        actionSheet.ShowInView(controller.View);
    }
 public void CancelButtonIndex()
 {
     var actionSheet = new UIActionSheet();
     Assert.AreEqual(-1, actionSheet.CancelButtonIndex);
 }
 public void FirstOtherButtonIndex()
 {
     var actionSheet = new UIActionSheet();
     Assert.AreEqual(-1, actionSheet.FirstOtherButtonIndex);
 }
 public void IsVisible()
 {
     var actionSheet = new UIActionSheet();
     Assert.IsFalse(actionSheet.Visible);
 }
 public void AddButton()
 {
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton("TEST");
     Assert.AreEqual(1, actionSheet.ButtonCount);
 }
 public void ObjectSame()
 {
     var a = new UIActionSheet();
     var b = Runtime.GetNSObject<UIActionSheet>(a.Handle);
     Assert.AreSame(a, b);
 }
Beispiel #10
0
 public void NewObjectDispose()
 {
     var obj = new UIActionSheet();
     obj.Dispose();
 }
Beispiel #11
0
    public void Unsubscribe()
    {
        int count = 0;
        EventHandler callback = (sender, e) =>
        {
            count++;
        };

        var actionSheet = new UIActionSheet();
        actionSheet.AddButton("OK");
        actionSheet.WillPresent += callback;
        actionSheet.WillPresent += callback;
        actionSheet.WillPresent -= callback;
        actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow.RootViewController.View);
        actionSheet.DismissWithClickedButtonIndex(-1, false);
        System.Threading.Thread.Sleep(500);

        Assert.AreEqual(1, count);
    }
Beispiel #12
0
 public void Dismiss()
 {
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton("OK");
     actionSheet.AddButton("Cancel");
     actionSheet.DismissWithClickedButtonIndex(-1, false);
 }