public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); // Get possible shortcut item if (options != null) { LaunchedShortcutItem = options[UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; } // Add dynamic shortcut items var shortcut_continue = new UIMutableApplicationShortcutItem(ShortcutIdentifier.Continue, "Continue Book") { LocalizedSubtitle = "Continue to read you'r book", Icon = UIApplicationShortcutIcon.FromType(UIApplicationShortcutIconType.Bookmark) }; var shortcut_search = new UIMutableApplicationShortcutItem(ShortcutIdentifier.Search, "Search store") { LocalizedSubtitle = "Search for a new book", Icon = UIApplicationShortcutIcon.FromType(UIApplicationShortcutIconType.Search) }; // Update the application providing the initial 'dynamic' shortcut items. app.ShortcutItems = new UIApplicationShortcutItem[] { shortcut_continue, shortcut_search }; return(base.FinishedLaunching(app, options)); }
public async Task AddShortcut(Shortcut shortcut) { if (!_isShortcutsSupported) { throw new NotSupportedOnDeviceException(NOT_SUPPORTED_ERROR_MESSAGE); } var type = shortcut.ShortcutId; var icon = shortcut.IsEmbeddedIcon ? (UIApplicationShortcutIcon)(await _embeddedIconProvider.CreatePlatformIcon(shortcut.Icon)) : (UIApplicationShortcutIcon)(await _customIconProvider.CreatePlatformIcon(shortcut.Icon)); var metadata = CreateUriMetadata(shortcut.Uri); new NSObject().BeginInvokeOnMainThread(() => { var scut = new UIMutableApplicationShortcutItem(type, shortcut.Label, shortcut.Description, icon, metadata); var scuts = UIApplication.SharedApplication.ShortcutItems.ToList(); scuts.Add(scut); UIApplication.SharedApplication.ShortcutItems = scuts.ToArray(); }); }
private void CreateDynamicShortcuts(UIApplication application) { var dynamicShortcut = new UIMutableApplicationShortcutItem(MenuActions.ShowPage3, "Dynamic - Page 3") { LocalizedSubtitle = "Open Page 3", Icon = UIApplicationShortcutIcon.FromType(UIApplicationShortcutIconType.Play) }; application.ShortcutItems = new UIApplicationShortcutItem[] { dynamicShortcut }; }
private void checkActions() { var app = UIApplication.SharedApplication; var authManager = ServiceContainer.Resolve<AuthManager> (); if (authManager.IsAuthenticated) { if (app.ShortcutItems.Length == 0) { var qstart = new UIMutableApplicationShortcutItem (QuickActionsIdentifier.QuickStart, "Start") { LocalizedSubtitle = "Will start a new time entry", Icon = UIApplicationShortcutIcon.FromType (UIApplicationShortcutIconType.Play) }; app.ShortcutItems = new UIApplicationShortcutItem[] { qstart }; } } else { app.ShortcutItems = new UIApplicationShortcutItem[] { }; } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { Core.ViewModels.ViewModelBase.Init(); ServiceLocator.Instance.Add <IAppInsights, AppInsights>(); ServiceLocator.Instance.Add <IDeviceSearchProvider, SpotlightService>(); #if DEBUG Utils.Helpers.Settings.UserId = string.Empty; Xamarin.Calabash.Start(); #endif //Windows Azure CurrentPlatform.Init(); SQLitePCL.CurrentPlatform.Init(); SetupGlobalAppearances(); ConfigureJudoPayments(); var shouldPerformAdditionalDelegateHandling = true; // Get possible shortcut item if (launchOptions != null) { LaunchedShortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; shouldPerformAdditionalDelegateHandling = (LaunchedShortcutItem == null); } // Add dynamic shortcut items if (application.ShortcutItems.Length == 0) { var shortcut3 = new UIMutableApplicationShortcutItem(ShortcutIdentifier.MyBeers, "My Beer") { LocalizedSubtitle = "See the beers you've already had", Icon = UIApplicationShortcutIcon.FromTemplateImageName("quickAction.myBeers.png") }; // Update the application providing the initial 'dynamic' shortcut items. application.ShortcutItems = new UIApplicationShortcutItem[] { shortcut3 }; } return(shouldPerformAdditionalDelegateHandling); }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) { Core.ViewModels.ViewModelBase.Init(); ServiceLocator.Instance.Add<IAppInsights, AppInsights>(); ServiceLocator.Instance.Add<IDeviceSearchProvider, SpotlightService>(); #if DEBUG Utils.Helpers.Settings.UserId = string.Empty; Xamarin.Calabash.Start(); #endif //Windows Azure CurrentPlatform.Init (); SQLitePCL.CurrentPlatform.Init (); SetupGlobalAppearances(); ConfigureJudoPayments(); var shouldPerformAdditionalDelegateHandling = true; // Get possible shortcut item if (launchOptions != null) { LaunchedShortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; shouldPerformAdditionalDelegateHandling = (LaunchedShortcutItem == null); } // Add dynamic shortcut items if (application.ShortcutItems.Length == 0) { var shortcut3 = new UIMutableApplicationShortcutItem(ShortcutIdentifier.MyBeers, "My Beer") { LocalizedSubtitle = "See the beers you've already had", Icon = UIApplicationShortcutIcon.FromTemplateImageName("quickAction.myBeers.png") }; // Update the application providing the initial 'dynamic' shortcut items. application.ShortcutItems = new UIApplicationShortcutItem[]{shortcut3}; } return shouldPerformAdditionalDelegateHandling; }
public void AddToMRU (IFileSystem fs, DocumentReference docRef) { var key = Tuple.Create (fs.Id, docRef.File.Path); var i = entries.IndexOf (key); if (i == 0) { // OK return; } else if (i > 0) { entries.RemoveAt (i); } entries.Insert (0, key); Console.WriteLine ("SAVE MRU {0}", entries); if (ios9) { var icon = UIApplicationShortcutIcon.FromType (UIApplicationShortcutIconType.Compose); var newItems = entries.Take (3).Select (e => { var fsId = e.Item1; var path = e.Item2; var name = System.IO.Path.GetFileNameWithoutExtension (path); var userInfo = new NSDictionary<NSString, NSObject> ( keys: new[] {new NSString("fsId"), new NSString("path")}, values: new NSObject[] {new NSString(fsId), new NSString(path)}); var item = new UIMutableApplicationShortcutItem("open", "Open " + name, "", icon, userInfo); return item; }).ToArray (); UIApplication.SharedApplication.ShortcutItems = newItems; } }