public override void ViewDidLoad() { base.ViewDidLoad(); InitializeHelloWorldServiceClient(); View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; getRandomMonkeyButton = CreateFlatButton(); getRandomMonkeyButton.Frame = new RectangleF(padding, 22.0f, this.View.Frame.Width - (padding * 2), controlHeight); getRandomMonkeyButton.SetTitle("Get Random Monkey", UIControlState.Normal); getRandomMonkeyButton.TouchUpInside += (object sender, EventArgs e) => monkeyServiceClient.GetRandomMonkeyNameAsync(); randomMonkeyName = new UILabel { Frame = new RectangleF(padding, getRandomMonkeyButton.Frame.Bottom, this.View.Frame.Width - (padding*2), controlHeight), TextAlignment = UITextAlignment.Center }; AddBottomBorder(randomMonkeyName, 2.0f); var searchY = randomMonkeyName.Frame.Bottom + (padding * 5); familyName = new UITextField { Frame = new RectangleF(1, searchY, 83, controlHeight), BackgroundColor = UIColor.White, Placeholder = "Family" }; AddBottomBorder(familyName, 2.0f); subfamilyName = new UITextField { Frame = new RectangleF(85, searchY, 83, controlHeight), Placeholder = "Subfamily" }; AddBottomBorder(subfamilyName, 2.0f); genus = new UITextField { Frame = new RectangleF(170, searchY, 78, controlHeight), Placeholder = "Genus" }; AddBottomBorder(genus, 2.0f); searchButton = CreateFlatButton(); searchButton.Frame = new RectangleF(250, searchY, 68, controlHeight); searchButton.SetTitle("Search", UIControlState.Normal); searchButton.TouchUpInside += (object sender, EventArgs e) => { DismissKeyboard(); monkeyServiceClient.GetMonkeyMatchAsync( new MonkeyQuery() { Family = familyName.Text, Subfamily = subfamilyName.Text, Genus = genus.Text }); }; results = new UITableView { Frame = new RectangleF(0, searchButton.Frame.Bottom + padding, this.View.Frame.Width, this.View.Frame.Height - searchButton.Frame.Bottom - padding) }; monkeyInformationSource = new TableViewSource.MonkeyInformationSource(Enumerable.Empty<MonkeyInformation>()); results.Source = monkeyInformationSource; View.AddSubviews(getRandomMonkeyButton, randomMonkeyName, familyName, subfamilyName, genus, searchButton, results); }
public override void ViewDidLoad() { base.ViewDidLoad(); InitializeHelloWorldServiceClient(); View.Frame = UIScreen.MainScreen.Bounds; View.BackgroundColor = UIColor.White; View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; getRandomMonkeyButton = CreateFlatButton(); getRandomMonkeyButton.Frame = new RectangleF(padding, 22.0f, this.View.Frame.Width - (padding * 2), controlHeight); getRandomMonkeyButton.SetTitle("Get Random Monkey", UIControlState.Normal); getRandomMonkeyButton.TouchUpInside += (object sender, EventArgs e) => monkeyServiceClient.GetRandomMonkeyNameAsync(); randomMonkeyName = new UILabel { Frame = new RectangleF(padding, getRandomMonkeyButton.Frame.Bottom, this.View.Frame.Width - (padding * 2), controlHeight), TextAlignment = UITextAlignment.Center }; AddBottomBorder(randomMonkeyName, 2.0f); var searchY = randomMonkeyName.Frame.Bottom + (padding * 5); familyName = new UITextField { Frame = new RectangleF(1, searchY, 83, controlHeight), BackgroundColor = UIColor.White, Placeholder = "Family" }; AddBottomBorder(familyName, 2.0f); subfamilyName = new UITextField { Frame = new RectangleF(85, searchY, 83, controlHeight), Placeholder = "Subfamily" }; AddBottomBorder(subfamilyName, 2.0f); genus = new UITextField { Frame = new RectangleF(170, searchY, 78, controlHeight), Placeholder = "Genus" }; AddBottomBorder(genus, 2.0f); searchButton = CreateFlatButton(); searchButton.Frame = new RectangleF(250, searchY, 68, controlHeight); searchButton.SetTitle("Search", UIControlState.Normal); searchButton.TouchUpInside += (object sender, EventArgs e) => { DismissKeyboard(); monkeyServiceClient.GetMonkeyMatchAsync( new MonkeyQuery() { Family = familyName.Text, Subfamily = subfamilyName.Text, Genus = genus.Text }); }; results = new UITableView { Frame = new RectangleF(0, searchButton.Frame.Bottom + padding, this.View.Frame.Width, this.View.Frame.Height - searchButton.Frame.Bottom - padding) }; monkeyInformationSource = new TableViewSource.MonkeyInformationSource(Enumerable.Empty <MonkeyInformation>()); results.Source = monkeyInformationSource; View.AddSubviews(getRandomMonkeyButton, randomMonkeyName, familyName, subfamilyName, genus, searchButton, results); }