Esempio n. 1
0
    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);
    }
Esempio n. 2
0
 public void ButtonTitle()
 {
     string text = Guid.NewGuid().ToString("N");
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton(text);
     Assert.AreEqual(text, actionSheet.ButtonTitle(0));
 }
Esempio n. 3
0
    public void NewObject()
    {
        var obj = new UIActionSheet();

        Assert.AreNotEqual(IntPtr.Zero, obj.ClassHandle);
        Assert.AreNotEqual(IntPtr.Zero, obj.Handle);
    }
Esempio n. 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);
    }
Esempio n. 5
0
 public void CancelButtonIndex()
 {
     var actionSheet = new UIActionSheet();
     Assert.AreEqual(-1, actionSheet.CancelButtonIndex);
 }
Esempio n. 6
0
 public void FirstOtherButtonIndex()
 {
     var actionSheet = new UIActionSheet();
     Assert.AreEqual(-1, actionSheet.FirstOtherButtonIndex);
 }
Esempio n. 7
0
 public void IsVisible()
 {
     var actionSheet = new UIActionSheet();
     Assert.IsFalse(actionSheet.Visible);
 }
Esempio n. 8
0
 public void AddButton()
 {
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton("TEST");
     Assert.AreEqual(1, actionSheet.ButtonCount);
 }
Esempio n. 9
0
 public void ObjectSame()
 {
     var a = new UIActionSheet();
     var b = Runtime.GetNSObject<UIActionSheet>(a.Handle);
     Assert.AreSame(a, b);
 }
Esempio n. 10
0
 public void NewObjectDispose()
 {
     var obj = new UIActionSheet();
     obj.Dispose();
 }
Esempio n. 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);
    }
Esempio n. 12
0
 public void Dismiss()
 {
     var actionSheet = new UIActionSheet();
     actionSheet.AddButton("OK");
     actionSheet.AddButton("Cancel");
     actionSheet.DismissWithClickedButtonIndex(-1, false);
 }