public void Manual_ShareTextLinkImage () { var service = CreateService (); var item = new Item ("Hello image from Android!"); item.Links.Add (new Uri ("http://xamarin.com")); item.Images.Add (new ImageData (TestRunner.Shared.Assets.Open ("what_does_that_mean_trollcat.jpg"), "image/jpeg")); var intent = service.GetShareUI (TestRunner.Shared, item, result => { Console.WriteLine ("AUTHENTICATE RESULT = " + result); item.Dispose (); }); TestRunner.Shared.StartActivityForResult (intent, 42); }
public void Manual_ShareText () { var service = CreateService (); var item = new Item { Text = "This is just a test. Don't mind me...", }; var vc = service.GetShareUI (item, result => { Console.WriteLine ("SHARE RESULT = " + result); item.Dispose (); AppDelegate.Shared.RootViewController.DismissModalViewControllerAnimated (true); }); AppDelegate.Shared.RootViewController.PresentViewController (vc, true, null); }
public void Manual_ShareTextLink () { var service = CreateService (); var item = new Item { Text = "Hey everyone, I'm going to be spamming Facebook for a little while. Don't mind me!", }; item.Links.Add (new Uri ("http://praeclarum.org")); var vc = service.GetShareUI (item, result => { Console.WriteLine ("SHARE RESULT = " + result); item.Dispose (); AppDelegate.Shared.RootViewController.DismissModalViewControllerAnimated (true); }); AppDelegate.Shared.RootViewController.PresentViewController (vc, true, null); }
public void Manual_ShareTextLink () { var service = CreateService (); var item = new Item { Text = "This is just a test. Don't mind me...", }; item.Links.Add (new Uri ("http://docs.xamarin.com/ios/getting_started/intro_to_mvc_in_ios")); var vc = service.GetShareUI (item, result => { Console.WriteLine ("SHARE RESULT = " + result); item.Dispose (); AppDelegate.Shared.RootViewController.DismissModalViewControllerAnimated (true); }); AppDelegate.Shared.RootViewController.PresentViewController (vc, true, null); }
public void Manual_ShareTextImageLinks () { var service = CreateService (); var item = new Item { Text = "Hello, World from Android", }; item.Images.Add (new ImageData (TestRunner.Shared.Assets.Open ("what_does_that_mean_trollcat.jpg"), "image/jpeg")); item.Links.Add (new Uri ("http://xamarin.com")); item.Links.Add (new Uri ("https://twitter.com/xamarinhq")); var intent = service.GetShareUI (TestRunner.Shared, item, result => { Console.WriteLine ("SHARE RESULT = " + result); item.Dispose (); }); TestRunner.Shared.StartActivityForResult (intent, 42); }
public void Manual_ShareImageTextLinks () { var service = CreateService (); var item = new Item { Text = "Hello, World", }; item.Images.Add ("Images/what_does_that_mean_trollcat.jpg"); item.Links.Add (new Uri ("http://xamarin.com")); item.Links.Add (new Uri ("https://twitter.com/xamarinhq")); var vc = service.GetShareUI (item, result => { Console.WriteLine ("SHARE RESULT = " + result); item.Dispose (); AppDelegate.Shared.RootViewController.DismissModalViewControllerAnimated (true); }); AppDelegate.Shared.RootViewController.PresentViewController (vc, true, null); }
public static void printIterator(Iterator iterator, String pre) { Item item = new Item(); iterator.open(); while (iterator.next(item)) { printItem(item, pre); } item.Dispose(); iterator.close(); iterator.Dispose(); }
public static void printItem(Item item, String pre) { if (item.isAtomic()) { Item typeItem = item.getType(); System.Console.WriteLine(pre + "Leaf Atomic: \"" + item.getStringValue() + "\" \ttype:" + typeItem.getStringValue()); typeItem.Dispose(); return; } if (item.isNode()) { int kind = item.getNodeKind(); if (kind == 0) { // anyNode System.Console.WriteLine(pre + "Any node"); System.Console.WriteLine( pre + " Children:"); printIterator(item.getChildren(), pre+" "); } if (kind == 1) { // doc System.Console.WriteLine( pre + "Doc" ); System.Console.WriteLine( pre + " Children:" ); printIterator(item.getChildren(), pre+" "); } if (kind == 2) { // element Item nodeName = new Item(); item.getNodeName(nodeName); Item typeItem = item.getType(); System.Console.WriteLine( pre + "Start Element: ", nodeName.getStringValue(), " \ttype:", typeItem.getStringValue() ); System.Console.WriteLine( pre + " Attributes:" ); printIterator(item.getAttributes(), pre+" "); System.Console.WriteLine( pre + " Children:" ); printIterator(item.getChildren(), pre+" "); System.Console.WriteLine( pre + "End Element: " + nodeName.getStringValue() ); typeItem.Dispose(); nodeName.Dispose(); } if (kind == 3) { // attribute Item nodeName = new Item(); item.getNodeName(nodeName); Item typeItem = item.getType(); System.Console.WriteLine( pre + "Attribute: " + nodeName.getStringValue() + "= \"" + item.getStringValue() + "\" \ttype:" + typeItem.getStringValue()); System.Console.WriteLine( pre+" Atomization value:"); printIterator(item.getAtomizationValue(), pre+" "); typeItem.Dispose(); nodeName.Dispose(); } if (kind == 4) { // text Item typeItem = item.getType(); System.Console.WriteLine( pre + "Text: " + item.getStringValue() + " \ttype:" + typeItem.getStringValue() ); System.Console.WriteLine( pre + " Atomization value:" ); printIterator(item.getAtomizationValue(), pre+" "); typeItem.Dispose(); } if (kind == 5) { // pi Item nodeName = new Item(); item.getNodeName(nodeName); System.Console.WriteLine( pre + "Pi: " + nodeName.getStringValue() ); nodeName.Dispose(); } if (kind == 6) { // comment System.Console.WriteLine( pre + "Comment: " + item.getStringValue() ); } } else { System.Console.WriteLine( pre+"Item not Node, not Atomic"); } }