[autoformat] Add common test files. (#16740)
This commit is contained in:
Родитель
0a0076c6b0
Коммит
3585c66844
|
@ -10,11 +10,9 @@ using Mono.Cecil;
|
|||
|
||||
using Xamarin.Tests;
|
||||
|
||||
namespace Xamarin.ApiTest
|
||||
{
|
||||
namespace Xamarin.ApiTest {
|
||||
[TestFixture]
|
||||
public class ApiTest
|
||||
{
|
||||
public class ApiTest {
|
||||
[Test]
|
||||
#if MONOTOUCH
|
||||
[TestCase (Profile.iOS)]
|
||||
|
@ -51,7 +49,7 @@ namespace Xamarin.ApiTest
|
|||
case "BlockLiteral":
|
||||
if (type == mr.DeclaringType)
|
||||
continue; // Calls within BlockLiteral without the optimizable attribute is allowed
|
||||
|
||||
|
||||
switch (mr.Name) {
|
||||
case "SetupBlock":
|
||||
case "SetupBlockUnsafe":
|
||||
|
|
|
@ -12,96 +12,96 @@ using NUnit.Framework;
|
|||
using NUnit.Framework.Constraints;
|
||||
|
||||
namespace MonoTests {
|
||||
/*
|
||||
class CategoryAttribute : Attribute
|
||||
{
|
||||
public string Category { get; set; }
|
||||
|
||||
public CategoryAttribute (string category)
|
||||
/*
|
||||
class CategoryAttribute : Attribute
|
||||
{
|
||||
this.Category = category;
|
||||
public string Category { get; set; }
|
||||
|
||||
public CategoryAttribute (string category)
|
||||
{
|
||||
this.Category = category;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
static class Assert
|
||||
{
|
||||
public static void AreEqual (object a, object b, string msg)
|
||||
/*
|
||||
static class Assert
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.EqualTo (b), msg);
|
||||
public static void AreEqual (object a, object b, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.EqualTo (b), msg);
|
||||
}
|
||||
|
||||
public static void AreEqual (object a, object b)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.EqualTo (b));
|
||||
}
|
||||
|
||||
public static void IsNotNull (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Not.Null, msg);
|
||||
}
|
||||
|
||||
public static void IsNotNull (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Not.Null);
|
||||
}
|
||||
|
||||
public static void IsNull (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Null, msg);
|
||||
}
|
||||
|
||||
public static void IsNull (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Null);
|
||||
}
|
||||
|
||||
public static void IsTrue (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.True, msg);
|
||||
}
|
||||
|
||||
public static void IsTrue (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.True);
|
||||
}
|
||||
|
||||
public static void IsFalse (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.False, msg);
|
||||
}
|
||||
|
||||
public static void IsFalse (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.False);
|
||||
}
|
||||
|
||||
public static void AreSame (object a, object b)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.SameAs (b));
|
||||
}
|
||||
|
||||
public static void AreSame (object a, object b, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.SameAs (b), msg);
|
||||
}
|
||||
|
||||
public static void Fail (string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.Fail (msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AreEqual (object a, object b)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.EqualTo (b));
|
||||
}
|
||||
|
||||
public static void IsNotNull (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Not.Null, msg);
|
||||
}
|
||||
|
||||
public static void IsNotNull (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Not.Null);
|
||||
}
|
||||
|
||||
public static void IsNull (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Null, msg);
|
||||
}
|
||||
|
||||
public static void IsNull (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.Null);
|
||||
}
|
||||
|
||||
public static void IsTrue (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.True, msg);
|
||||
}
|
||||
|
||||
public static void IsTrue (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.True);
|
||||
}
|
||||
|
||||
public static void IsFalse (object o, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.False, msg);
|
||||
}
|
||||
|
||||
public static void IsFalse (object o)
|
||||
{
|
||||
NUnit.Framework.Assert.That (o, Is.False);
|
||||
}
|
||||
|
||||
public static void AreSame (object a, object b)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.SameAs (b));
|
||||
}
|
||||
|
||||
public static void AreSame (object a, object b, string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.SameAs (b), msg);
|
||||
}
|
||||
|
||||
public static void Fail (string msg)
|
||||
{
|
||||
NUnit.Framework.Assert.Fail (msg);
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
// nunit 1.x compatibility
|
||||
public class TestCase {
|
||||
protected virtual void SetUp ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public static void Assert (string msg, bool condition)
|
||||
{
|
||||
NUnit.Framework.Assert.True (condition, msg);
|
||||
}
|
||||
|
||||
|
||||
public static void AssertEquals (object a, object b)
|
||||
{
|
||||
NUnit.Framework.Assert.That (a, Is.EqualTo (b));
|
||||
|
@ -137,45 +137,45 @@ namespace MonoTests {
|
|||
NUnit.Framework.Assert.Fail (msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Assertion : TestCase {
|
||||
}
|
||||
|
||||
|
||||
public class TestFixtureSetUpAttribute : SetUpAttribute {
|
||||
}
|
||||
|
||||
public class StringAssert {
|
||||
#region StartsWith
|
||||
static public void StartsWith(string expected, string actual, string message, params object[] args)
|
||||
static public void StartsWith (string expected, string actual, string message, params object [] args)
|
||||
{
|
||||
Assert.That(actual, new StartsWithConstraint(expected), message, args);
|
||||
Assert.That (actual, new StartsWithConstraint (expected), message, args);
|
||||
}
|
||||
|
||||
static public void StartsWith(string expected, string actual, string message)
|
||||
static public void StartsWith (string expected, string actual, string message)
|
||||
{
|
||||
StartsWith(expected, actual, message, null);
|
||||
StartsWith (expected, actual, message, null);
|
||||
}
|
||||
|
||||
static public void StartsWith(string expected, string actual)
|
||||
static public void StartsWith (string expected, string actual)
|
||||
{
|
||||
StartsWith(expected, actual, string.Empty, null);
|
||||
StartsWith (expected, actual, string.Empty, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Contains
|
||||
static public void Contains(string expected, string actual, string message, params object[] args)
|
||||
static public void Contains (string expected, string actual, string message, params object [] args)
|
||||
{
|
||||
Assert.That(actual, new SubstringConstraint(expected), message, args);
|
||||
Assert.That (actual, new SubstringConstraint (expected), message, args);
|
||||
}
|
||||
|
||||
static public void Contains(string expected, string actual, string message)
|
||||
static public void Contains (string expected, string actual, string message)
|
||||
{
|
||||
Contains(expected, actual, message, null);
|
||||
Contains (expected, actual, message, null);
|
||||
}
|
||||
|
||||
static public void Contains(string expected, string actual)
|
||||
static public void Contains (string expected, string actual)
|
||||
{
|
||||
Contains(expected, actual, string.Empty, null);
|
||||
Contains (expected, actual, string.Empty, null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -4,13 +4,11 @@ using System.Text.RegularExpressions;
|
|||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Xamarin.Tests
|
||||
{
|
||||
namespace Xamarin.Tests {
|
||||
public delegate void Action ();
|
||||
|
||||
public static class Asserts
|
||||
{
|
||||
public static void Throws<T> (Action action, string expectedExceptionMessage, string message = "") where T: Exception
|
||||
public static class Asserts {
|
||||
public static void Throws<T> (Action action, string expectedExceptionMessage, string message = "") where T : Exception
|
||||
{
|
||||
try {
|
||||
action ();
|
||||
|
@ -20,7 +18,7 @@ namespace Xamarin.Tests
|
|||
}
|
||||
}
|
||||
|
||||
public static void ThrowsPartial<T> (Action action, string [] expectedExceptionMessages, string message = "") where T: Exception
|
||||
public static void ThrowsPartial<T> (Action action, string [] expectedExceptionMessages, string message = "") where T : Exception
|
||||
{
|
||||
try {
|
||||
action ();
|
||||
|
@ -31,8 +29,8 @@ namespace Xamarin.Tests
|
|||
StartsWith (expectedExceptionMessages [i], actual [i], i.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
public static void ThrowsPattern<T> (Action action, string expectedExceptionPattern, string message = "") where T: Exception
|
||||
|
||||
public static void ThrowsPattern<T> (Action action, string expectedExceptionPattern, string message = "") where T : Exception
|
||||
{
|
||||
try {
|
||||
action ();
|
||||
|
@ -41,13 +39,13 @@ namespace Xamarin.Tests
|
|||
IsLike (expectedExceptionPattern, ex.Message, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void StartsWith (string expectedStartsWith, string actual, string message)
|
||||
{
|
||||
if (!actual.StartsWith (expectedStartsWith, StringComparison.Ordinal))
|
||||
throw new AssertionException (string.Format ("Expected '{0}' to start with '{1}'. {2}", actual, expectedStartsWith, message));
|
||||
}
|
||||
|
||||
|
||||
public static void IsLike (string pattern, string actual, string message)
|
||||
{
|
||||
if (!Regex.IsMatch (actual, pattern, RegexOptions.CultureInvariant))
|
||||
|
|
|
@ -16,11 +16,9 @@ using BundlerTool = Xamarin.MTouchTool;
|
|||
using BundlerTool = Xamarin.MmpTool;
|
||||
#endif
|
||||
|
||||
namespace Xamarin
|
||||
{
|
||||
namespace Xamarin {
|
||||
[TestFixture]
|
||||
public class BundlerTests
|
||||
{
|
||||
public class BundlerTests {
|
||||
#if __MACOS__
|
||||
// The cache doesn't work properly in mmp yet.
|
||||
// [TestCase (Profile.macOSMobile)]
|
||||
|
|
|
@ -8,10 +8,8 @@ using NUnit.Framework;
|
|||
|
||||
using Xamarin.Utils;
|
||||
|
||||
namespace Xamarin.Tests
|
||||
{
|
||||
public enum LinkerOption
|
||||
{
|
||||
namespace Xamarin.Tests {
|
||||
public enum LinkerOption {
|
||||
Unspecified,
|
||||
LinkAll,
|
||||
LinkSdk,
|
||||
|
@ -19,16 +17,14 @@ namespace Xamarin.Tests
|
|||
LinkPlatform, // only applicable for XM
|
||||
}
|
||||
|
||||
public enum RegistrarOption
|
||||
{
|
||||
public enum RegistrarOption {
|
||||
Unspecified,
|
||||
Dynamic,
|
||||
Static,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum I18N
|
||||
{
|
||||
enum I18N {
|
||||
None = 0,
|
||||
|
||||
CJK = 1,
|
||||
|
@ -42,8 +38,7 @@ namespace Xamarin.Tests
|
|||
}
|
||||
|
||||
// This class represents options/logic that is identical between mtouch and mmp
|
||||
abstract class BundlerTool : Tool
|
||||
{
|
||||
abstract class BundlerTool : Tool {
|
||||
public const string None = "None";
|
||||
public bool AlwaysShowOutput;
|
||||
|
||||
|
@ -327,7 +322,7 @@ namespace Xamarin.Tests
|
|||
return;
|
||||
var errors = Messages.Where ((v) => v.IsError).ToList ();
|
||||
Assert.Fail ($"Expected execution to succeed, but exit code was {rv}, and there were {errors.Count} error(s).\nCommand: {ToolPath} {StringUtils.FormatArguments (ToolArguments)}\nMessage: {message}\n\t" +
|
||||
string.Join ("\n\t", errors.Select ((v) => v.ToString ())));
|
||||
string.Join ("\n\t", errors.Select ((v) => v.ToString ())));
|
||||
}
|
||||
|
||||
public void AssertExecuteFailure (string message = null)
|
||||
|
|
|
@ -13,11 +13,9 @@ using NUnit.Framework;
|
|||
|
||||
using Xamarin;
|
||||
|
||||
namespace Xamarin.Tests
|
||||
{
|
||||
namespace Xamarin.Tests {
|
||||
[TestFixture]
|
||||
public class ProductTests
|
||||
{
|
||||
public class ProductTests {
|
||||
[Test]
|
||||
public void MonoVersion ()
|
||||
{
|
||||
|
@ -80,7 +78,7 @@ namespace Xamarin.Tests
|
|||
|
||||
Version lc_min_version;
|
||||
var mincmd = lc as MinCommand;
|
||||
if (mincmd != null){
|
||||
if (mincmd != null) {
|
||||
Assert.AreEqual (load_command, mincmd.Command, "Unexpected min load command");
|
||||
lc_min_version = mincmd.Version;
|
||||
} else {
|
||||
|
@ -101,7 +99,7 @@ namespace Xamarin.Tests
|
|||
alternativePlatform = MachO.Platform.WatchOS;
|
||||
break;
|
||||
}
|
||||
Assert.That (buildver.Platform, Is.EqualTo (platform).Or.EqualTo (alternativePlatform) , $"Unexpected build version command in {machoFile} ({slice.Filename})");
|
||||
Assert.That (buildver.Platform, Is.EqualTo (platform).Or.EqualTo (alternativePlatform), $"Unexpected build version command in {machoFile} ({slice.Filename})");
|
||||
lc_min_version = buildver.MinOS;
|
||||
}
|
||||
|
||||
|
@ -189,11 +187,10 @@ namespace Xamarin.Tests
|
|||
}
|
||||
}
|
||||
|
||||
static class VersionExtensions
|
||||
{
|
||||
public static Version WithBuild (this Version version)
|
||||
{
|
||||
return new Version (version.Major, version.Minor, version.Build < 0 ? 0 : version.Build);
|
||||
}
|
||||
static class VersionExtensions {
|
||||
public static Version WithBuild (this Version version)
|
||||
{
|
||||
return new Version (version.Major, version.Minor, version.Build < 0 ? 0 : version.Build);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace AppWithExtraArgumentThatOverrides
|
||||
{
|
||||
namespace AppWithExtraArgumentThatOverrides {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window
|
||||
{
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using UIKit;
|
||||
|
||||
namespace AppWithExtraArgumentThatOverrides
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace AppWithExtraArgumentThatOverrides {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -2,10 +2,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace AppWithExtraArgumentThatOverrides
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace AppWithExtraArgumentThatOverrides {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -7,8 +7,7 @@ using ObjCRuntime;
|
|||
static class MainClass {
|
||||
static int Main (string [] args)
|
||||
{
|
||||
Runtime.AssemblyRegistration += (object sender, AssemblyRegistrationEventArgs ea) =>
|
||||
{
|
||||
Runtime.AssemblyRegistration += (object sender, AssemblyRegistrationEventArgs ea) => {
|
||||
Console.WriteLine (ea.AssemblyName);
|
||||
switch (ea.AssemblyName.Name) {
|
||||
case "AssemblyRegistration":
|
||||
|
|
|
@ -4,10 +4,8 @@ using Foundation;
|
|||
using AppKit;
|
||||
using MyLibrary;
|
||||
|
||||
namespace BasicPCLTest
|
||||
{
|
||||
public partial class AppDelegate : NSApplicationDelegate
|
||||
{
|
||||
namespace BasicPCLTest {
|
||||
public partial class AppDelegate : NSApplicationDelegate {
|
||||
public AppDelegate ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -2,11 +2,9 @@ using System;
|
|||
|
||||
using AppKit;
|
||||
|
||||
namespace BasicPCLTest
|
||||
{
|
||||
static class MainClass
|
||||
{
|
||||
static void Main (string[] args)
|
||||
namespace BasicPCLTest {
|
||||
static class MainClass {
|
||||
static void Main (string [] args)
|
||||
{
|
||||
NSApplication.Init ();
|
||||
NSApplication.SharedApplication.Delegate = new AppDelegate ();
|
||||
|
|
|
@ -2,18 +2,16 @@ using System;
|
|||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MyLibrary
|
||||
{
|
||||
public class MyClass
|
||||
{
|
||||
namespace MyLibrary {
|
||||
public class MyClass {
|
||||
public static void DoIt ()
|
||||
{
|
||||
JArray array = new JArray();
|
||||
array.Add("Manual text");
|
||||
array.Add(new DateTime(2000, 5, 23));
|
||||
JArray array = new JArray ();
|
||||
array.Add ("Manual text");
|
||||
array.Add (new DateTime (2000, 5, 23));
|
||||
|
||||
JObject o = new JObject();
|
||||
o["MyArray"] = array;
|
||||
JObject o = new JObject ();
|
||||
o ["MyArray"] = array;
|
||||
|
||||
var fileName = "../../../../../TestResult.txt";
|
||||
if (File.Exists (fileName))
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Bug60536
|
||||
{
|
||||
namespace Bug60536 {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
// THE SOFTWARE.
|
||||
using UIKit;
|
||||
|
||||
namespace Bug60536
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace Bug60536 {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -26,10 +26,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace Bug60536
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace Bug60536 {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -4,14 +4,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpacedApp
|
||||
{
|
||||
namespace MySpacedApp {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
|
|
|
@ -4,12 +4,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpacedApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MySpacedApp {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -3,10 +3,8 @@ using CoreGraphics;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpacedApp
|
||||
{
|
||||
public partial class MySpacedAppViewController : UIViewController
|
||||
{
|
||||
namespace MySpacedApp {
|
||||
public partial class MySpacedAppViewController : UIViewController {
|
||||
public MySpacedAppViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +13,7 @@ namespace MySpacedApp
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -24,7 +22,7 @@ namespace MySpacedApp
|
|||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,8 @@ using MobileCoreServices;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyActionExtension
|
||||
{
|
||||
public partial class ActionViewController : UIViewController
|
||||
{
|
||||
namespace MyActionExtension {
|
||||
public partial class ActionViewController : UIViewController {
|
||||
public ActionViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -35,10 +33,12 @@ namespace MyActionExtension
|
|||
foreach (var itemProvider in item.Attachments) {
|
||||
if (itemProvider.HasItemConformingTo (UTType.Image)) {
|
||||
// This is an image. We'll load it, then place it in our image view.
|
||||
itemProvider.LoadItem (UTType.Image, null, delegate (NSObject image, NSError error) {
|
||||
itemProvider.LoadItem (UTType.Image, null, delegate (NSObject image, NSError error)
|
||||
{
|
||||
if (image != null) {
|
||||
NSOperationQueue.MainQueue.AddOperation (delegate {
|
||||
imageView.Image = (UIImage)image;
|
||||
NSOperationQueue.MainQueue.AddOperation (delegate
|
||||
{
|
||||
imageView.Image = (UIImage) image;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,18 +5,16 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTabbedApplication
|
||||
{
|
||||
namespace MyTabbedApplication {
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
Console.WriteLine (typeof (Newtonsoft.Json.JsonReader));
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using Foundation;
|
||||
|
||||
namespace LibraryA {
|
||||
[BaseType(typeof(NSObject))]
|
||||
interface A {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
using Foundation;
|
||||
|
||||
namespace LibraryA {
|
||||
[BaseType (typeof (NSObject))]
|
||||
interface A {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using Foundation;
|
||||
using LibraryA;
|
||||
|
||||
namespace LibraryB {
|
||||
[BaseType(typeof(NSObject))]
|
||||
interface B {
|
||||
[Export("a")]
|
||||
A GetA();
|
||||
}
|
||||
}
|
||||
|
||||
namespace LibraryB {
|
||||
[BaseType (typeof (NSObject))]
|
||||
interface B {
|
||||
[Export ("a")]
|
||||
A GetA ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
namespace MySingleView {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
|
|
|
@ -4,12 +4,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MySingleView {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -3,10 +3,8 @@ using CoreGraphics;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public partial class MySingleViewViewController : UIViewController
|
||||
{
|
||||
namespace MySingleView {
|
||||
public partial class MySingleViewViewController : UIViewController {
|
||||
public MySingleViewViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +13,7 @@ namespace MySingleView
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -24,7 +22,7 @@ namespace MySingleView
|
|||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyXamarinFormsApp.iOS
|
||||
{
|
||||
namespace MyXamarinFormsApp.iOS {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate {
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
|
|
|
@ -5,10 +5,8 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyXamarinFormsApp.iOS
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyXamarinFormsApp.iOS {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string [] args)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,8 @@ using System;
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace MyXamarinFormsApp
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
namespace MyXamarinFormsApp {
|
||||
public partial class App : Application {
|
||||
public App ()
|
||||
{
|
||||
InitializeComponent ();
|
||||
|
|
|
@ -6,13 +6,11 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace MyXamarinFormsApp
|
||||
{
|
||||
namespace MyXamarinFormsApp {
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible (false)]
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public partial class MainPage : ContentPage {
|
||||
public MainPage ()
|
||||
{
|
||||
InitializeComponent ();
|
||||
|
|
|
@ -5,11 +5,9 @@ using CoreGraphics;
|
|||
using CoreVideo;
|
||||
using Foundation;
|
||||
|
||||
namespace MyCocoaCoreMLApp
|
||||
{
|
||||
static class MainClass
|
||||
{
|
||||
static void Main (string[] args)
|
||||
namespace MyCocoaCoreMLApp {
|
||||
static class MainClass {
|
||||
static void Main (string [] args)
|
||||
{
|
||||
NSApplication.Init ();
|
||||
NSApplication.SharedApplication.Delegate = new AppDelegate ();
|
||||
|
@ -17,8 +15,7 @@ namespace MyCocoaCoreMLApp
|
|||
}
|
||||
}
|
||||
|
||||
public partial class AppDelegate : NSApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : NSApplicationDelegate {
|
||||
NSWindow window;
|
||||
public override void DidFinishLaunching (NSNotification notification)
|
||||
{
|
||||
|
|
|
@ -16,8 +16,7 @@ namespace MyCocoaCoreMLApp {
|
|||
/// <summary>
|
||||
/// Model Prediction Input Type
|
||||
/// </summary>
|
||||
public class SqueezeNetInput : NSObject, IMLFeatureProvider
|
||||
{
|
||||
public class SqueezeNetInput : NSObject, IMLFeatureProvider {
|
||||
static readonly NSSet<NSString> featureNames = new NSSet<NSString> (
|
||||
new NSString ("image")
|
||||
);
|
||||
|
@ -64,8 +63,7 @@ namespace MyCocoaCoreMLApp {
|
|||
/// <summary>
|
||||
/// Model Prediction Output Type
|
||||
/// </summary>
|
||||
public class SqueezeNetOutput : NSObject, IMLFeatureProvider
|
||||
{
|
||||
public class SqueezeNetOutput : NSObject, IMLFeatureProvider {
|
||||
static readonly NSSet<NSString> featureNames = new NSSet<NSString> (
|
||||
new NSString ("classLabelProbs"), new NSString ("classLabel")
|
||||
);
|
||||
|
@ -139,8 +137,7 @@ namespace MyCocoaCoreMLApp {
|
|||
/// <summary>
|
||||
/// Class for model loading and prediction
|
||||
/// </summary>
|
||||
public class SqueezeNet : NSObject
|
||||
{
|
||||
public class SqueezeNet : NSObject {
|
||||
readonly MLModel model;
|
||||
|
||||
public SqueezeNet ()
|
||||
|
|
|
@ -3,11 +3,9 @@ using CoreGraphics;
|
|||
using Foundation;
|
||||
using SceneKit;
|
||||
|
||||
namespace MyCocoaSceneKitApp
|
||||
{
|
||||
static class MainClass
|
||||
{
|
||||
static void Main (string[] args)
|
||||
namespace MyCocoaSceneKitApp {
|
||||
static class MainClass {
|
||||
static void Main (string [] args)
|
||||
{
|
||||
NSApplication.Init ();
|
||||
NSApplication.SharedApplication.Delegate = new AppDelegate ();
|
||||
|
@ -15,8 +13,7 @@ namespace MyCocoaSceneKitApp
|
|||
}
|
||||
}
|
||||
|
||||
public partial class AppDelegate : NSApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : NSApplicationDelegate {
|
||||
NSWindow window;
|
||||
public override void DidFinishLaunching (NSNotification notification)
|
||||
{
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyCoreMLApp
|
||||
{
|
||||
namespace MyCoreMLApp {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
// THE SOFTWARE.
|
||||
using UIKit;
|
||||
|
||||
namespace MyCoreMLApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyCoreMLApp {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -16,8 +16,7 @@ namespace MyCoreMLApp {
|
|||
/// <summary>
|
||||
/// Model Prediction Input Type
|
||||
/// </summary>
|
||||
public class SqueezeNetInput : NSObject, IMLFeatureProvider
|
||||
{
|
||||
public class SqueezeNetInput : NSObject, IMLFeatureProvider {
|
||||
static readonly NSSet<NSString> featureNames = new NSSet<NSString> (
|
||||
new NSString ("image")
|
||||
);
|
||||
|
@ -64,8 +63,7 @@ namespace MyCoreMLApp {
|
|||
/// <summary>
|
||||
/// Model Prediction Output Type
|
||||
/// </summary>
|
||||
public class SqueezeNetOutput : NSObject, IMLFeatureProvider
|
||||
{
|
||||
public class SqueezeNetOutput : NSObject, IMLFeatureProvider {
|
||||
static readonly NSSet<NSString> featureNames = new NSSet<NSString> (
|
||||
new NSString ("classLabelProbs"), new NSString ("classLabel")
|
||||
);
|
||||
|
@ -139,8 +137,7 @@ namespace MyCoreMLApp {
|
|||
/// <summary>
|
||||
/// Class for model loading and prediction
|
||||
/// </summary>
|
||||
public class SqueezeNet : NSObject
|
||||
{
|
||||
public class SqueezeNet : NSObject {
|
||||
readonly MLModel model;
|
||||
|
||||
public SqueezeNet ()
|
||||
|
|
|
@ -26,10 +26,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace MyCoreMLApp
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace MyCoreMLApp {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -4,10 +4,8 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyDocumentPickerExtension
|
||||
{
|
||||
public partial class DocumentPickerViewController : UIDocumentPickerExtensionViewController
|
||||
{
|
||||
namespace MyDocumentPickerExtension {
|
||||
public partial class DocumentPickerViewController : UIDocumentPickerExtensionViewController {
|
||||
public DocumentPickerViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyExtensionWithPackageReference
|
||||
{
|
||||
public partial class ActionViewController : UIViewController
|
||||
{
|
||||
namespace MyExtensionWithPackageReference {
|
||||
public partial class ActionViewController : UIViewController {
|
||||
public ActionViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
Console.WriteLine (typeof (Newtonsoft.Json.JsonReader));
|
||||
|
|
|
@ -1,57 +1,54 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyIBToolLinkTest
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
namespace MyIBToolLinkTest {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public override UIWindow Window {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
// Override point for customization after application launch.
|
||||
// If not required for your application you can safely delete this method
|
||||
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
// Override point for customization after application launch.
|
||||
// If not required for your application you can safely delete this method
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
// Invoked when the application is about to move from active to inactive state.
|
||||
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
|
||||
// or when the user quits the application and it begins the transition to the background state.
|
||||
// Games should use this method to pause the game.
|
||||
}
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
// Invoked when the application is about to move from active to inactive state.
|
||||
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
|
||||
// or when the user quits the application and it begins the transition to the background state.
|
||||
// Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
|
||||
// If your application supports background execution this method is called instead of WillTerminate when the user quits.
|
||||
}
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
|
||||
// If your application supports background execution this method is called instead of WillTerminate when the user quits.
|
||||
}
|
||||
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
// Called as part of the transition from background to active state.
|
||||
// Here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
// Called as part of the transition from background to active state.
|
||||
// Here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
public override void OnActivated (UIApplication application)
|
||||
{
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive.
|
||||
// If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
public override void OnActivated (UIApplication application)
|
||||
{
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive.
|
||||
// If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
|
||||
}
|
||||
}
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
using UIKit;
|
||||
|
||||
namespace MyIBToolLinkTest
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
namespace MyIBToolLinkTest {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,25 +2,23 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace MyIBToolLinkTest
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
}
|
||||
namespace MyIBToolLinkTest {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
}
|
||||
|
||||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
public override void DidReceiveMemoryWarning ()
|
||||
{
|
||||
base.DidReceiveMemoryWarning ();
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
}
|
||||
public override void DidReceiveMemoryWarning ()
|
||||
{
|
||||
base.DidReceiveMemoryWarning ();
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@ using ObjCRuntime;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyKeyboardExtension
|
||||
{
|
||||
public partial class KeyboardViewController : UIInputViewController
|
||||
{
|
||||
namespace MyKeyboardExtension {
|
||||
public partial class KeyboardViewController : UIInputViewController {
|
||||
UIButton nextKeyboardButton;
|
||||
|
||||
public KeyboardViewController (IntPtr handle) : base (handle)
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyLinkedAssets
|
||||
{
|
||||
namespace MyLinkedAssets {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
// THE SOFTWARE.
|
||||
using UIKit;
|
||||
|
||||
namespace MyLinkedAssets
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyLinkedAssets {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -26,10 +26,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace MyLinkedAssets
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace MyLinkedAssets {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -3,14 +3,12 @@ using System;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMasterDetailApp
|
||||
{
|
||||
namespace MyMasterDetailApp {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
@ -22,14 +20,14 @@ namespace MyMasterDetailApp
|
|||
{
|
||||
// Override point for customization after application launch.
|
||||
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
|
||||
var splitViewController = (UISplitViewController)Window.RootViewController;
|
||||
var splitViewController = (UISplitViewController) Window.RootViewController;
|
||||
|
||||
// Get the UINavigationControllers containing our master & detail view controllers
|
||||
var masterNavigationController = (UINavigationController)splitViewController.ViewControllers [0];
|
||||
var detailNavigationController = (UINavigationController)splitViewController.ViewControllers [1];
|
||||
var masterNavigationController = (UINavigationController) splitViewController.ViewControllers [0];
|
||||
var detailNavigationController = (UINavigationController) splitViewController.ViewControllers [1];
|
||||
|
||||
var masterViewController = (MasterViewController)masterNavigationController.TopViewController;
|
||||
var detailViewController = (DetailViewController)detailNavigationController.TopViewController;
|
||||
var masterViewController = (MasterViewController) masterNavigationController.TopViewController;
|
||||
var detailViewController = (DetailViewController) detailNavigationController.TopViewController;
|
||||
|
||||
masterViewController.DetailViewController = detailViewController;
|
||||
|
||||
|
|
|
@ -5,10 +5,8 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMasterDetailApp
|
||||
{
|
||||
public partial class DetailViewController : UIViewController
|
||||
{
|
||||
namespace MyMasterDetailApp {
|
||||
public partial class DetailViewController : UIViewController {
|
||||
UIPopoverController masterPopoverController;
|
||||
object detailItem;
|
||||
|
||||
|
@ -20,11 +18,11 @@ namespace MyMasterDetailApp
|
|||
{
|
||||
if (detailItem != newDetailItem) {
|
||||
detailItem = newDetailItem;
|
||||
|
||||
|
||||
// Update the view
|
||||
ConfigureView ();
|
||||
}
|
||||
|
||||
|
||||
if (masterPopoverController != null)
|
||||
masterPopoverController.Dismiss (true);
|
||||
}
|
||||
|
@ -40,14 +38,14 @@ namespace MyMasterDetailApp
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
ConfigureView ();
|
||||
}
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMasterDetailApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyMasterDetailApp {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -6,21 +6,19 @@ using CoreGraphics;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMasterDetailApp
|
||||
{
|
||||
public partial class MasterViewController : UITableViewController
|
||||
{
|
||||
namespace MyMasterDetailApp {
|
||||
public partial class MasterViewController : UITableViewController {
|
||||
DataSource dataSource;
|
||||
|
||||
public MasterViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
Title = NSBundle.MainBundle.GetLocalizedString ("Master", "Master");
|
||||
|
||||
|
||||
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
|
||||
PreferredContentSize = new CGSize (320f, 600f);
|
||||
ClearsSelectionOnViewWillAppear = false;
|
||||
}
|
||||
|
||||
|
||||
// Custom initialization
|
||||
}
|
||||
|
||||
|
@ -34,14 +32,14 @@ namespace MyMasterDetailApp
|
|||
dataSource.Objects.Insert (0, DateTime.Now);
|
||||
|
||||
using (var indexPath = NSIndexPath.FromRowSection (0, 0))
|
||||
TableView.InsertRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Automatic);
|
||||
TableView.InsertRows (new NSIndexPath [] { indexPath }, UITableViewRowAnimation.Automatic);
|
||||
}
|
||||
|
||||
public override void DidReceiveMemoryWarning ()
|
||||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -58,8 +56,7 @@ namespace MyMasterDetailApp
|
|||
TableView.Source = dataSource = new DataSource (this);
|
||||
}
|
||||
|
||||
class DataSource : UITableViewSource
|
||||
{
|
||||
class DataSource : UITableViewSource {
|
||||
static readonly NSString CellIdentifier = new NSString ("Cell");
|
||||
readonly List<object> objects = new List<object> ();
|
||||
readonly MasterViewController controller;
|
||||
|
@ -87,7 +84,7 @@ namespace MyMasterDetailApp
|
|||
// Customize the appearance of table view cells.
|
||||
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
|
||||
{
|
||||
var cell = (UITableViewCell)tableView.DequeueReusableCell (CellIdentifier, indexPath);
|
||||
var cell = (UITableViewCell) tableView.DequeueReusableCell (CellIdentifier, indexPath);
|
||||
|
||||
cell.TextLabel.Text = objects [indexPath.Row].ToString ();
|
||||
|
||||
|
@ -105,7 +102,7 @@ namespace MyMasterDetailApp
|
|||
if (editingStyle == UITableViewCellEditingStyle.Delete) {
|
||||
// Delete the row from the data source.
|
||||
objects.RemoveAt (indexPath.Row);
|
||||
controller.TableView.DeleteRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
|
||||
controller.TableView.DeleteRows (new NSIndexPath [] { indexPath }, UITableViewRowAnimation.Fade);
|
||||
} else if (editingStyle == UITableViewCellEditingStyle.Insert) {
|
||||
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
|
||||
}
|
||||
|
@ -140,7 +137,7 @@ namespace MyMasterDetailApp
|
|||
var indexPath = TableView.IndexPathForSelectedRow;
|
||||
var item = dataSource.Objects [indexPath.Row];
|
||||
|
||||
((DetailViewController)segue.DestinationViewController).SetDetailItem (item);
|
||||
((DetailViewController) segue.DestinationViewController).SetDetailItem (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,39 +5,37 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMetalGame
|
||||
{
|
||||
namespace MyMetalGame {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
// This method is invoked when the application is about to move from active to inactive state.
|
||||
// OpenGL applications should use this method to pause.
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method should be used to release shared resources and it should store the application state.
|
||||
// If your application supports background execution this method is called instead of WillTerminate
|
||||
// when the user quits.
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called as part of the transition from background to active state.
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called when the application is about to terminate. Save data, if needed.
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
|
|
|
@ -9,12 +9,9 @@ using OpenTK;
|
|||
using Metal;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMetalGame
|
||||
{
|
||||
public partial class GameViewController : UIViewController
|
||||
{
|
||||
struct Uniforms
|
||||
{
|
||||
namespace MyMetalGame {
|
||||
public partial class GameViewController : UIViewController {
|
||||
struct Uniforms {
|
||||
public Matrix4 ModelviewProjectionMatrix;
|
||||
public Matrix4 NormalMatrix;
|
||||
}
|
||||
|
@ -25,7 +22,7 @@ namespace MyMetalGame
|
|||
// Max API memory buffer size
|
||||
const int max_bytes_per_frame = 1024 * 1024;
|
||||
|
||||
float[] cubeVertexData = {
|
||||
float [] cubeVertexData = {
|
||||
// Data layout for each line below is:
|
||||
// positionX, positionY, positionZ, normalX, normalY, normalZ,
|
||||
0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,
|
||||
|
@ -165,7 +162,7 @@ namespace MyMetalGame
|
|||
IMTLFunction vertexProgram = defaultLibrary.CreateFunction ("lighting_vertex");
|
||||
|
||||
// Setup the vertex buffers
|
||||
vertexBuffer = device.CreateBuffer<float> (cubeVertexData, (MTLResourceOptions)0);
|
||||
vertexBuffer = device.CreateBuffer<float> (cubeVertexData, (MTLResourceOptions) 0);
|
||||
vertexBuffer.Label = "Vertices";
|
||||
|
||||
// Create a reusable pipeline state
|
||||
|
@ -190,7 +187,7 @@ namespace MyMetalGame
|
|||
DepthCompareFunction = MTLCompareFunction.Less,
|
||||
DepthWriteEnabled = true
|
||||
};
|
||||
|
||||
|
||||
depthState = device.CreateDepthStencilState (depthStateDesc);
|
||||
}
|
||||
|
||||
|
@ -244,7 +241,7 @@ namespace MyMetalGame
|
|||
renderEncoder.PushDebugGroup ("DrawCube");
|
||||
renderEncoder.SetRenderPipelineState (pipelineState);
|
||||
renderEncoder.SetVertexBuffer (vertexBuffer, 0, 0);
|
||||
renderEncoder.SetVertexBuffer (dynamicConstantBuffer, (nuint)(Marshal.SizeOf (typeof(Uniforms)) * constantDataBufferIndex), 1);
|
||||
renderEncoder.SetVertexBuffer (dynamicConstantBuffer, (nuint) (Marshal.SizeOf (typeof (Uniforms)) * constantDataBufferIndex), 1);
|
||||
|
||||
// Tell the render context we want to draw our primitives
|
||||
renderEncoder.DrawPrimitives (MTLPrimitiveType.Triangle, 0, 36, 1);
|
||||
|
@ -258,7 +255,7 @@ namespace MyMetalGame
|
|||
drawable.Dispose ();
|
||||
inflightSemaphore.Release ();
|
||||
});
|
||||
|
||||
|
||||
// Schedule a present once the framebuffer is complete
|
||||
commandBuffer.PresentDrawable (drawable);
|
||||
|
||||
|
@ -266,14 +263,14 @@ namespace MyMetalGame
|
|||
commandBuffer.Commit ();
|
||||
|
||||
// The renderview assumes it can now increment the buffer index and that the previous index won't be touched until we cycle back around to the same index
|
||||
constantDataBufferIndex = (byte)((constantDataBufferIndex + 1) % max_inflight_buffers);
|
||||
constantDataBufferIndex = (byte) ((constantDataBufferIndex + 1) % max_inflight_buffers);
|
||||
}
|
||||
|
||||
void Reshape ()
|
||||
{
|
||||
// When reshape is called, update the view and projection matricies since this means the view orientation or size changed
|
||||
var aspect = (float)(View.Bounds.Size.Width / View.Bounds.Size.Height);
|
||||
projectionMatrix = CreateMatrixFromPerspective (65.0f * ((float)Math.PI / 180.0f), aspect, 0.1f, 100.0f);
|
||||
var aspect = (float) (View.Bounds.Size.Width / View.Bounds.Size.Height);
|
||||
projectionMatrix = CreateMatrixFromPerspective (65.0f * ((float) Math.PI / 180.0f), aspect, 0.1f, 100.0f);
|
||||
|
||||
viewMatrix = Matrix4.Identity;
|
||||
}
|
||||
|
@ -288,8 +285,8 @@ namespace MyMetalGame
|
|||
uniformBuffer.ModelviewProjectionMatrix = Matrix4.Transpose (Matrix4.Mult (projectionMatrix, modelViewMatrix));
|
||||
|
||||
// Copy uniformBuffer's content into dynamicConstantBuffer.Contents
|
||||
int rawsize = Marshal.SizeOf (typeof(Uniforms));
|
||||
var rawdata = new byte[rawsize];
|
||||
int rawsize = Marshal.SizeOf (typeof (Uniforms));
|
||||
var rawdata = new byte [rawsize];
|
||||
IntPtr ptr = Marshal.AllocHGlobal (rawsize);
|
||||
Marshal.StructureToPtr (uniformBuffer, ptr, false);
|
||||
Marshal.Copy (ptr, rawdata, 0, rawsize);
|
||||
|
@ -352,7 +349,7 @@ namespace MyMetalGame
|
|||
|
||||
static Matrix4 CreateMatrixFromPerspective (float fovY, float aspect, float nearZ, float farZ)
|
||||
{
|
||||
float yscale = 1.0f / (float)Math.Tan (fovY * 0.5f);
|
||||
float yscale = 1.0f / (float) Math.Tan (fovY * 0.5f);
|
||||
float xscale = yscale / aspect;
|
||||
float q = farZ / (farZ - nearZ);
|
||||
|
||||
|
@ -379,8 +376,8 @@ namespace MyMetalGame
|
|||
static Matrix4 CreateMatrixFromRotation (float radians, float x, float y, float z)
|
||||
{
|
||||
Vector3 v = Vector3.Normalize (new Vector3 (x, y, z));
|
||||
var cos = (float)Math.Cos (radians);
|
||||
var sin = (float)Math.Sin (radians);
|
||||
var cos = (float) Math.Cos (radians);
|
||||
var sin = (float) Math.Sin (radians);
|
||||
float cosp = 1.0f - cos;
|
||||
|
||||
var m = new Matrix4 {
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyMetalGame
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyMetalGame {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -5,39 +5,37 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyOpenGLApp
|
||||
{
|
||||
namespace MyOpenGLApp {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
// This method is invoked when the application is about to move from active to inactive state.
|
||||
// OpenGL applications should use this method to pause.
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method should be used to release shared resources and it should store the application state.
|
||||
// If your application supports background execution this method is called instead of WillTerminate
|
||||
// when the user quits.
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called as part of the transition from background to active state.
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called when the application is about to terminate. Save data, if needed.
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
|
|
|
@ -12,11 +12,9 @@ using ObjCRuntime;
|
|||
using OpenGLES;
|
||||
using UIKit;
|
||||
|
||||
namespace MyOpenGLApp
|
||||
{
|
||||
namespace MyOpenGLApp {
|
||||
[Register ("EAGLView")]
|
||||
public class EAGLView : iPhoneOSGameView
|
||||
{
|
||||
public class EAGLView : iPhoneOSGameView {
|
||||
[Export ("initWithCoder:")]
|
||||
public EAGLView (NSCoder coder) : base (coder)
|
||||
{
|
||||
|
@ -44,7 +42,7 @@ namespace MyOpenGLApp
|
|||
ContextRenderingApi = EAGLRenderingAPI.OpenGLES1;
|
||||
base.CreateFrameBuffer ();
|
||||
}
|
||||
|
||||
|
||||
if (ContextRenderingApi == EAGLRenderingAPI.OpenGLES2)
|
||||
LoadShaders ();
|
||||
}
|
||||
|
@ -61,7 +59,7 @@ namespace MyOpenGLApp
|
|||
CADisplayLink displayLink;
|
||||
|
||||
public bool IsAnimating { get; private set; }
|
||||
|
||||
|
||||
// How many display frames must pass between each time the display link fires.
|
||||
public int FrameInterval {
|
||||
get {
|
||||
|
@ -82,12 +80,12 @@ namespace MyOpenGLApp
|
|||
{
|
||||
if (IsAnimating)
|
||||
return;
|
||||
|
||||
|
||||
CreateFrameBuffer ();
|
||||
displayLink = UIScreen.MainScreen.CreateDisplayLink (this, new Selector ("drawFrame"));
|
||||
displayLink.FrameInterval = frameInterval;
|
||||
displayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode);
|
||||
|
||||
|
||||
IsAnimating = true;
|
||||
}
|
||||
|
||||
|
@ -110,57 +108,57 @@ namespace MyOpenGLApp
|
|||
|
||||
#endregion
|
||||
|
||||
static readonly float[] squareVertices = {
|
||||
static readonly float [] squareVertices = {
|
||||
-0.5f, -0.33f,
|
||||
0.5f, -0.33f,
|
||||
-0.5f, 0.33f,
|
||||
0.5f, 0.33f,
|
||||
};
|
||||
|
||||
static readonly byte[] squareColors = {
|
||||
|
||||
static readonly byte [] squareColors = {
|
||||
255, 255, 0, 255,
|
||||
0, 255, 255, 255,
|
||||
0, 0, 0, 0,
|
||||
255, 0, 255, 255,
|
||||
};
|
||||
|
||||
|
||||
static float transY = 0.0f;
|
||||
|
||||
|
||||
const int UNIFORM_TRANSLATE = 0;
|
||||
const int UNIFORM_COUNT = 1;
|
||||
|
||||
readonly int[] uniforms = new int [UNIFORM_COUNT];
|
||||
|
||||
|
||||
readonly int [] uniforms = new int [UNIFORM_COUNT];
|
||||
|
||||
const int ATTRIB_VERTEX = 0;
|
||||
const int ATTRIB_COLOR = 1;
|
||||
const int ATTRIB_COUNT = 2;
|
||||
|
||||
|
||||
int program;
|
||||
|
||||
protected override void OnRenderFrame (FrameEventArgs e)
|
||||
{
|
||||
base.OnRenderFrame (e);
|
||||
|
||||
|
||||
MakeCurrent ();
|
||||
|
||||
|
||||
// Replace the implementation of this method to do your own custom drawing.
|
||||
GL.ClearColor (0.5f, 0.5f, 0.5f, 1.0f);
|
||||
GL.Clear (ClearBufferMask.ColorBufferBit);
|
||||
|
||||
|
||||
if (ContextRenderingApi == EAGLRenderingAPI.OpenGLES2) {
|
||||
// Use shader program.
|
||||
GL.UseProgram (program);
|
||||
|
||||
|
||||
// Update uniform value.
|
||||
GL.Uniform1 (uniforms [UNIFORM_TRANSLATE], transY);
|
||||
transY += 0.075f;
|
||||
|
||||
|
||||
// Update attribute values.
|
||||
GL.VertexAttribPointer (ATTRIB_VERTEX, 2, VertexAttribPointerType.Float, false, 0, squareVertices);
|
||||
GL.EnableVertexAttribArray (ATTRIB_VERTEX);
|
||||
GL.VertexAttribPointer (ATTRIB_COLOR, 4, VertexAttribPointerType.UnsignedByte, true, 0, squareColors);
|
||||
GL.EnableVertexAttribArray (ATTRIB_COLOR);
|
||||
|
||||
|
||||
// Validate program before drawing. This is a good check, but only really necessary in a debug build.
|
||||
#if DEBUG
|
||||
if (!ValidateProgram (program)) {
|
||||
|
@ -173,9 +171,9 @@ namespace MyOpenGLApp
|
|||
GL1.LoadIdentity ();
|
||||
GL1.MatrixMode (All1.Modelview);
|
||||
GL1.LoadIdentity ();
|
||||
GL1.Translate (0.0f, (float)Math.Sin (transY) / 2.0f, 0.0f);
|
||||
GL1.Translate (0.0f, (float) Math.Sin (transY) / 2.0f, 0.0f);
|
||||
transY += 0.075f;
|
||||
|
||||
|
||||
GL1.VertexPointer (2, All1.Float, 0, squareVertices);
|
||||
GL1.EnableClientState (All1.VertexArray);
|
||||
GL1.ColorPointer (4, All1.UnsignedByte, 0, squareColors);
|
||||
|
@ -183,24 +181,24 @@ namespace MyOpenGLApp
|
|||
}
|
||||
|
||||
GL.DrawArrays (BeginMode.TriangleStrip, 0, 4);
|
||||
|
||||
|
||||
SwapBuffers ();
|
||||
}
|
||||
|
||||
bool LoadShaders ()
|
||||
{
|
||||
int vertShader, fragShader;
|
||||
|
||||
|
||||
// Create shader program.
|
||||
program = GL.CreateProgram ();
|
||||
|
||||
|
||||
// Create and compile vertex shader.
|
||||
var vertShaderPathname = NSBundle.MainBundle.PathForResource ("Shader", "vsh");
|
||||
if (!CompileShader (ShaderType.VertexShader, vertShaderPathname, out vertShader)) {
|
||||
Console.WriteLine ("Failed to compile vertex shader");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Create and compile fragment shader.
|
||||
var fragShaderPathname = NSBundle.MainBundle.PathForResource ("Shader", "fsh");
|
||||
if (!CompileShader (ShaderType.FragmentShader, fragShaderPathname, out fragShader)) {
|
||||
|
@ -210,25 +208,25 @@ namespace MyOpenGLApp
|
|||
|
||||
// Attach vertex shader to program.
|
||||
GL.AttachShader (program, vertShader);
|
||||
|
||||
|
||||
// Attach fragment shader to program.
|
||||
GL.AttachShader (program, fragShader);
|
||||
|
||||
|
||||
// Bind attribute locations.
|
||||
// This needs to be done prior to linking.
|
||||
GL.BindAttribLocation (program, ATTRIB_VERTEX, "position");
|
||||
GL.BindAttribLocation (program, ATTRIB_COLOR, "color");
|
||||
|
||||
|
||||
// Link program.
|
||||
if (!LinkProgram (program)) {
|
||||
Console.WriteLine ("Failed to link program: {0:x}", program);
|
||||
|
||||
|
||||
if (vertShader != 0)
|
||||
GL.DeleteShader (vertShader);
|
||||
|
||||
|
||||
if (fragShader != 0)
|
||||
GL.DeleteShader (fragShader);
|
||||
|
||||
|
||||
if (program != 0) {
|
||||
GL.DeleteProgram (program);
|
||||
program = 0;
|
||||
|
@ -236,21 +234,21 @@ namespace MyOpenGLApp
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Get uniform locations.
|
||||
uniforms [UNIFORM_TRANSLATE] = GL.GetUniformLocation (program, "translate");
|
||||
|
||||
|
||||
// Release vertex and fragment shaders.
|
||||
if (vertShader != 0) {
|
||||
GL.DetachShader (program, vertShader);
|
||||
GL.DeleteShader (vertShader);
|
||||
}
|
||||
|
||||
|
||||
if (fragShader != 0) {
|
||||
GL.DetachShader (program, fragShader);
|
||||
GL.DeleteShader (fragShader);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -269,9 +267,9 @@ namespace MyOpenGLApp
|
|||
string src = System.IO.File.ReadAllText (file);
|
||||
|
||||
shader = GL.CreateShader (type);
|
||||
GL.ShaderSource (shader, 1, new string[] { src }, (int[])null);
|
||||
GL.ShaderSource (shader, 1, new string [] { src }, (int []) null);
|
||||
GL.CompileShader (shader);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
int logLength;
|
||||
GL.GetShader (shader, ShaderParameter.InfoLogLength, out logLength);
|
||||
|
@ -287,14 +285,14 @@ namespace MyOpenGLApp
|
|||
GL.DeleteShader (shader);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool LinkProgram (int program)
|
||||
{
|
||||
GL.LinkProgram (program);
|
||||
|
||||
|
||||
#if DEBUG
|
||||
int logLength;
|
||||
GL.GetProgram (program, ProgramParameter.InfoLogLength, out logLength);
|
||||
|
@ -308,14 +306,14 @@ namespace MyOpenGLApp
|
|||
GL.GetProgram (program, ProgramParameter.LinkStatus, out status);
|
||||
if (status == 0)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ValidateProgram (int program)
|
||||
{
|
||||
GL.ValidateProgram (program);
|
||||
|
||||
|
||||
int logLength;
|
||||
GL.GetProgram (program, ProgramParameter.InfoLogLength, out logLength);
|
||||
if (logLength > 0) {
|
||||
|
@ -323,12 +321,12 @@ namespace MyOpenGLApp
|
|||
GL.GetProgramInfoLog (program, logLength, out logLength, infoLog);
|
||||
Console.WriteLine ("Program validate log:\n{0}", infoLog);
|
||||
}
|
||||
|
||||
|
||||
int status;
|
||||
GL.GetProgram (program, ProgramParameter.LinkStatus, out status);
|
||||
if (status == 0)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyOpenGLApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyOpenGLApp {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -11,21 +11,19 @@ using OpenGLES;
|
|||
using GLKit;
|
||||
using UIKit;
|
||||
|
||||
namespace MyOpenGLApp
|
||||
{
|
||||
namespace MyOpenGLApp {
|
||||
[Register ("OpenGLViewController")]
|
||||
public partial class OpenGLViewController : UIViewController
|
||||
{
|
||||
public partial class OpenGLViewController : UIViewController {
|
||||
public OpenGLViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
||||
new EAGLView View { get { return (EAGLView)base.View; } }
|
||||
new EAGLView View { get { return (EAGLView) base.View; } }
|
||||
|
||||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
NSNotificationCenter.DefaultCenter.AddObserver (UIApplication.WillResignActiveNotification, a => {
|
||||
if (IsViewLoaded && View.Window != null)
|
||||
View.StopAnimating ();
|
||||
|
@ -43,7 +41,7 @@ namespace MyOpenGLApp
|
|||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
base.Dispose (disposing);
|
||||
|
||||
|
||||
NSNotificationCenter.DefaultCenter.RemoveObserver (this);
|
||||
}
|
||||
|
||||
|
@ -51,7 +49,7 @@ namespace MyOpenGLApp
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ using PhotosUI;
|
|||
using Photos;
|
||||
using UIKit;
|
||||
|
||||
namespace MyPhotoEditingExtension
|
||||
{
|
||||
public partial class PhotoEditingViewController : UIViewController, IPHContentEditingController
|
||||
{
|
||||
namespace MyPhotoEditingExtension {
|
||||
public partial class PhotoEditingViewController : UIViewController, IPHContentEditingController {
|
||||
PHContentEditingInput input;
|
||||
|
||||
public PhotoEditingViewController (IntPtr handle) : base (handle)
|
||||
|
|
|
@ -26,13 +26,11 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyReleaseBuild
|
||||
{
|
||||
namespace MyReleaseBuild {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -25,12 +25,10 @@
|
|||
//
|
||||
using UIKit;
|
||||
|
||||
namespace MyReleaseBuild
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyReleaseBuild {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -27,10 +27,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace MyReleaseBuild
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace MyReleaseBuild {
|
||||
public partial class ViewController : UIViewController {
|
||||
protected ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -3,8 +3,7 @@ using UIKit;
|
|||
|
||||
namespace MySceneKitApp {
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
UIWindow window;
|
||||
UIViewController dvc;
|
||||
|
||||
|
@ -20,7 +19,7 @@ namespace MySceneKitApp {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void Main (string [] args)
|
||||
{
|
||||
UIApplication.Main (args, null, typeof (AppDelegate));
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
namespace MySceneKitLibrary
|
||||
{
|
||||
public class MyClass
|
||||
{
|
||||
public MyClass()
|
||||
{
|
||||
}
|
||||
}
|
||||
namespace MySceneKitLibrary {
|
||||
public class MyClass {
|
||||
public MyClass ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@ using Foundation;
|
|||
using Social;
|
||||
using UIKit;
|
||||
|
||||
namespace MyShareExtension
|
||||
{
|
||||
public partial class ShareViewController : SLComposeServiceViewController
|
||||
{
|
||||
namespace MyShareExtension {
|
||||
public partial class ShareViewController : SLComposeServiceViewController {
|
||||
public ShareViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -42,10 +40,10 @@ namespace MyShareExtension
|
|||
ExtensionContext.CompleteRequest (null, null);
|
||||
}
|
||||
|
||||
public override SLComposeSheetConfigurationItem[] GetConfigurationItems ()
|
||||
public override SLComposeSheetConfigurationItem [] GetConfigurationItems ()
|
||||
{
|
||||
// To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
|
||||
return new SLComposeSheetConfigurationItem[0];
|
||||
return new SLComposeSheetConfigurationItem [0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
namespace MySingleView {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
|
|
|
@ -5,12 +5,10 @@ using Foundation;
|
|||
using UIKit;
|
||||
using MyLibrary;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MySingleView {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
new TestFoo ();
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
|
||||
namespace MyLibrary
|
||||
{
|
||||
public class TestFoo
|
||||
{
|
||||
namespace MyLibrary {
|
||||
public class TestFoo {
|
||||
public TestFoo ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ using CoreGraphics;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public partial class MySingleViewViewController : UIViewController
|
||||
{
|
||||
namespace MySingleView {
|
||||
public partial class MySingleViewViewController : UIViewController {
|
||||
public MySingleViewViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -15,7 +13,7 @@ namespace MySingleView
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -24,7 +22,7 @@ namespace MySingleView
|
|||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
|
|
|
@ -3,14 +3,12 @@ using System;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpriteKitGame
|
||||
{
|
||||
namespace MySpriteKitGame {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpriteKitGame
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MySpriteKitGame {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -5,10 +5,8 @@ using Foundation;
|
|||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpriteKitGame
|
||||
{
|
||||
public class MyScene : SKScene
|
||||
{
|
||||
namespace MySpriteKitGame {
|
||||
public class MyScene : SKScene {
|
||||
public MyScene (CGSize size) : base (size)
|
||||
{
|
||||
// Setup your scene here
|
||||
|
@ -27,7 +25,7 @@ namespace MySpriteKitGame
|
|||
{
|
||||
// Called when a touch begins
|
||||
foreach (var touch in touches) {
|
||||
var location = ((UITouch)touch).LocationInNode (this);
|
||||
var location = ((UITouch) touch).LocationInNode (this);
|
||||
|
||||
var sprite = new SKSpriteNode ("Spaceship") {
|
||||
Position = location,
|
||||
|
@ -35,7 +33,7 @@ namespace MySpriteKitGame
|
|||
YScale = 0.4f
|
||||
};
|
||||
|
||||
var action = SKAction.RotateByAngle ((float)Math.PI, 1.0);
|
||||
var action = SKAction.RotateByAngle ((float) Math.PI, 1.0);
|
||||
|
||||
sprite.RunAction (SKAction.RepeatActionForever (action));
|
||||
|
||||
|
|
|
@ -3,10 +3,8 @@ using System;
|
|||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace MySpriteKitGame
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace MySpriteKitGame {
|
||||
public partial class ViewController : UIViewController {
|
||||
public ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
@ -24,7 +22,7 @@ namespace MySpriteKitGame
|
|||
base.ViewDidLoad ();
|
||||
|
||||
// Configure the view.
|
||||
var skView = (SKView)View;
|
||||
var skView = (SKView) View;
|
||||
skView.ShowsFPS = true;
|
||||
skView.ShowsNodeCount = true;
|
||||
|
||||
|
|
|
@ -4,14 +4,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
namespace MySingleView {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
|
|
|
@ -4,12 +4,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MySingleView {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -2,10 +2,8 @@ using System;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MySingleView
|
||||
{
|
||||
public partial class MySingleViewViewController : UIViewController
|
||||
{
|
||||
namespace MySingleView {
|
||||
public partial class MySingleViewViewController : UIViewController {
|
||||
public MySingleViewViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace MyTVMetalGame {
|
|||
IMTLFunction vertexProgram = defaultLibrary.CreateFunction ("lighting_vertex");
|
||||
|
||||
// Setup the vertex buffers
|
||||
vertexBuffer = device.CreateBuffer<float> (cubeVertexData, (MTLResourceOptions)0);
|
||||
vertexBuffer = device.CreateBuffer<float> (cubeVertexData, (MTLResourceOptions) 0);
|
||||
vertexBuffer.Label = "Vertices";
|
||||
|
||||
// Create a reusable pipeline state
|
||||
|
@ -253,7 +253,7 @@ namespace MyTVMetalGame {
|
|||
renderEncoder.PushDebugGroup ("DrawCube");
|
||||
renderEncoder.SetRenderPipelineState (pipelineState);
|
||||
renderEncoder.SetVertexBuffer (vertexBuffer, 0, 0);
|
||||
renderEncoder.SetVertexBuffer (dynamicConstantBuffer, (nuint)(Marshal.SizeOf (typeof (Uniforms)) * constantDataBufferIndex), 1);
|
||||
renderEncoder.SetVertexBuffer (dynamicConstantBuffer, (nuint) (Marshal.SizeOf (typeof (Uniforms)) * constantDataBufferIndex), 1);
|
||||
|
||||
// Tell the render context we want to draw our primitives
|
||||
renderEncoder.DrawPrimitives (MTLPrimitiveType.Triangle, 0, 36, 1);
|
||||
|
@ -275,14 +275,14 @@ namespace MyTVMetalGame {
|
|||
commandBuffer.Commit ();
|
||||
|
||||
// The renderview assumes it can now increment the buffer index and that the previous index won't be touched until we cycle back around to the same index
|
||||
constantDataBufferIndex = (byte)((constantDataBufferIndex + 1) % max_inflight_buffers);
|
||||
constantDataBufferIndex = (byte) ((constantDataBufferIndex + 1) % max_inflight_buffers);
|
||||
}
|
||||
|
||||
void Reshape ()
|
||||
{
|
||||
// When reshape is called, update the view and projection matricies since this means the view orientation or size changed
|
||||
var aspect = (float)(View.Bounds.Size.Width / View.Bounds.Size.Height);
|
||||
projectionMatrix = CreateMatrixFromPerspective (65.0f * ((float)Math.PI / 180.0f), aspect, 0.1f, 100.0f);
|
||||
var aspect = (float) (View.Bounds.Size.Width / View.Bounds.Size.Height);
|
||||
projectionMatrix = CreateMatrixFromPerspective (65.0f * ((float) Math.PI / 180.0f), aspect, 0.1f, 100.0f);
|
||||
|
||||
viewMatrix = Matrix4.Identity;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ namespace MyTVMetalGame {
|
|||
|
||||
static Matrix4 CreateMatrixFromPerspective (float fovY, float aspect, float nearZ, float farZ)
|
||||
{
|
||||
float yscale = 1.0f / (float)Math.Tan (fovY * 0.5f);
|
||||
float yscale = 1.0f / (float) Math.Tan (fovY * 0.5f);
|
||||
float xscale = yscale / aspect;
|
||||
float q = farZ / (farZ - nearZ);
|
||||
|
||||
|
@ -367,8 +367,8 @@ namespace MyTVMetalGame {
|
|||
static Matrix4 CreateMatrixFromRotation (float radians, float x, float y, float z)
|
||||
{
|
||||
Vector3 v = Vector3.Normalize (new Vector3 (x, y, z));
|
||||
var cos = (float)Math.Cos (radians);
|
||||
var sin = (float)Math.Sin (radians);
|
||||
var cos = (float) Math.Cos (radians);
|
||||
var sin = (float) Math.Sin (radians);
|
||||
float cosp = 1.0f - cos;
|
||||
|
||||
var m = new Matrix4 (
|
||||
|
|
|
@ -2,11 +2,9 @@ using System;
|
|||
using Foundation;
|
||||
using TVServices;
|
||||
|
||||
namespace MyTVServicesExtension
|
||||
{
|
||||
namespace MyTVServicesExtension {
|
||||
[Register ("ServiceProvider")]
|
||||
public class ServiceProvider : NSObject, ITVTopShelfProvider
|
||||
{
|
||||
public class ServiceProvider : NSObject, ITVTopShelfProvider {
|
||||
protected ServiceProvider (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
|
|
@ -5,39 +5,37 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTabbedApplication
|
||||
{
|
||||
namespace MyTabbedApplication {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
// This method is invoked when the application is about to move from active to inactive state.
|
||||
// OpenGL applications should use this method to pause.
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method should be used to release shared resources and it should store the application state.
|
||||
// If your application supports background execution this method is called instead of WillTerminate
|
||||
// when the user quits.
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called as part of the transition from background to active state.
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// This method is called when the application is about to terminate. Save data, if needed.
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
|
|
|
@ -4,10 +4,8 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTabbedApplication
|
||||
{
|
||||
public partial class FirstViewController : UIViewController
|
||||
{
|
||||
namespace MyTabbedApplication {
|
||||
public partial class FirstViewController : UIViewController {
|
||||
static bool UserInterfaceIdiomIsPhone {
|
||||
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
|
||||
}
|
||||
|
@ -22,7 +20,7 @@ namespace MyTabbedApplication
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -31,7 +29,7 @@ namespace MyTabbedApplication
|
|||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTabbedApplication
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyTabbedApplication {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -4,10 +4,8 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTabbedApplication
|
||||
{
|
||||
public partial class SecondViewController : UIViewController
|
||||
{
|
||||
namespace MyTabbedApplication {
|
||||
public partial class SecondViewController : UIViewController {
|
||||
static bool UserInterfaceIdiomIsPhone {
|
||||
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
|
||||
}
|
||||
|
@ -22,7 +20,7 @@ namespace MyTabbedApplication
|
|||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
|
@ -31,7 +29,7 @@ namespace MyTabbedApplication
|
|||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ using Foundation;
|
|||
using Social;
|
||||
using UIKit;
|
||||
|
||||
namespace MyTodayExtension
|
||||
{
|
||||
public partial class TodayViewController : UIViewController, INCWidgetProviding
|
||||
{
|
||||
namespace MyTodayExtension {
|
||||
public partial class TodayViewController : UIViewController, INCWidgetProviding {
|
||||
public TodayViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWatch2Container
|
||||
{
|
||||
namespace MyWatch2Container {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
|
||||
public override UIWindow Window {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using UIKit;
|
||||
|
||||
namespace MyWatch2Container
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyWatch2Container {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -2,10 +2,8 @@ using System;
|
|||
|
||||
using UIKit;
|
||||
|
||||
namespace MyWatch2Container
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
namespace MyWatch2Container {
|
||||
public partial class ViewController : UIViewController {
|
||||
public ViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,19 +5,17 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWatchApp
|
||||
{
|
||||
namespace MyWatchApp {
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
UIWindow window;
|
||||
|
||||
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
|
||||
{
|
||||
window = new UIWindow (UIScreen.MainScreen.Bounds);
|
||||
|
||||
|
||||
window.MakeKeyAndVisible ();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,9 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWatchApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
static void Main (string[] args)
|
||||
namespace MyWatchApp {
|
||||
public class Application {
|
||||
static void Main (string [] args)
|
||||
{
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ using System;
|
|||
using WatchKit;
|
||||
using Foundation;
|
||||
|
||||
namespace monotouchtestWatchKitExtension
|
||||
{
|
||||
public partial class InterfaceController : WKInterfaceController
|
||||
{
|
||||
namespace monotouchtestWatchKitExtension {
|
||||
public partial class InterfaceController : WKInterfaceController {
|
||||
public InterfaceController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using Intents;
|
||||
|
||||
namespace MyWatchKit2IntentsExtension
|
||||
{
|
||||
namespace MyWatchKit2IntentsExtension {
|
||||
// As an example, this class is set up to handle Message intents.
|
||||
// You will want to replace this or add other intents as appropriate.
|
||||
// The intents you wish to handle must be declared in the extension's Info.plist.
|
||||
|
@ -15,8 +14,7 @@ namespace MyWatchKit2IntentsExtension
|
|||
// "<myApp> John saying hello"
|
||||
// "Search for messages in <myApp>"
|
||||
[Register ("IntentHandler")]
|
||||
public class IntentHandler : INExtension, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling
|
||||
{
|
||||
public class IntentHandler : INExtension, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling {
|
||||
protected IntentHandler (IntPtr handle) : base (handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
|
@ -32,19 +30,19 @@ namespace MyWatchKit2IntentsExtension
|
|||
|
||||
// Implement resolution methods to provide additional information about your intent (optional).
|
||||
[Export ("resolveRecipientsForSearchForMessages:withCompletion:")]
|
||||
public void ResolveRecipients (INSearchForMessagesIntent intent, Action<INPersonResolutionResult[]> completion)
|
||||
public void ResolveRecipients (INSearchForMessagesIntent intent, Action<INPersonResolutionResult []> completion)
|
||||
{
|
||||
var recipients = intent.Recipients;
|
||||
// If no recipients were provided we'll need to prompt for a value.
|
||||
if (recipients.Length == 0) {
|
||||
completion (new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue });
|
||||
completion (new INPersonResolutionResult [] { INPersonResolutionResult.NeedsValue });
|
||||
return;
|
||||
}
|
||||
|
||||
var resolutionResults = new List<INPersonResolutionResult> ();
|
||||
|
||||
foreach (var recipient in recipients) {
|
||||
var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts
|
||||
var matchingContacts = new INPerson [] { recipient }; // Implement your contact matching logic here to create an array of matching contacts
|
||||
if (matchingContacts.Length > 1) {
|
||||
// We need Siri's help to ask user to pick one from the matches.
|
||||
resolutionResults.Add (INPersonResolutionResult.GetDisambiguation (matchingContacts));
|
||||
|
@ -104,8 +102,8 @@ namespace MyWatchKit2IntentsExtension
|
|||
// Initialize with found message's attributes
|
||||
var sender = new INPerson (new INPersonHandle ("sarah@example.com", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null);
|
||||
var recipient = new INPerson (new INPersonHandle ("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null);
|
||||
var message = new INMessage ("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient });
|
||||
response.Messages = new INMessage[] { message };
|
||||
var message = new INMessage ("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson [] { recipient });
|
||||
response.Messages = new INMessage [] { message };
|
||||
completion (response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ using System;
|
|||
using WatchKit;
|
||||
using Foundation;
|
||||
|
||||
namespace WatchExtension
|
||||
{
|
||||
public partial class GlanceController : WKInterfaceController
|
||||
{
|
||||
namespace WatchExtension {
|
||||
public partial class GlanceController : WKInterfaceController {
|
||||
public GlanceController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ using System;
|
|||
using WatchKit;
|
||||
using Foundation;
|
||||
|
||||
namespace WatchExtension
|
||||
{
|
||||
public partial class InterfaceController : WKInterfaceController
|
||||
{
|
||||
namespace WatchExtension {
|
||||
public partial class InterfaceController : WKInterfaceController {
|
||||
public InterfaceController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ using System;
|
|||
using WatchKit;
|
||||
using Foundation;
|
||||
|
||||
namespace WatchExtension
|
||||
{
|
||||
public partial class NotificationController : WKUserNotificationInterfaceController
|
||||
{
|
||||
namespace WatchExtension {
|
||||
public partial class NotificationController : WKUserNotificationInterfaceController {
|
||||
public NotificationController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,14 +5,12 @@ using System.Collections.Generic;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWebViewApp
|
||||
{
|
||||
namespace MyWebViewApp {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : UIApplicationDelegate {
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
|
|
|
@ -4,10 +4,8 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWebViewApp
|
||||
{
|
||||
public partial class HybridViewController : UIViewController
|
||||
{
|
||||
namespace MyWebViewApp {
|
||||
public partial class HybridViewController : UIViewController {
|
||||
static bool UserInterfaceIdiomIsPhone {
|
||||
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
|
||||
}
|
||||
|
|
|
@ -5,12 +5,10 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyWebViewApp
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyWebViewApp {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
static void Main (string [] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
|
||||
namespace MyWebViewApp
|
||||
{
|
||||
public class Model1
|
||||
{
|
||||
namespace MyWebViewApp {
|
||||
public class Model1 {
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,14 +5,12 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyXamarinFormsApp.iOS
|
||||
{
|
||||
namespace MyXamarinFormsApp.iOS {
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
|
||||
{
|
||||
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate {
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
|
|
|
@ -5,10 +5,8 @@ using System.Linq;
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace MyXamarinFormsApp.iOS
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
namespace MyXamarinFormsApp.iOS {
|
||||
public class Application {
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string [] args)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,8 @@ using System;
|
|||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace MyXamarinFormsApp
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
namespace MyXamarinFormsApp {
|
||||
public partial class App : Application {
|
||||
public App ()
|
||||
{
|
||||
InitializeComponent ();
|
||||
|
|
|
@ -6,13 +6,11 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace MyXamarinFormsApp
|
||||
{
|
||||
namespace MyXamarinFormsApp {
|
||||
// Learn more about making custom code visible in the Xamarin.Forms previewer
|
||||
// by visiting https://aka.ms/xamarinforms-previewer
|
||||
[DesignTimeVisible (false)]
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public partial class MainPage : ContentPage {
|
||||
public MainPage ()
|
||||
{
|
||||
InitializeComponent ();
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче