-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
704ae58
commit a79eb1c
Showing
107 changed files
with
3,065 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo11", "Todo11\Todo11.csproj", "{08A1E777-C427-42A1-9DB4-F7C9105E389B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo11Intent", "Todo11Intent\Todo11Intent.csproj", "{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Todo11ntentUI", "Todo11IntentUI\Todo11ntentUI.csproj", "{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|iPhoneSimulator = Debug|iPhoneSimulator | ||
Release|iPhoneSimulator = Release|iPhoneSimulator | ||
Debug|iPhone = Debug|iPhone | ||
Release|iPhone = Release|iPhone | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhone.Build.0 = Release|iPhone | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{08A1E777-C427-42A1-9DB4-F7C9105E389B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{60E28139-F7B6-4BD8-8C77-2D8A0E062BCC}.Release|iPhone.Build.0 = Release|iPhone | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{74B7D001-16ED-4DD3-B1BB-2EDD79EE2829}.Release|iPhone.Build.0 = Release|iPhone | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
using Foundation; | ||
using UIKit; | ||
using System.IO; | ||
using SQLite; | ||
using CoreSpotlight; | ||
|
||
using Intents; | ||
using UserNotifications; | ||
|
||
namespace To11oApp | ||
{ | ||
// 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 override UIWindow Window { | ||
get; | ||
set; | ||
} | ||
|
||
public static INSiriAuthorizationStatus SiriAuthorizationStatus { get; set; } | ||
|
||
#region Database set-up | ||
public static AppDelegate Current { get; private set; } | ||
public TodoManager TodoMgr { get; set; } | ||
SQLite.SQLiteConnection conn; | ||
#endregion | ||
|
||
|
||
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) | ||
{ | ||
Current = this; | ||
|
||
|
||
|
||
#region Database set-up | ||
var sqliteFilename = "TodoDB.db3"; | ||
// we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms | ||
// (they don't want non-user-generated data in Documents) | ||
string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder | ||
string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder | ||
var path = Path.Combine(libraryPath, sqliteFilename); | ||
conn = new SQLite.SQLiteConnection(path); | ||
TodoMgr = new TodoManager(conn); | ||
#endregion | ||
|
||
#region Theme | ||
UINavigationBar.Appearance.TintColor = UIColor.FromRGB (0x61, 0x4C, 0xA0); // 614CA0 dark-purple | ||
UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB (0xCE, 0xC0, 0xEC); // CEC0EC light-purple | ||
|
||
UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { | ||
TextColor = UIColor.FromRGB (0x61, 0x4C, 0xA0), // 614CA0 dark-purple | ||
TextShadowColor = UIColor.Clear | ||
}); | ||
#endregion | ||
|
||
Console.WriteLine ("bbbbbbbbbb FinishedLaunching"); | ||
|
||
#region Quick Action | ||
var shouldPerformAdditionalDelegateHandling = true; | ||
|
||
// Get possible shortcut item | ||
if (launchOptions != null) { | ||
LaunchedShortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; | ||
shouldPerformAdditionalDelegateHandling = (LaunchedShortcutItem == null); | ||
} | ||
#endregion | ||
|
||
return shouldPerformAdditionalDelegateHandling; | ||
} | ||
|
||
#region Quick Action | ||
// | ||
// if app is already running (otherwise went through FinishedLaunching) | ||
public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) | ||
{ | ||
Console.WriteLine ("dddddddd PerformActionForShortcutItem"); | ||
// Perform action | ||
var handled = HandleShortcutItem(shortcutItem); | ||
completionHandler(handled); | ||
} | ||
|
||
public UIApplicationShortcutItem LaunchedShortcutItem { get; set; } | ||
public override void OnActivated (UIApplication application) | ||
{ | ||
Console.WriteLine ("ccccccc OnActivated"); | ||
|
||
// Handle any shortcut item being selected | ||
HandleShortcutItem(LaunchedShortcutItem); | ||
|
||
// Clear shortcut after it's been handled | ||
LaunchedShortcutItem = null; | ||
} | ||
|
||
|
||
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { | ||
Console.WriteLine ("eeeeeeeeeee HandleShortcutItem "); | ||
var handled = false; | ||
|
||
// Anything to process? | ||
if (shortcutItem == null) return false; | ||
|
||
// Take action based on the shortcut type | ||
switch (shortcutItem.Type) { | ||
case ShortcutIdentifiers.Add: | ||
Console.WriteLine ("QUICKACTION: Add new item"); | ||
|
||
handled = true; | ||
break; | ||
case ShortcutIdentifiers.Share: | ||
Console.WriteLine ("QUICKACTION: Share summary of items"); | ||
handled = true; | ||
break; | ||
} | ||
|
||
//HACK: show the detail viewcontroller | ||
ContinueNavigation (); | ||
|
||
Console.Write (handled); | ||
// Return results | ||
return handled; | ||
} | ||
#endregion | ||
|
||
#region NSUserActivity AND CoreSpotlight | ||
// http://www.raywenderlich.com/84174/ios-8-handoff-tutorial | ||
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) | ||
{ | ||
Console.WriteLine ("ffffffff ContinueUserActivity"); | ||
|
||
UIViewController tvc = null; | ||
|
||
// NSUserActivity | ||
if ((userActivity.ActivityType == ActivityTypes.Add) | ||
|| (userActivity.ActivityType == ActivityTypes.Detail)) | ||
{ | ||
if (userActivity.UserInfo.Count == 0) { | ||
// new item | ||
|
||
} else { | ||
var uid = userActivity.UserInfo.ObjectForKey ((NSString)"id").ToString (); | ||
if (uid == "0") { | ||
Console.WriteLine ("No userinfo found for " + ActivityTypes.Detail); | ||
} else { | ||
Console.WriteLine ("Should display id " + uid); | ||
// handled in DetailViewController.RestoreUserActivityState | ||
} | ||
} | ||
tvc = ContinueNavigation (); | ||
|
||
} | ||
// CoreSpotlight | ||
if (userActivity.ActivityType == CSSearchableItem.ActionType) { | ||
var uid = userActivity.UserInfo.ObjectForKey | ||
(CSSearchableItem.ActivityIdentifier).ToString(); | ||
|
||
System.Console.WriteLine ("Show the detail for id:" + uid); | ||
|
||
tvc = ContinueNavigation (); | ||
|
||
} | ||
completionHandler(new NSObject[] {tvc}); | ||
|
||
return true; | ||
} | ||
#endregion | ||
|
||
// | ||
// called for Quick Action AND NSUserActivity | ||
UIViewController ContinueNavigation (){ | ||
Console.WriteLine ("gggggggggg ContinueNavigation"); | ||
|
||
// 1. load screen | ||
var sb = UIStoryboard.FromName ("MainStoryboard", null); | ||
var tvc = sb.InstantiateViewController("detailvc") as DetailViewController; | ||
|
||
// 2. set initial state | ||
var r = Window.RootViewController as UINavigationController; | ||
r.PopToRootViewController (false); | ||
|
||
// 3. populate and display screen | ||
tvc.SetTodo (new TodoItem {Name="(new action)"}); // from 3D Touch menu | ||
tvc.Delegate = CollectionController.Current; | ||
r.PushViewController (tvc, false); | ||
return tvc; | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.