Skip to content

Commit

Permalink
Initial checkin of StandardControls sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Costanich committed Feb 28, 2012
1 parent 7a777f8 commit 3ddf9ca
Show file tree
Hide file tree
Showing 108 changed files with 11,450 additions and 0 deletions.
1 change: 1 addition & 0 deletions StandardControls/Metadata.xml
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" ?><SampleMetadata> <ID>a8e9b255-60d9-49cc-a547-46170ba5c531</ID> <IsFullApplication>false</IsFullApplication> <Level>Intermediate</Level> <Tags>UIKit</Tags></SampleMetadata>
Expand Down
22 changes: 22 additions & 0 deletions StandardControls/README.md
@@ -0,0 +1,22 @@
Sound
=====
This example application illustrates how to use a number of standard controls including:
* Action Sheet
* Activity Spinner
* Alert View
* Button
* Date Picker
* Image View
* Label
* Pager Control
* Progress Bar
* Scroll View
* Segmented Controlr
* Slider
* Switch
* Text Field
* Toolbar

Authors
-------
Bryan Costanich
26 changes: 26 additions & 0 deletions StandardControls/StandardControls.sln
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandardControls", "StandardControls\StandardControls.csproj", "{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhone.ActiveCfg = Debug|iPhone
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhone.Build.0 = Debug|iPhone
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhone.ActiveCfg = Release|iPhone
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhone.Build.0 = Release|iPhone
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{42F47640-1879-403C-9F7E-E1CDAEE2D5C4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = StandardControls\StandardControls.csproj
EndGlobalSection
EndGlobal
43 changes: 43 additions & 0 deletions StandardControls/StandardControls/AppDelegate.cs
@@ -0,0 +1,43 @@
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;

namespace Example_StandardControls
{
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
#region -= declarations and properties =-

protected UIWindow window;
protected UINavigationController mainNavController;
protected Example_StandardControls.Screens.iPhone.Home.HomeNavController iPhoneHome;
protected Example_StandardControls.Screens.iPad.Home.HomeNavController iPadHome;

#endregion

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create our window
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();

// instantiate our main navigatin controller and add it's view to the window
mainNavController = new UINavigationController ();

if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
iPhoneHome = new Example_StandardControls.Screens.iPhone.Home.HomeNavController ();
mainNavController.PushViewController (iPhoneHome, false);
} else {
iPadHome = new Example_StandardControls.Screens.iPad.Home.HomeNavController ();
mainNavController.PushViewController (iPadHome, false);
}

window.RootViewController = mainNavController;

//
return true;
}

}
}
20 changes: 20 additions & 0 deletions StandardControls/StandardControls/Application.cs
@@ -0,0 +1,20 @@
using System;
using MonoTouch.UIKit;

namespace Example_StandardControls
{
public class Application// : UIApplication
{
public static void Main (string[] args)
{
try
{
UIApplication.Main (args, null, "AppDelegate");
}
catch (Exception e)
{
Console.WriteLine (e.ToString ());
}
}
}
}
120 changes: 120 additions & 0 deletions StandardControls/StandardControls/Code/NavItem.cs
@@ -0,0 +1,120 @@
using System;
using MonoTouch.UIKit;

namespace Xamarin.Code
{
public class NavItem
{
/// <summary>
/// The name of the nav item, shows up as the label
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
protected string name;

/// <summary>
/// The UIViewController that the nav item opens. Use this property if you
/// wanted to early instantiate the controller when the nav table is built out,
/// otherwise just set the Type property and it will lazy-instantiate when the
/// nav item is clicked on.
/// </summary>
public UIViewController Controller
{
get { return controller; }
set { controller = value; }
}
protected UIViewController controller;

/// <summary>
/// Path to the image to show in the nav item
/// </summary>
public string ImagePath
{
get { return imagePath; }
set { imagePath = value; }
}
protected string imagePath;

/// <summary>
/// The Type of the UIViewController. Set this to the type and leave the Controller
/// property empty to lazy-instantiate the ViewController when the nav item is
/// clicked.
/// </summary>
public Type ControllerType
{
get { return controllerType; }
set { controllerType = value; }
}
protected Type controllerType;

/// <summary>
/// a list of the constructor args (if neccesary) for the controller. use this in
/// conjunction with ControllerType if lazy-creating controllers.
/// </summary>
public object[] ControllerConstructorArgs
{
get { return controllerConstructorArgs; }
set
{
controllerConstructorArgs = value;

controllerConstructorTypes = new Type[controllerConstructorArgs.Length];
for (int i = 0; i < controllerConstructorArgs.Length; i++) {
controllerConstructorTypes[i] = controllerConstructorArgs[i].GetType ();
}
}
}
protected object[] controllerConstructorArgs = new object[] {};

/// <summary>
/// The types of constructor args.
/// </summary>
public Type[] ControllerConstructorTypes
{
get { return controllerConstructorTypes; }
}
protected Type[] controllerConstructorTypes = Type.EmptyTypes;

public NavItem ()
{
}

public NavItem (string name) : this()
{
this.name = name;
}

public NavItem (string name, UIViewController controller) : this (name)
{
this.controller = controller;
}

public NavItem (string name, Type controllerType) : this (name)
{
this.controllerType = controllerType;
}

public NavItem (string name, Type controllerType, object[] controllerConstructorArgs) : this (name, controllerType)
{
this.ControllerConstructorArgs = controllerConstructorArgs;
}

public NavItem (string name, UIViewController controller, string imagePath) : this (name, controller)
{
this.imagePath = imagePath;
}

public NavItem (string name, string imagePath, Type controllerType) : this (name, controllerType)
{
this.imagePath = imagePath;
}

public NavItem (string name, string imagePath, Type controllerType, object[] controllerConstructorArgs) : this (name, controllerType, controllerConstructorArgs)
{
this.imagePath = imagePath;
}
}
}
32 changes: 32 additions & 0 deletions StandardControls/StandardControls/Code/NavItemGroup.cs
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;

namespace Xamarin.Code
{
/// <summary>
/// A group that contains table items
/// </summary>
public class NavItemGroup
{
public string Name { get; set; }

public string Footer { get; set; }

public List<NavItem> Items
{
get { return items; }
set { items = value; }
}
protected List<NavItem> items = new List<NavItem> ();

public NavItemGroup () { }

public NavItemGroup (string name)
{
Name = name;
}

}

}

0 comments on commit 3ddf9ca

Please sign in to comment.