Esempio n. 1
0
        internal static UIApplicationShortcutItem ToShortcutItem(this JumpListItem jumpListItem)
        {
            var dictionary = new Dictionary <string, string>()
            {
                { JumpListItem.UnoShortcutKey, "true" }
            };

            if (jumpListItem.Logo != null)
            {
                dictionary[JumpListItem.ImagePathKey] = jumpListItem.Logo.ToString();
            }

            var displayName = jumpListItem.DisplayName;

            if (string.IsNullOrEmpty(displayName))
            {
                displayName = " ";                 //use single space to make sure item is displayed
            }

            var shortcut =
                new UIApplicationShortcutItem(
                    jumpListItem.Arguments,
                    displayName,
                    jumpListItem.Description,
                    jumpListItem.Logo != null ? UIApplicationShortcutIcon.FromTemplateImageName(jumpListItem.Logo.LocalPath) : null,
                    NSDictionary <NSString, NSObject> .FromObjectsAndKeys(
                        dictionary.Values.Cast <object>().ToArray(),
                        dictionary.Keys.Cast <object>().ToArray()));

            return(shortcut);
        }
Esempio n. 2
0
        public async Task <object> CreatePlatformIcon(IShortcutIcon shortcutIcon)
        {
            if (string.IsNullOrWhiteSpace(shortcutIcon.IconName))
            {
                return(null);
            }

            UIApplicationShortcutIcon icon = null;

            new NSObject().BeginInvokeOnMainThread(() =>
            {
                icon = UIApplicationShortcutIcon.FromTemplateImageName(shortcutIcon.IconName);
            });

            await Task.Delay(200);

            return(icon);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        internal static UIApplicationShortcutItem ToShortcutItem(this AppAction action)
        {
            var keys   = new List <NSString>();
            var values = new List <NSObject>();

            // id
            keys.Add((NSString)"id");
            values.Add((NSString)action.Id);

            // icon
            if (!string.IsNullOrEmpty(action.Icon))
            {
                keys.Add((NSString)"icon");
                values.Add((NSString)action.Icon);
            }

            return(new UIApplicationShortcutItem(
                       action.Type,
                       action.Title,
                       action.Subtitle,
                       action.Icon != null ? UIApplicationShortcutIcon.FromTemplateImageName(action.Icon) : null,
                       new NSDictionary <NSString, NSObject>(keys.ToArray(), values.ToArray())));
        }
Esempio n. 5
0
 private void CreateQuickActions()
 {
     if (TraitCollection.ForceTouchCapability == UIForceTouchCapability.Available)
     {
         var bundleIdentifier = NSBundle.MainBundle.BundleIdentifier;
         if (bundleIdentifier != null)
         {
             var shortcutItem1 = new UIApplicationShortcutItem("(com.companyname.FoodPinn).OpenFavorites", "Show Favorites", null, UIApplicationShortcutIcon.FromTemplateImageName("favorite"), null);
             var shortcutItem2 = new UIApplicationShortcutItem("(com.companyname.FoodPinn).OpenDiscover", "Discover Restaurants", null, UIApplicationShortcutIcon.FromTemplateImageName("discover"), null);
             var shortcutItem3 = new UIApplicationShortcutItem("(com.companyname.FoodPinn).NewRestaurant", "New Restaurant", null, UIApplicationShortcutIcon.FromType(UIApplicationShortcutIconType.Add), null);
             UIApplication.SharedApplication.ShortcutItems = new[] { shortcutItem1, shortcutItem2, shortcutItem3 };
         }
     }
 }