public override void ViewDidLoad() { Projects = new ProjectsController(NavigationController); Settings = new SettingsController(NavigationController); MyStories = new MyStoriesController(NavigationController); var projectsElement = new ImageStringElement("Projects", Projects.PushViewController, Projects.Icon); projectsElement.Accessory = UITableViewCellAccessory.DisclosureIndicator; var settingsElement = new ImageStringElement("Settings", Settings.PushViewController, Settings.Icon); settingsElement.Accessory = UITableViewCellAccessory.DisclosureIndicator; var myStoriesElement = new ImageStringElement("My stories", MyStories.PushViewController, MyStories.Icon); myStoriesElement.Accessory = UITableViewCellAccessory.DisclosureIndicator; var menu = new RootElement("Main menu") { new Section() { projectsElement, myStoriesElement, settingsElement } }; var dv = new DialogViewController(menu) { Autorotate = true }; NavigationController.PushViewController(dv, false); }
public MenuViewController() : base(null) { InitMenuItem(); var section = new Section(); StringElement stringElement = new StringElement("Arkadiy Dobkin"); UIImage image = UIImage.FromBundle("Avatar_Ark"); ImageStringElement imageStringElement = new ImageStringElement("", image); section.Add(imageStringElement); section.Add(stringElement); section.AddAll(menuItems); Root = new RootElement("....") { section }; }
public void EchoDicomServer() { RootElement root = null; Section resultSection = null; var hostEntry = new EntryElement("Host", "Host name of the DICOM server", "server"); var portEntry = new EntryElement("Port", "Port number", "104"); var calledAetEntry = new EntryElement("Called AET", "Called application AET", "ANYSCP"); var callingAetEntry = new EntryElement("Calling AET", "Calling application AET", "ECHOSCU"); var echoButton = new StyledStringElement("Click to test", delegate { if (resultSection != null) { root.Remove(resultSection); } string message; var echoFlag = DoEcho(hostEntry.Value, Int32.Parse(portEntry.Value), calledAetEntry.Value, callingAetEntry.Value, out message); var echoImage = new ImageStringElement(String.Empty, echoFlag ? new UIImage("yes-icon.png") : new UIImage("no-icon.png")); var echoMessage = new StringElement(message); resultSection = new Section(String.Empty, "C-ECHO result") { echoImage, echoMessage }; root.Add(resultSection); }) { Alignment = UITextAlignment.Center, BackgroundColor = UIColor.Blue, TextColor = UIColor.White }; root = new RootElement("Echo DICOM server") { new Section { hostEntry, portEntry, calledAetEntry, callingAetEntry }, new Section { echoButton }, }; var dvc = new DialogViewController(root, true) { Autorotate = true }; navigation.PushViewController(dvc, true); }
public void FacebookLoggedIn(bool didLogIn, string accessToken, string userId, Exception error) { if (didLogIn) { var statusElement = dvcController.Root [0].Elements [0] as StyledStringElement; statusElement.Caption = "Logged In"; statusElement.BackgroundColor = UIColor.Green; _fb = new FacebookClient(accessToken); _fb.GetTaskAsync("me").ContinueWith(t => { if (!t.IsFaulted) { if (t.Exception != null) { new UIAlertView("Couldn't Load Profile", "Reason: " + t.Exception.Message, null, "Ok", null).Show(); return; } var result = (IDictionary <string, object>)t.Result; // available picture types: square (50x50), small (50xvariable height), large (about 200x variable height) (all size in pixels) // for more info visit http://developers.facebook.com/docs/reference/api string profilePictureUrl = string.Format("https://graph.facebook.com/{0}/picture?type={1}&access_token={2}", userId, "square", accessToken); UIImage profileImage = UIImage.LoadFromData(NSData.FromUrl(new NSUrl(profilePictureUrl))); string profileName = (string)result["name"]; var profile = new ImageStringElement(profileName, profileImage); BeginInvokeOnMainThread(() => { dvcController.Root[0].Add(profile); }); isLoggedIn = true; } }); } else { new UIAlertView("Failed to Log In", "Reason: " + error.Message, null, "Ok", null).Show(); } }
void ListMessages() { string[] messages = Directory.GetFiles(MyMailsDir); Section mails = new Section("Select a template"); ImageStringElement item = new ImageStringElement("New Message...", () => ItemClicked(null), _imgEml); item.Accessory = UITableViewCellAccessory.DisclosureIndicator; mails.Add(item); for (int i = 0; i < messages.Length; i++) { string fileName = Path.GetFileName(messages [i]); UIImage img = Path.GetExtension(fileName) == ".msg" ? _imgMsg : _imgEml; item = new ImageStringElement(fileName, () => ItemClicked(fileName), img); item.Accessory = UITableViewCellAccessory.DisclosureIndicator; mails.Add(item); } Root.Add(mails); }
public AddViewController(UIViewController theView, BaseItem ParentTask, long assignedID, int groupID, DateTime duedate) : base(null, true) { this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, delegate { this.DeactivateController(true); }); taskElement = new ImageStringElement("Item", Images.boxImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.Item, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? groupID: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); calendarElement = new ImageStringElement("Calendar Event", Images.AppleCalendar, delegate { this.NavigationController.PopViewControllerAnimated(false); addController = new EKEventEditViewController(); // set the addController's event store to the current event store. addController.EventStore = Util.MyEventStore; addController.Event = EKEvent.FromStore(Util.MyEventStore); if (duedate.Year < 2000) { duedate = DateTime.Today; } addController.Event.StartDate = duedate.AddHours(DateTime.Now.Hour); addController.Event.EndDate = duedate.AddHours(DateTime.Now.Hour + 1); addController.Completed += delegate(object theSender, EKEventEditEventArgs eva) { switch (eva.Action) { case EKEventEditViewAction.Canceled: theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Deleted: theView.NavigationController.DismissModalViewControllerAnimated(true); break; case EKEventEditViewAction.Saved: theView.NavigationController.DismissModalViewControllerAnimated(true); break; } }; theView.NavigationController.PresentModalViewController(addController, true); }); checkListElement = new ImageStringElement("List", Images.checkListImage, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new CheckList(assignedID) { Kind = TaskKind.List, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; var taskVC = new DetailViewController(task, true); taskVC.TaskListSaved += savedTask => { theView.NavigationController.PushViewController(new TaskViewController(savedTask.Description, true, savedTask), true); }; theView.NavigationController.PushViewController(taskVC, true); }); phoneCallElement = new ImageStringElement("Phone Call", Images.phoneImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.PhoneCall, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); emailElement = new ImageStringElement("Send an Email", Images.emailImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.Email, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); websiteElement = new ImageStringElement("Visit a Website", Images.globeImg, delegate { this.NavigationController.PopViewControllerAnimated(false); var task = new BaseItem(assignedID) { Kind = TaskKind.VisitAWebsite, ExternalParentID = ParentTask == null ? 0: ParentTask.ExternalID, ParentID = ParentTask == null ? 0: ParentTask.ID, GroupID = ParentTask == null ? 0: ParentTask.GroupID, OwnerID = ParentTask == null ? Settings.Sync.userID : ParentTask.OwnerID, DueDate = duedate }; theView.NavigationController.PushViewController(new DetailViewController(task, true), true); }); Root = new RootElement("Add new item") { new Section() { taskElement, calendarElement, checkListElement, }, new Section() { phoneCallElement, emailElement, websiteElement, } }; /// }