Merge branch 'master' of git@github.com:migueldeicaza/monotouch-samples

This commit is contained in:
Miguel de Icaza 2010-01-07 15:52:50 -05:00
Родитель 46deae45a3 80a91b5fbd
Коммит f5f8691db1
36 изменённых файлов: 2467 добавлений и 186 удалений

3
GoogleAnalytics/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
*.pidb
bin
*.userprefs

Просмотреть файл

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>GoogleAnalytics</RootNamespace>
<MainNibFile>MainWindow.xib</MainNibFile>
<AssemblyName>GoogleAnalytics</AssemblyName>
<MtouchSdkVersion>3.0</MtouchSdkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</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>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lGoogleAnalytics -lsqlite3.0 -framework CFNetwork -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>False</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lGoogleAnalytics -lsqlite3.0 -framework CFNetwork -ObjC"</MtouchExtraArgs>
</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>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lGoogleAnalytics -lsqlite3.0 -framework CFNetwork -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>False</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lGoogleAnalytics -lsqlite3.0 -framework CFNetwork -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="GANTracker, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\monotouch-libs\GoogleAnalytics\GANTracker.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.xib.designer.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="Main.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="IPhone" />
</MonoDevelop>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoogleAnalytics", "GoogleAnalytics.csproj", "{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}"
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
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhone.ActiveCfg = Debug|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhone.Build.0 = Debug|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhone.ActiveCfg = Release|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhone.Build.0 = Release|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = GoogleAnalytics.csproj
EndGlobalSection
EndGlobal

53
GoogleAnalytics/Main.cs Normal file
Просмотреть файл

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
namespace GoogleAnalytics
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
public partial class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// Replace with your account information.
var account = "UA-000000-1";
int time = 10;
var tracker = GoogleAnalytics.GANTracker.SharedTracker;
tracker.StartTracker (account, time, null);
var label = new UILabel (new RectangleF (10, 10, 300, 20));
NSError error;
if (tracker.TrackPageView ("/app_entry_point", out error))
label.Text = "Tracking successfully sent!";
else
label.Text = "Error starting tracker";
// Force the event to be sent
tracker.Dispatch ();
window.AddSubview (label);
window.MakeKeyAndVisible ();
return true;
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}

Просмотреть файл

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
</object>
<object class="IBProxyObject" id="587066532">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
<object class="IBUICustomObject" id="987256611"/>
<object class="IBUIWindow" id="380026005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">1316</int>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="987256611"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="380026005"/>
</object>
<int key="connectionID">7</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="600044258">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="380026005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="600044258"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="600044258"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="600044258"/>
<string key="objectName">App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="587066532"/>
<reference key="parent" ref="600044258"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>2.UIWindow.visibleAtLaunch</string>
<string>4.CustomClassName</string>
<string>4.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{593, 276}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>AppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">window</string>
<string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
</archive>

15
GoogleAnalytics/MainWindow.xib.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,15 @@
namespace GoogleAnalytics
{
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate
{
[MonoTouch.Foundation.Connect("window")]
private MonoTouch.UIKit.UIWindow window {
get { return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField ("window"))); }
set { this.SetNativeField ("window", value); }
}
}
}

Двоичные данные
GoogleAnalytics/libGoogleAnalytics.a Normal file

Двоичный файл не отображается.

3
PinchMedia/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
*.pidb
bin
*.userprefs

Двоичные данные
PinchMedia/Beacon.dll Executable file

Двоичный файл не отображается.

50
PinchMedia/Main.cs Normal file
Просмотреть файл

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
namespace PinchMedia
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
public partial class AppDelegate : UIApplicationDelegate
{
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
string applicationCode = "REPLACE WITH YOUR OWN APPLICATION CODE";
Beacon.StartBeacon(applicationCode, false, false, true);
var label = new UILabel (new RectangleF (10, 30, 300, 20));
label.Text = "Tracking with Pinch Media Analytics";
window.AddSubview (label);
window.MakeKeyAndVisible ();
return true;
}
public override void WillTerminate (UIApplication application)
{
// (your app's cleanup code)
// CALL THIS LAST! (See this FAQ entry for more info)
Beacon.EndBeacon();
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}

184
PinchMedia/MainWindow.xib Normal file
Просмотреть файл

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
</object>
<object class="IBProxyObject" id="587066532">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
<object class="IBUICustomObject" id="987256611"/>
<object class="IBUIWindow" id="380026005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">1316</int>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="987256611"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="380026005"/>
</object>
<int key="connectionID">7</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="600044258">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="380026005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="600044258"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="600044258"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="600044258"/>
<string key="objectName">App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="587066532"/>
<reference key="parent" ref="600044258"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>2.UIWindow.visibleAtLaunch</string>
<string>4.CustomClassName</string>
<string>4.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{593, 276}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>AppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">window</string>
<string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.0</string>
</data>
</archive>

15
PinchMedia/MainWindow.xib.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,15 @@
namespace PinchMedia
{
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate
{
[MonoTouch.Foundation.Connect("window")]
private MonoTouch.UIKit.UIWindow window {
get { return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField ("window"))); }
set { this.SetNativeField ("window", value); }
}
}
}

Просмотреть файл

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>PinchMedia</RootNamespace>
<MainNibFile>MainWindow.xib</MainNibFile>
<AssemblyName>PinchMedia</AssemblyName>
<MtouchSdkVersion>3.0</MtouchSdkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</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>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lPMAnalytics-r91 -lsqlite3.0 -framework SystemConfiguration -framework CoreLocation -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>False</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lPMAnalytics-r91 -lsqlite3.0 -framework SystemConfiguration -framework CoreLocation -ObjC"</MtouchExtraArgs>
</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>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lPMAnalytics-r91 -lsqlite3.0 -framework SystemConfiguration -framework CoreLocation -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>False</MtouchDebug>
<MtouchExtraArgs>-gcc_flags "-L${ProjectDir} -lPMAnalytics-r91 -lsqlite3.0 -framework SystemConfiguration -framework CoreLocation -ObjC"</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="Beacon, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<SpecificVersion>False</SpecificVersion>
<HintPath>Beacon.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.xib.designer.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="Main.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="IPhone" />
</MonoDevelop>
</ProjectExtensions>
</Project>

26
PinchMedia/PinchMedia.sln Normal file
Просмотреть файл

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PinchMedia", "PinchMedia.csproj", "{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}"
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
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhone.ActiveCfg = Debug|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhone.Build.0 = Debug|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhone.ActiveCfg = Release|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhone.Build.0 = Release|iPhone
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{4C58CFA1-8CA8-4CCD-9EC2-571DA33FAAAA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = PinchMedia.csproj
EndGlobalSection
EndGlobal

Двоичные данные
PinchMedia/libPMAnalytics-r91.a Normal file

Двоичный файл не отображается.

3
StreamingAudio/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
*.pidb
*.userprefs
bin

97
StreamingAudio/Main.cs Normal file
Просмотреть файл

@ -0,0 +1,97 @@
//
// This is a sample program that streams audio from an HTTP server using
// Mono's HTTP stack, AudioStreamFile to parse partial audio streams and
// AudioQueue/OutputAudioQueue to generate the output.
//
// MIT X11
//
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Net;
using MonoTouch.AudioToolbox;
namespace StreamingAudio
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args);
}
}
public partial class AppDelegate : UIApplicationDelegate
{
public override void OnActivated (UIApplication application)
{
}
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window.AddSubview (viewController.View);
// Nice creative commons source.
entry.Text = "http://ccmixter.org/content/bradstanfield/bradstanfield_-_People_Let_s_Stop_The_War.mp3";
entry.EditingDidEnd += delegate {
entry.ResignFirstResponder ();
};
window.MakeKeyAndVisible ();
return true;
}
partial void startPlayback (UIButton sender)
{
try {
var request = (HttpWebRequest) WebRequest.Create (entry.Text);
request.BeginGetResponse (StreamDownloaded, request);
} catch (Exception e){
status.Text = "Error: " + e.ToString ();
}
}
void StreamDownloaded (IAsyncResult result)
{
var request = result.AsyncState as HttpWebRequest;
bool pushed = false;
try {
var response = request.EndGetResponse (result);
var stream = response.GetResponseStream ();
var buffer = new byte [8192];
int l = 0, n;
InvokeOnMainThread (delegate {
viewController.PushViewController (playController, true);
});
pushed = true;
StreamingPlayback player = null;
try {
player = new StreamingPlayback ();
} catch (Exception e){
Console.WriteLine (e);
}
while ((n = stream.Read (buffer, 0, buffer.Length)) != 0){
l += n;
player.ParseBytes (buffer, n, false);
InvokeOnMainThread (delegate {
progress.Progress = l / (float) response.ContentLength;
});
}
} catch (Exception e){
InvokeOnMainThread (delegate {
if (pushed)
viewController.PopToRootViewController (true);
status.Text = "Error fetching response stream\n" + e;
});
}
}
}
}

Просмотреть файл

@ -0,0 +1,662 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">768</int>
<string key="IBDocument.SystemVersion">10B504</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.22</string>
<string key="IBDocument.HIToolboxVersion">457.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">62</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="2"/>
<integer value="21"/>
<integer value="39"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
</object>
<object class="IBProxyObject" id="587066532">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
<object class="IBUICustomObject" id="987256611"/>
<object class="IBUIWindow" id="380026005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">1316</int>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
<object class="IBUINavigationController" id="732511712">
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUINavigationBar" key="IBUINavigationBar" id="753096672">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{0, 0}</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
</object>
<object class="NSArray" key="IBUIViewControllers">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIViewController" id="138859781">
<object class="IBUIView" key="IBUIView" id="812770021">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUILabel" id="630004556">
<reference key="NSNextResponder" ref="812770021"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {257, 21}}</string>
<reference key="NSSuperview" ref="812770021"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Select URL of MP3 file to stream:</string>
<object class="NSColor" key="IBUITextColor" id="79086812">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUIButton" id="315123057">
<reference key="NSNextResponder" ref="812770021"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{90, 102}, {140, 37}}</string>
<reference key="NSSuperview" ref="812770021"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Start Playback</string>
<object class="NSColor" key="IBUIHighlightedTitleColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUITextField" id="122687021">
<reference key="NSNextResponder" ref="812770021"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 63}, {280, 31}}</string>
<reference key="NSSuperview" ref="812770021"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="568940393">
<int key="NSID">2</int>
</object>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
<bool key="IBUIClearsOnBeginEditing">YES</bool>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits"/>
</object>
<object class="IBUILabel" id="502023951">
<reference key="NSNextResponder" ref="812770021"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 156}, {285, 240}}</string>
<reference key="NSSuperview" ref="812770021"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Label</string>
<reference key="IBUITextColor" ref="79086812"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUINumberOfLines">13</int>
<int key="IBUILineBreakMode">0</int>
</object>
</object>
<string key="NSFrameSize">{320, 416}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="568940393"/>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
</object>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="449771860">
<reference key="IBUINavigationBar"/>
<string key="IBUITitle">Stream MP3 File</string>
</object>
<reference key="IBUIParentViewController" ref="732511712"/>
</object>
</object>
</object>
<object class="IBUIViewController" id="75935306">
<object class="IBUIView" key="IBUIView" id="983264090">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUISlider" id="230519471">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{18, 323}, {284, 23}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<float key="IBUIValue">1</float>
</object>
<object class="IBUILabel" id="631759974">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 85}, {154, 21}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Download Progress:</string>
<reference key="IBUITextColor" ref="79086812"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="371085727">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 281}, {220, 21}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Volume: (Not hooked up yet)</string>
<reference key="IBUITextColor" ref="79086812"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUIProgressView" id="827519007">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 134}, {280, 9}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
</object>
<object class="IBUILabel" id="343504676">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {130, 21}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Streaming audio:</string>
<reference key="IBUITextColor" ref="79086812"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUILabel" id="85541954">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 175}, {273, 21}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Playback Progress: (not hooked up)</string>
<reference key="IBUITextColor" ref="79086812"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
</object>
<object class="IBUIProgressView" id="1021442588">
<reference key="NSNextResponder" ref="983264090"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 226}, {150, 9}}</string>
<reference key="NSSuperview" ref="983264090"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
</object>
</object>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<reference key="NSCustomColorSpace" ref="568940393"/>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="987256611"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="380026005"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">viewController</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="732511712"/>
</object>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">entry</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="122687021"/>
</object>
<int key="connectionID">35</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">startPlayback:</string>
<reference key="source" ref="315123057"/>
<reference key="destination" ref="987256611"/>
<int key="IBEventType">1</int>
</object>
<int key="connectionID">36</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">playController</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="75935306"/>
</object>
<int key="connectionID">38</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">volume</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="230519471"/>
</object>
<int key="connectionID">45</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">progress</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="827519007"/>
</object>
<int key="connectionID">46</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">status</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="502023951"/>
</object>
<int key="connectionID">47</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="380026005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="0"/>
<string key="objectName">App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="587066532"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">20</int>
<reference key="object" ref="732511712"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="753096672"/>
<reference ref="138859781"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="753096672"/>
<reference key="parent" ref="732511712"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="138859781"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="449771860"/>
<reference ref="812770021"/>
</object>
<reference key="parent" ref="732511712"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">23</int>
<reference key="object" ref="449771860"/>
<reference key="parent" ref="138859781"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="812770021"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="630004556"/>
<reference ref="122687021"/>
<reference ref="315123057"/>
<reference ref="502023951"/>
</object>
<reference key="parent" ref="138859781"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">30</int>
<reference key="object" ref="630004556"/>
<reference key="parent" ref="812770021"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">31</int>
<reference key="object" ref="315123057"/>
<reference key="parent" ref="812770021"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">32</int>
<reference key="object" ref="122687021"/>
<reference key="parent" ref="812770021"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">33</int>
<reference key="object" ref="502023951"/>
<reference key="parent" ref="812770021"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">37</int>
<reference key="object" ref="75935306"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="983264090"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">39</int>
<reference key="object" ref="983264090"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="631759974"/>
<reference ref="371085727"/>
<reference ref="230519471"/>
<reference ref="827519007"/>
<reference ref="343504676"/>
<reference ref="85541954"/>
<reference ref="1021442588"/>
</object>
<reference key="parent" ref="75935306"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">40</int>
<reference key="object" ref="230519471"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">41</int>
<reference key="object" ref="631759974"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">42</int>
<reference key="object" ref="371085727"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="827519007"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">48</int>
<reference key="object" ref="343504676"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">49</int>
<reference key="object" ref="85541954"/>
<reference key="parent" ref="983264090"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">50</int>
<reference key="object" ref="1021442588"/>
<reference key="parent" ref="983264090"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>2.UIWindow.visibleAtLaunch</string>
<string>20.IBEditorWindowLastContentRect</string>
<string>20.IBPluginDependency</string>
<string>21.IBPluginDependency</string>
<string>22.IBPluginDependency</string>
<string>23.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>30.IBPluginDependency</string>
<string>31.IBPluginDependency</string>
<string>32.IBPluginDependency</string>
<string>33.IBPluginDependency</string>
<string>37.IBEditorWindowLastContentRect</string>
<string>37.IBPluginDependency</string>
<string>39.IBPluginDependency</string>
<string>4.CustomClassName</string>
<string>4.IBPluginDependency</string>
<string>40.IBPluginDependency</string>
<string>41.IBPluginDependency</string>
<string>42.IBPluginDependency</string>
<string>43.IBPluginDependency</string>
<string>48.IBPluginDependency</string>
<string>49.IBPluginDependency</string>
<string>50.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{363, 276}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>{{324, 155}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{306, 185}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>AppDelegate</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">50</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">startPlayback:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>entry</string>
<string>playController</string>
<string>progress</string>
<string>status</string>
<string>viewController</string>
<string>volume</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="768" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.1</string>
</data>
</archive>

92
StreamingAudio/MainWindow.xib.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,92 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace StreamingAudio {
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("AppDelegate")]
public partial class AppDelegate {
#pragma warning disable 0169
[MonoTouch.Foundation.Export("startPlayback:")]
partial void startPlayback (MonoTouch.UIKit.UIButton sender);
[MonoTouch.Foundation.Connect("window")]
private MonoTouch.UIKit.UIWindow window {
get {
return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField("window")));
}
set {
this.SetNativeField("window", value);
}
}
[MonoTouch.Foundation.Connect("viewController")]
private MonoTouch.UIKit.UINavigationController viewController {
get {
return ((MonoTouch.UIKit.UINavigationController)(this.GetNativeField("viewController")));
}
set {
this.SetNativeField("viewController", value);
}
}
[MonoTouch.Foundation.Connect("entry")]
private MonoTouch.UIKit.UITextField entry {
get {
return ((MonoTouch.UIKit.UITextField)(this.GetNativeField("entry")));
}
set {
this.SetNativeField("entry", value);
}
}
[MonoTouch.Foundation.Connect("playController")]
private MonoTouch.UIKit.UIViewController playController {
get {
return ((MonoTouch.UIKit.UIViewController)(this.GetNativeField("playController")));
}
set {
this.SetNativeField("playController", value);
}
}
[MonoTouch.Foundation.Connect("volume")]
private MonoTouch.UIKit.UISlider volume {
get {
return ((MonoTouch.UIKit.UISlider)(this.GetNativeField("volume")));
}
set {
this.SetNativeField("volume", value);
}
}
[MonoTouch.Foundation.Connect("progress")]
private MonoTouch.UIKit.UIProgressView progress {
get {
return ((MonoTouch.UIKit.UIProgressView)(this.GetNativeField("progress")));
}
set {
this.SetNativeField("progress", value);
}
}
[MonoTouch.Foundation.Connect("status")]
private MonoTouch.UIKit.UILabel status {
get {
return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("status")));
}
set {
this.SetNativeField("status", value);
}
}
}
}

16
StreamingAudio/README Normal file
Просмотреть файл

@ -0,0 +1,16 @@
This sample illustrates how to use AudioToolbox's AudioFileStream to
parse an audio stream progressively and play the audio back.
The audio is a creative commons MP3 file that is downloaded from a
website using Mono's HTTP stack.
This code does not attempt to buffer beyond the four built-in buffers
that are created at startup. It will happily stall until the audio
pipeline releases one of the audio buffers.
A better implementation would save the data to disk as well.
To use this you need either MonoTouch 1.4 or to download the preview
monotouch.dll from:
http://tirania.org/tmp/monotouch.dll

Просмотреть файл

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{63C1A34F-2729-426B-92EA-073C62477053}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>StreamingAudio</RootNamespace>
<MainNibFile>MainWindow.xib</MainNibFile>
<AssemblyName>StreamingAudio</AssemblyName>
<MtouchSdkVersion>3.0</MtouchSdkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</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>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>False</MtouchDebug>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</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>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>False</MtouchDebug>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.xib.designer.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="Main.cs" />
<Compile Include="StreamingPlayback.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="IPhone" />
</MonoDevelop>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StreamingAudio", "StreamingAudio.csproj", "{63C1A34F-2729-426B-92EA-073C62477053}"
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
{63C1A34F-2729-426B-92EA-073C62477053}.Debug|iPhone.ActiveCfg = Debug|iPhone
{63C1A34F-2729-426B-92EA-073C62477053}.Debug|iPhone.Build.0 = Debug|iPhone
{63C1A34F-2729-426B-92EA-073C62477053}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{63C1A34F-2729-426B-92EA-073C62477053}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{63C1A34F-2729-426B-92EA-073C62477053}.Release|iPhone.ActiveCfg = Release|iPhone
{63C1A34F-2729-426B-92EA-073C62477053}.Release|iPhone.Build.0 = Release|iPhone
{63C1A34F-2729-426B-92EA-073C62477053}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{63C1A34F-2729-426B-92EA-073C62477053}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = StreamingAudio.csproj
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,211 @@
//
// A simple helper class that can be used to stream audio
//
// It hardcodes the behavior and the file type
//
// Use like this:
// var sp = new StreamingPlayback ();
//
// You can access FileStream and the OutputQueue properties
//
// In a loop: sp.FileStream.ParseBytes (...);
//
// When done:
// sp.FlushAndClose ();
//
using System;
using System.Threading;
using MonoTouch.AudioToolbox;
namespace StreamingAudio
{
//
// Audio decoding: we feed the data that is downloaded from the Http client
// to the AudioFileStream which decodes the output and generates audio
// packets. We feed these decoded audio packets to the OutputAudioQueue
//
// Data is fed by calling StreamingPlayback.FileStream.ParseBytes ()
//
public class StreamingPlayback : IDisposable
{
AudioFileStream fileStream; // The decoder
public OutputAudioQueue OutputQueue;
AutoResetEvent outputCompleted = new AutoResetEvent (false);
bool started;
IntPtr [] outputBuffers; // The output buffers
volatile bool [] inuse;
const int bufferSize = 128 * 1024;
int bytesFilled;
int fillBufferIndex;
int packetsFilled;
AudioStreamPacketDescription [] pdesc = new AudioStreamPacketDescription [512];
public StreamingPlayback ()
{
fileStream = new AudioFileStream (AudioFileType.MP3);
fileStream.PacketDecoded += AudioPacketDecoded;
fileStream.PropertyFound += AudioPropertyFound;
}
public void ParseBytes (byte [] buffer, int count, bool discontinuity)
{
fileStream.ParseBytes (buffer, 0, count, discontinuity);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
// Release unmanaged buffers, flush output, close files.
if (disposing){
if (outputBuffers != null)
foreach (var b in outputBuffers)
OutputQueue.FreeBuffer (b);
if (fileStream != null){
fileStream.Close ();
fileStream = null;
}
if (OutputQueue != null){
OutputQueue.Dispose ();
OutputQueue = null;
}
}
}
unsafe void AudioPacketDecoded (object sender, PacketReceivedEventArgs args)
{
Console.Write ('.');
foreach (var pd in args.PacketDescriptions){
var packetSize = pd.DataByteSize;
int left = bufferSize - bytesFilled;
if (left < packetSize){
EnqueueBuffer ();
WaitForBuffer ();
}
// Fill the buffer
var buf = outputBuffers [fillBufferIndex];
AudioQueue.FillAudioData (buf, bytesFilled, args.InputData, (int) pd.StartOffset, packetSize);
// Fill out the packet description
pdesc [packetsFilled] = pd;
pdesc [packetsFilled].StartOffset = bytesFilled;
bytesFilled += packetSize;
packetsFilled++;
// If we filled out all of our packet descriptions, enqueue the buffer
if (pdesc.Length == packetsFilled){
EnqueueBuffer ();
WaitForBuffer ();
}
}
}
public void FlushAndClose ()
{
EnqueueBuffer ();
OutputQueue.Flush ();
OutputQueue.Stop (false);
// Release resources
Dispose ();
}
void EnqueueBuffer ()
{
inuse [fillBufferIndex] = true;
IntPtr buffer = outputBuffers [fillBufferIndex];
Console.WriteLine ("Enqueue={0}", OutputQueue.EnqueueBuffer (buffer, bytesFilled, pdesc));
StartQueueIfNeeded ();
}
void WaitForBuffer ()
{
fillBufferIndex++;
if (fillBufferIndex == outputBuffers.Length)
fillBufferIndex = 0;
bytesFilled = 0;
packetsFilled = 0;
lock (inuse){
while (inuse [fillBufferIndex]){
Console.WriteLine ("Waiting for buffer to be released");
Monitor.Wait (inuse);
}
}
Console.WriteLine ("Resuming");
}
void StartQueueIfNeeded ()
{
if (started)
return;
Console.WriteLine ("Start={0}", OutputQueue.Start ());
started = true;
}
// Raised when we are done.
public event EventHandler Finished;
void AudioPropertyFound (object sender, PropertyFoundEventArgs args)
{
switch (args.Property){
//
// Enough data has been read that we can start producing output
//
case AudioFileStreamProperty.ReadyToProducePackets:
bytesFilled = 0;
fillBufferIndex = 0;
packetsFilled = 0;
started = false;
OutputQueue = new OutputAudioQueue (fileStream.StreamBasicDescription);
OutputQueue.OutputCompleted += HandleOutputQueueOutputCompleted;
outputBuffers = new IntPtr [4];
inuse = new bool [4];
// Allocate audio queue buffers
for (int i = 0; i < outputBuffers.Length; i++)
OutputQueue.AllocateBuffer (bufferSize, out outputBuffers [i]);
OutputQueue.MagicCookie = fileStream.MagicCookie;
OutputQueue.AddListener (AudioQueueProperty.IsRunning, delegate (AudioQueueProperty p) {
var h = Finished;
if (h != null)
h (this, EventArgs.Empty);
});
break;
}
Console.WriteLine ("Property: {0}", args);
}
//
// When the entire audio buffered has been played, the
// OutputAudioQueue will call us back for more information
//
void HandleOutputQueueOutputCompleted (object sender, OutputCompletedEventArgs e)
{
IntPtr buf = e.IntPtrBuffer;
Console.WriteLine ("Buffer done");
for (int i = 0; i < outputBuffers.Length; i++){
if (buf == outputBuffers [i]){
lock (inuse){
inuse [i] = false;
Monitor.Pulse (inuse);
}
outputCompleted.Set ();
}
}
}
}
}

3
avTouch/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
*.userprefs
*.pidb
bin

Просмотреть файл

@ -12,6 +12,7 @@
<AssemblyName>avTouch</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<RootNamespace>avTouch</RootNamespace>
<MtouchSdkVersion>3.0</MtouchSdkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
@ -22,6 +23,8 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExtraMtouchArgs>-debug</ExtraMtouchArgs>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
@ -29,6 +32,7 @@
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>False</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
@ -39,6 +43,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
@ -47,6 +52,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>False</MtouchDebug>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -81,7 +87,6 @@
<ItemGroup>
<Content Include="Default.png" />
<Content Include="icon.png" />
<Content Include="forward.png" />
<Content Include="images\pause.png" />
<Content Include="images\play.png" />
<Content Include="images\play_hi.png" />
@ -91,6 +96,7 @@
<Content Include="images\volume_down.png" />
<Content Include="images\volume_up.png" />
<Content Include="sample.m4a" />
<Content Include="images\forward.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="images\" />

Просмотреть файл

@ -36,8 +36,8 @@ namespace avTouch
public override void AwakeFromNib ()
{
playBtnBg = UIImage.FromFile ("play.png").StretchableImage (12, 0);
pauseBtnBg = UIImage.FromFile ("pause.png").StretchableImage (12, 0);
playBtnBg = UIImage.FromFile ("images/play.png").StretchableImage (12, 0);
pauseBtnBg = UIImage.FromFile ("images/pause.png").StretchableImage (12, 0);
_playButton.SetImage (playBtnBg, UIControlState.Normal);
_duration.AdjustsFontSizeToFitWidth = true;
@ -46,6 +46,7 @@ namespace avTouch
var fileUrl = NSBundle.MainBundle.PathForResource ("sample", "m4a");
player = AVAudioPlayer.FromUrl (new NSUrl (fileUrl, false));
player.FinishedPlaying += delegate(object sender, AVStatusEventArgs e) {
if (!e.Status)
Console.WriteLine ("Did not complete successfully");
@ -65,8 +66,6 @@ namespace avTouch
_fileName.Text = String.Format ("Mono {0} ({1} ch)", Path.GetFileName (player.Url.RelativePath), player.NumberOfChannels);
UpdateViewForPlayerInfo ();
UpdateViewForPlayerState ();
}
public void UpdateCurrentTime ()

Просмотреть файл

@ -3,9 +3,9 @@
<data>
<int key="IBDocument.SystemTarget">528</int>
<string key="IBDocument.SystemVersion">10B504</string>
<string key="IBDocument.InterfaceBuilderVersion">732</string>
<string key="IBDocument.AppKitVersion">1038.2</string>
<string key="IBDocument.HIToolboxVersion">437.00</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.22</string>
<string key="IBDocument.HIToolboxVersion">457.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">62</string>
@ -63,7 +63,7 @@
<bool key="IBUIUserInteractionEnabled">NO</bool>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">sound_meter_background.png</string>
<string key="NSResourceName">images/sound_meter_background.png</string>
</object>
</object>
<object class="IBUIView" id="544780062">
@ -157,14 +157,14 @@
<object class="IBUIImageView" id="202417773">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{16, 355}, {9, 15}}</string>
<string key="NSFrame">{{20, 355}, {5, 15}}</string>
<reference key="NSSuperview" ref="774585933"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">volume_down.png</string>
<string key="NSResourceName">images/volume_down.png</string>
</object>
</object>
<object class="IBUIImageView" id="596049103">
@ -177,7 +177,7 @@
<bool key="IBUIUserInteractionEnabled">NO</bool>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">volume_up.png</string>
<string key="NSResourceName">images/volume_up.png</string>
</object>
</object>
<object class="IBUIToolbar" id="570549170">
@ -214,7 +214,7 @@
</object>
<object class="NSCustomResource" key="IBUIHighlightedImage" id="384982964">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">rewind.png</string>
<string key="NSResourceName">images/rewind.png</string>
</object>
<reference key="IBUIDisabledImage" ref="384982964"/>
<reference key="IBUISelectedImage" ref="384982964"/>
@ -239,7 +239,7 @@
<reference key="IBUINormalTitleShadowColor" ref="584139103"/>
<object class="NSCustomResource" key="IBUIHighlightedImage" id="300183811">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">play.png</string>
<string key="NSResourceName">images/play.png</string>
</object>
<reference key="IBUIDisabledImage" ref="300183811"/>
<reference key="IBUISelectedImage" ref="300183811"/>
@ -268,7 +268,10 @@
</object>
<reference key="IBUIDisabledImage" ref="384715260"/>
<reference key="IBUISelectedImage" ref="384715260"/>
<reference key="IBUINormalImage" ref="384715260"/>
<object class="NSCustomResource" key="IBUINormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">images/forward.png</string>
</object>
</object>
</object>
<string key="NSFrame">{{-1, 416}, {320, 44}}</string>
@ -319,7 +322,7 @@
<bool key="IBUIUserInteractionEnabled">NO</bool>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">sound_meter_glare.png</string>
<string key="NSResourceName">images/sound_meter_glare.png</string>
</object>
</object>
</object>

2
avTouch/avTouchViewController.xib.designer.cs сгенерированный
Просмотреть файл

@ -15,6 +15,7 @@ namespace avTouch {
[MonoTouch.Foundation.Register("avTouchViewController")]
public partial class avTouchViewController {
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("view")]
private MonoTouch.UIKit.UIView view {
get {
@ -40,6 +41,7 @@ namespace avTouch {
[MonoTouch.Foundation.Register("avTouchController")]
public partial class avTouchController {
#pragma warning disable 0169
[MonoTouch.Foundation.Export("volumeSliderMoved:")]
partial void volumeSliderMoved (MonoTouch.UIKit.UISlider sender);

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

8
reachability/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
*.exe
*.nib
error
output
*.mdb
*.userprefs
bin
simulator

Просмотреть файл

@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.02">
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">512</int>
<string key="IBDocument.SystemVersion">9C7010</string>
<string key="IBDocument.InterfaceBuilderVersion">654</string>
<string key="IBDocument.AppKitVersion">949.26</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<string key="IBDocument.SystemVersion">10B504</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.22</string>
<string key="IBDocument.HIToolboxVersion">457.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">62</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="7"/>
@ -14,11 +18,23 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
</object>
<object class="IBProxyObject" id="1071500409">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
</object>
<object class="IBUICustomObject" id="987256611"/>
<object class="IBUIWindow" id="380026005">
<reference key="NSNextResponder"/>
@ -38,7 +54,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string type="base64-UTF8" key="IBUIText"></string>
<string key="IBUIText"/>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAwIDAAA</bytes>
@ -46,7 +62,7 @@
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">1</int>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
<float key="IBUIMinimumFontSize">1.400000e+01</float>
<float key="IBUIMinimumFontSize">14</float>
<int key="IBUINumberOfLines">0</int>
<int key="IBUITextAlignment">1</int>
</object>
@ -116,9 +132,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="957960031">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@ -129,18 +143,18 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="388289409"/>
</object>
<reference key="parent" ref="957960031"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="957960031"/>
<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="957960031"/>
<reference key="parent" ref="0"/>
<string key="objectName">ReachabilityAppDelegate</string>
</object>
<object class="IBObjectRecord">
@ -157,13 +171,19 @@
<reference key="object" ref="1041619883"/>
<reference key="parent" ref="388289409"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1071500409"/>
<reference key="parent" ref="0"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
@ -176,16 +196,15 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{536, 365}, {320, 480}}</string>
<string>{{363, 365}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>ReachabilityAppDelegate</string>
@ -196,9 +215,7 @@
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
@ -206,9 +223,7 @@
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
@ -224,7 +239,7 @@
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>contentView</string>
<string>summaryLabel</string>
@ -245,7 +260,17 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="512" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">Reachability.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.1</string>
</data>
</archive>

49
reachability/MainWindow.xib.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,49 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace reachability {
// Base type probably should be MonoTouch.Foundation.NSObject or subclass
[MonoTouch.Foundation.Register("ReachabilityAppDelegate")]
public partial class ReachabilityAppDelegate {
#pragma warning disable 0169
[MonoTouch.Foundation.Connect("window")]
private MonoTouch.UIKit.UIWindow window {
get {
return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField("window")));
}
set {
this.SetNativeField("window", value);
}
}
[MonoTouch.Foundation.Connect("contentView")]
private MonoTouch.UIKit.UIView contentView {
get {
return ((MonoTouch.UIKit.UIView)(this.GetNativeField("contentView")));
}
set {
this.SetNativeField("contentView", value);
}
}
[MonoTouch.Foundation.Connect("summaryLabel")]
private MonoTouch.UIKit.UILabel summaryLabel {
get {
return ((MonoTouch.UIKit.UILabel)(this.GetNativeField("summaryLabel")));
}
set {
this.SetNativeField("summaryLabel", value);
}
}
}
}

Просмотреть файл

@ -1,150 +1,183 @@
using System;
using System.Drawing;
using System.Net;
using MonoTouch.CoreGraphics;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.SystemConfiguration;
using MonoTouch.CoreFoundation;
public partial class ReachabilityAppDelegate : UIApplicationDelegate {
public string Hostname = "www.apple.com";
UIImage imageCarrier, imageWiFi, imageStop;
NetworkReachability nr;
UITableView tableView;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
imageCarrier = UIImage.FromFile ("WWAN5.png");
imageWiFi = UIImage.FromFile ("Airport.png");
imageStop = UIImage.FromFile ("stop-32.png");
nr = new NetworkReachability ("www.apple.com");
nr.SetCallback (ReachabilityChanged);
nr.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
AddTable ();
//UpdateStatus ();
//UpdateCarrierWarning ();
window.MakeKeyAndVisible ();
return true;
}
//
// Invoked on the main loop when reachability changes
//
void ReachabilityChanged (NetworkReachabilityFlags flags)
{
}
void AddTable ()
{
RectangleF tableFrame = UIScreen.MainScreen.ApplicationFrame;
namespace reachability {
public partial class ReachabilityAppDelegate : UIApplicationDelegate {
UITableView tableView;
NetworkStatus remoteHostStatus, internetStatus, localWifiStatus;
tableView = new UITableView (tableFrame, UITableViewStyle.Grouped) {
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
RowHeight = 44.0f,
SeparatorStyle = UITableViewCellSeparatorStyle.None,
SectionHeaderHeight = 28.0f,
ScrollEnabled = false,
Delegate = new TableViewDelegate (),
DataSource = new DataSource (this)
};
contentView.InsertSubviewBelow (tableView, summaryLabel);
contentView.BringSubviewToFront (summaryLabel);
tableView.ReloadData ();
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
AddTable ();
UpdateStatus ();
//UpdateCarrierWarning ();
window.MakeKeyAndVisible ();
return true;
}
//
// Invoked on the main loop when reachability changes
//
void ReachabilityChanged (NetworkReachabilityFlags flags)
{
UpdateStatus ();
}
void UpdateStatus ()
{
remoteHostStatus = Reachability.RemoteHostStatus ();
internetStatus = Reachability.InternetConnectionStatus ();
localWifiStatus = Reachability.LocalWifiConnectionStatus ();
}
void AddTable ()
{
RectangleF tableFrame = UIScreen.MainScreen.ApplicationFrame;
tableView = new UITableView (tableFrame, UITableViewStyle.Grouped) {
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
RowHeight = 44.0f,
SeparatorStyle = UITableViewCellSeparatorStyle.None,
SectionHeaderHeight = 28.0f,
ScrollEnabled = false,
Source = new DataSource (this),
};
contentView.InsertSubviewBelow (tableView, summaryLabel);
contentView.BringSubviewToFront (summaryLabel);
tableView.ReloadData ();
}
public override void OnActivated (UIApplication application)
{
Console.WriteLine ("OnActivated");
}
class DataSource : UITableViewSource {
ReachabilityAppDelegate parent;
UIImage imageCarrier, imageWiFi, imageStop;
public DataSource (ReachabilityAppDelegate parent)
{
imageCarrier = UIImage.FromFile ("WWAN5.png");
imageWiFi = UIImage.FromFile ("Airport.png");
imageStop = UIImage.FromFile ("stop-32.png");
this.parent = parent;
}
public override NSIndexPath WillSelectRow (UITableView view, NSIndexPath index)
{
return null;
}
public override int RowsInSection (UITableView view, int section)
{
return 1;
}
public override int NumberOfSections (UITableView view)
{
return 3;
}
public override string TitleForHeader (UITableView view, int section)
{
switch (section){
case 0:
return Reachability.HostName;
case 1:
return "Access to internet hosts";
case 2:
return "Access to Local Bonjour Hosts";
default:
return "Unknown";
}
}
static NSString ReachabilityTableCellIdentifier = new NSString ("ReachabilityTableCell");
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell (ReachabilityTableCellIdentifier);
if (cell == null) {
cell = new UITableViewCell (UITableViewCellStyle.Default, ReachabilityTableCellIdentifier);
var label = cell.TextLabel;
label.Font = UIFont.SystemFontOfSize (12f);
label.TextColor = UIColor.DarkGray;
label.TextAlignment = UITextAlignment.Left;
}
var row = indexPath.Row;
string text = "";
UIImage image = null;
switch (indexPath.Section){
case 0:
switch (parent.remoteHostStatus){
case NetworkStatus.NotReachable:
text = "Cannot connect to remote host";
image = imageStop;
break;
case NetworkStatus.ReachableViaCarrierDataNetwork:
text = "Reachable via data carrier network";
image = imageCarrier;
break;
case NetworkStatus.ReachableViaWiFiNetwork:
text = "Reachable via WiFi network";
image = imageWiFi;
break;
}
break;
case 1:
switch (parent.internetStatus){
case NetworkStatus.NotReachable:
text = "Access not available";
image = imageStop;
break;
case NetworkStatus.ReachableViaCarrierDataNetwork:
text = "Avaialble via data carrier network";
image = imageCarrier;
break;
case NetworkStatus.ReachableViaWiFiNetwork:
text = "Available via WiFi network";
image = imageWiFi;
break;
}
break;
case 2:
switch (parent.localWifiStatus){
case NetworkStatus.NotReachable:
text = "Access not available";
image = imageStop;
break;
case NetworkStatus.ReachableViaWiFiNetwork:
text = "Available via WiFi network";
image = imageWiFi;
break;
}
break;
}
cell.TextLabel.Text = text;
cell.ImageView.Image = image;
return cell;
}
}
}
void ReachabilitChanged (NSNotification note)
{
Console.WriteLine ("reachability changed");
}
void UpdateStatus ()
{
}
public override void OnActivated (UIApplication application)
{
Console.WriteLine ("OnActivated");
}
class TableViewDelegate : UITableViewDelegate {
public override NSIndexPath WillSelectRow (UITableView view, NSIndexPath index)
{
return null;
}
}
class DataSource : UITableViewDataSource {
ReachabilityAppDelegate parent;
public DataSource (ReachabilityAppDelegate parent)
{
this.parent = parent;
}
public override int RowsInSection (UITableView view, int section)
{
return 1;
}
public override int NumberOfSections (UITableView view)
{
return 3;
}
public override string TitleForHeader (UITableView view, int section)
{
switch (section){
case 0:
return parent.Hostname;
case 1:
return "Access to internet hosts";
case 2:
return "Access to Local Bonjour Hosts";
default:
return "Unknown";
}
}
static NSString ReachabilityTableCellIdentifier = new NSString ("ReachabilityTableCell");
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell (ReachabilityTableCellIdentifier);
if (cell == null) {
cell = new UITableViewCell (UITableViewCellStyle.Default, ReachabilityTableCellIdentifier);
var label = cell.TextLabel;
label.Font = UIFont.SystemFontOfSize (12f);
label.TextColor = UIColor.DarkGray;
label.TextAlignment = UITextAlignment.Left;
}
var row = indexPath.Row;
switch (indexPath.Section){
case 0:
cell.TextLabel.Text = "First";
break;
case 1:
cell.TextLabel.Text = "First";
break;
case 2:
cell.TextLabel.Text = "First";
break;
}
return cell;
}
class Demo {
static void Main (string [] args)
{
UIApplication.Main (args, null, null);
}
}
}
class Demo {
static void Main (string [] args)
{
UIApplication.Main (args, null, null);
}
}

Просмотреть файл

@ -1,11 +1,20 @@
using System;
using System.Net;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.SystemConfiguration;
using MonoTouch.CoreFoundation;
public class Reachability {
public bool IsReachableWithoutRequiringConnection (NetworkReachabilityFlags flags)
public enum NetworkStatus {
NotReachable,
ReachableViaCarrierDataNetwork,
ReachableViaWiFiNetwork
}
public static class Reachability {
public static string HostName = "www.google.com";
public static bool IsReachableWithoutRequiringConnection (NetworkReachabilityFlags flags)
{
// Is it reachable with the current network configuration?
bool isReachable = (flags & NetworkReachabilityFlags.Reachable) != 0;
@ -22,7 +31,7 @@ public class Reachability {
}
// Is the host reachable with the current network configuration
public bool IsHostReachable (string host)
public static bool IsHostReachable (string host)
{
if (host == null || host.Length == 0)
return false;
@ -37,10 +46,103 @@ public class Reachability {
return false;
}
// Is 169.254.0.0 reachable (ad-hoc wifi
// TODO: need to implement socket address probing
//
// Raised every time there is an interesting reachable event,
// we do not even pass the info as to what changed, and
// we lump all three status we probe into one
//
public static event EventHandler ReachabilityChanged;
static void OnChange (NetworkReachabilityFlags flags)
{
var h = ReachabilityChanged;
if (h != null)
h (null, EventArgs.Empty);
}
//
// Returns true if it is possible to reach the AdHoc WiFi network
// and optionally provides extra network reachability flags as the
// out parameter
//
static NetworkReachability adHocWiFiNetworkReachability;
public static bool IsAdHocWiFiNetworkAvailable (out NetworkReachabilityFlags flags)
{
if (adHocWiFiNetworkReachability == null){
adHocWiFiNetworkReachability = new NetworkReachability (new IPAddress (new byte [] {169,254,0,0}));
adHocWiFiNetworkReachability.SetCallback (OnChange);
adHocWiFiNetworkReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
}
if (!adHocWiFiNetworkReachability.TryGetFlags (out flags))
return false;
return IsReachableWithoutRequiringConnection (flags);
}
static NetworkReachability defaultRouteReachability;
static bool IsNetworkAvaialable (out NetworkReachabilityFlags flags)
{
if (defaultRouteReachability == null){
defaultRouteReachability = new NetworkReachability (new IPAddress (0));
defaultRouteReachability.SetCallback (OnChange);
defaultRouteReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
}
if (defaultRouteReachability.TryGetFlags (out flags))
return false;
return IsReachableWithoutRequiringConnection (flags);
}
static NetworkReachability remoteHostReachability;
public static NetworkStatus RemoteHostStatus ()
{
NetworkReachabilityFlags flags;
bool reachable;
if (remoteHostReachability == null){
remoteHostReachability = new NetworkReachability (HostName);
// Need to probe before we queue, or we wont get any meaningful values
// this only happens when you create NetworkReachability from a hostname
reachable = remoteHostReachability.TryGetFlags (out flags);
remoteHostReachability.SetCallback (OnChange);
remoteHostReachability.Schedule (CFRunLoop.Current, CFRunLoop.ModeDefault);
} else
reachable = remoteHostReachability.TryGetFlags (out flags);
if (!reachable)
return NetworkStatus.NotReachable;
if (!IsReachableWithoutRequiringConnection (flags))
return NetworkStatus.NotReachable;
if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
return NetworkStatus.ReachableViaCarrierDataNetwork;
return NetworkStatus.ReachableViaWiFiNetwork;
}
public static NetworkStatus InternetConnectionStatus ()
{
NetworkReachabilityFlags flags;
bool defaultNetworkAvailable = IsNetworkAvaialable (out flags);
if (defaultNetworkAvailable){
if ((flags & NetworkReachabilityFlags.IsDirect) != 0)
return NetworkStatus.NotReachable;
} else if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
return NetworkStatus.ReachableViaCarrierDataNetwork;
return NetworkStatus.ReachableViaWiFiNetwork;
}
public static NetworkStatus LocalWifiConnectionStatus ()
{
NetworkReachabilityFlags flags;
if (IsAdHocWiFiNetworkAvailable (out flags)){
if ((flags & NetworkReachabilityFlags.IsDirect) != 0)
return NetworkStatus.ReachableViaWiFiNetwork;
}
return NetworkStatus.NotReachable;
}
}

Просмотреть файл

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E1356D0A-1572-4157-BD97-05F0B9DA832E}</ProjectGuid>
<ProjectTypeGuids>{E613F3A2-FE9C-494F-B74E-F63BCB86FEA6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>reachability</RootNamespace>
<MainNibFile>MainWindow.xib</MainNibFile>
<AssemblyName>reachability</AssemblyName>
<MtouchSdkVersion>3.0</MtouchSdkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<BundleIcon>icon.png</BundleIcon>
</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>
<PlatformTarget>x86</PlatformTarget>
<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>
<PlatformTarget>x86</PlatformTarget>
<MtouchLink>None</MtouchLink>
<MtouchDebug>False</MtouchDebug>
</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>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>True</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>False</MtouchDebug>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.xib.designer.cs">
<DependentUpon>MainWindow.xib</DependentUpon>
</Compile>
<Compile Include="Main.cs" />
<Compile Include="reachability.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MainWindow.xib" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties InternalTargetFrameworkVersion="IPhone" />
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<Content Include="Network.png" />
<Content Include="Airport.png" />
<Content Include="stop-32.png" />
<Content Include="WWAN5.png" />
<Content Include="icon.png" />
<Content Include="Default.png" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "reachability", "reachability.csproj", "{E1356D0A-1572-4157-BD97-05F0B9DA832E}"
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
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Debug|iPhone.ActiveCfg = Debug|iPhone
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Debug|iPhone.Build.0 = Debug|iPhone
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Release|iPhone.ActiveCfg = Release|iPhone
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Release|iPhone.Build.0 = Release|iPhone
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{E1356D0A-1572-4157-BD97-05F0B9DA832E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = reachability.csproj
EndGlobalSection
EndGlobal