Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Adding all the conceptual samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Oct 31, 2011
1 parent ebd6e71 commit c2729f0
Show file tree
Hide file tree
Showing 159 changed files with 7,348 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ButtonEventDemo/ButtonEventDemo.sln
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ButtonEventDemo", "ButtonEventDemo\ButtonEventDemo.csproj", "{F550B84D-C304-4413-9A05-A85832245AA5}"
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
{F550B84D-C304-4413-9A05-A85832245AA5}.Debug|iPhone.ActiveCfg = Debug|iPhone
{F550B84D-C304-4413-9A05-A85832245AA5}.Debug|iPhone.Build.0 = Debug|iPhone
{F550B84D-C304-4413-9A05-A85832245AA5}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{F550B84D-C304-4413-9A05-A85832245AA5}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{F550B84D-C304-4413-9A05-A85832245AA5}.Release|iPhone.ActiveCfg = Release|iPhone
{F550B84D-C304-4413-9A05-A85832245AA5}.Release|iPhone.Build.0 = Release|iPhone
{F550B84D-C304-4413-9A05-A85832245AA5}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{F550B84D-C304-4413-9A05-A85832245AA5}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = ButtonEventDemo\ButtonEventDemo.csproj
EndGlobalSection
EndGlobal
38 changes: 38 additions & 0 deletions ButtonEventDemo/ButtonEventDemo/AppDelegate.cs
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace ButtonEventDemo
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
ButtonEventDemoViewController viewController;

//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);

viewController = new ButtonEventDemoViewController ("ButtonEventDemoViewController", null);
window.RootViewController = viewController;
window.MakeKeyAndVisible ();

return true;
}

}
}
77 changes: 77 additions & 0 deletions ButtonEventDemo/ButtonEventDemo/ButtonEventDemo.csproj
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F550B84D-C304-4413-9A05-A85832245AA5}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>ButtonEventDemo</RootNamespace>
<AssemblyName>ButtonEventDemo</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ButtonEventDemoViewController.cs" />
<Compile Include="ButtonEventDemoViewController.designer.cs">
<DependentUpon>ButtonEventDemoViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="ButtonEventDemoViewController.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
61 changes: 61 additions & 0 deletions ButtonEventDemo/ButtonEventDemo/ButtonEventDemoViewController.cs
@@ -0,0 +1,61 @@
using MonoTouch.UIKit;
using System.Drawing;
using System;
using MonoTouch.Foundation;

namespace ButtonEventDemo
{
public partial class ButtonEventDemoViewController : UIViewController
{
public ButtonEventDemoViewController (string nibName, NSBundle bundle) : base (nibName, bundle)
{
}

public override void DidReceiveMemoryWarning ()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning ();

// Release any cached data, images, etc that aren't in use.
}

public override void ViewDidLoad ()
{
base.ViewDidLoad ();

//Here we register for the TouchUpInside event using an outlet to
//the UIButton created in Interface Builder. Also see the target-action
//approach for accomplishing the same thing below.
aButton.TouchUpInside += (o,s) => {
Console.WriteLine ("button touched"); };

//You could also use a C# 2.0 style anonymous function
// aButton.TouchUpInside += delegate {
// Console.WriteLine ("button touched");
// };

}

public override void ViewDidUnload ()
{
base.ViewDidUnload ();

aButton = null;
}

public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}

//This is an action method connected to the TouchUpInside event
//of a UIButton. The action is connected via Interface Builder
//The same thing can be accomplished with a .NET event registered
//to the UIButton in code, as we do in the ViewDidLoad method above.
partial void HandleButtonTouch (NSObject sender)
{
Console.WriteLine ("button touched");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c2729f0

Please sign in to comment.