Advertisement
Guest User

HomeScreen.cs

a guest
Oct 21st, 2011
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using MonoTouch.Foundation;
  5. using MonoTouch.UIKit;
  6. using MonoTouch.Dialog;
  7.  
  8. namespace ad4youTest
  9. {
  10.     [Preserve (AllMembers=true)]
  11.     class Settings {
  12.         [Section ("Multiline")]
  13.         [Caption ("This is a\nmultiline string\nall you need is the\n[Multiline] attribute")]
  14.         [Multiline]
  15.         public string multi;
  16.     }
  17.    
  18.         public partial class AppDelegate
  19.         {
  20.         Settings settings;
  21.        
  22.         public void DemoReflectionApi ()
  23.         {  
  24.             if (settings == null){
  25.                
  26.                 settings = new Settings () {
  27.                 };
  28.             }
  29.             var bc = new BindingContext (null, settings, "Settings");
  30.             var dv = new DialogViewController (bc.Root, true);
  31.            
  32.             // When the view goes out of screen, we fetch the data.
  33.             dv.ViewDissapearing += delegate {
  34.                 bc.Fetch();
  35.             };
  36.             navigation.PushViewController(dv, false);
  37.         }
  38.     }
  39.    
  40.     public partial class HomeScreen : UIViewController
  41.     {
  42.         SearchScreen searchScreen;
  43.         //loads the HomeScreen.xib file and connects it to this object
  44.         public HomeScreen () : base ("HomeScreen", null)
  45.         {
  46.             Title = NSBundle.MainBundle.LocalizedString ("Start", "Start");
  47.             TabBarItem.Image = UIImage.FromBundle ("Images/house");
  48.         }
  49.        
  50.         public override void ViewDidLoad ()
  51.         {
  52.             base.ViewDidLoad ();
  53.            
  54.             this.searchButton.TouchUpInside += (sender, e) => {
  55.                 if(this.searchScreen == null)
  56.                 {
  57.                     this.searchScreen = new SearchScreen();
  58.                 }
  59.                 this.NavigationController.PushViewController(searchScreen, true);
  60.             };
  61.         }
  62.     }
  63. }
  64.  
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement