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 RestaurantGuide.iOS.ShortcutHelper.ShortcutIdentifiers.Random: Console.WriteLine("QUICKACTION: Choose Random Restaurant"); //HACK: show the detail with a random restaurant showing ContinueNavigation("-1"); handled = true; break; } Console.Write(handled); // Return results return(handled); }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { // Store the fact that we've signed in. This is where the shortcuts get their notifications. // Look at the Info.plist file for more info }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { IosDependencyContainer.Instance .AnalyticsService .ApplicationShortcut .Track(shortcutItem.LocalizedTitle); var shortcutUrlKey = new NSString(nameof(ApplicationShortcut.Url)); if (!shortcutItem.UserInfo.ContainsKey(shortcutUrlKey)) { return; } var shortcutUrlString = shortcutItem.UserInfo[shortcutUrlKey] as NSString; if (shortcutUrlString == null) { return; } var shortcutUrl = new NSUrl(shortcutUrlString); handleDeeplink(shortcutUrl); }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { analyticsService.TrackAppShortcut(shortcutItem.LocalizedTitle); var shortcutType = (ShortcutType)(int)(NSNumber)shortcutItem.UserInfo[nameof(ApplicationShortcut.Type)]; switch (shortcutType) { case ShortcutType.ContinueLastTimeEntry: var interactorFactory = Mvx.Resolve <IInteractorFactory>(); if (interactorFactory == null) { return; } IDisposable subscription = null; subscription = interactorFactory .ContinueMostRecentTimeEntry() .Execute() .Subscribe(_ => { subscription.Dispose(); subscription = null; }); break; case ShortcutType.Reports: navigationService.Navigate <ReportsViewModel>(); break; case ShortcutType.StartTimeEntry: navigationService.Navigate <StartTimeEntryViewModel>(); break; } }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) { var versionString = UIDevice.CurrentDevice.SystemVersion; systemVersion = Convert.ToInt32 ( versionString.Split ( new [] {"."}, StringSplitOptions.None)[0]); // Component initialisation. RegisterComponents (); // Setup Google sign in SetupGoogleServices (); Toggl.Ross.Theme.Style.Initialize (); // Start app window = new TogglWindow (UIScreen.MainScreen.Bounds); window.RootViewController = new MainViewController (); window.MakeKeyAndVisible (); // Make sure critical services are running are running: ServiceContainer.Resolve<UpgradeManger> ().TryUpgrade (); ServiceContainer.Resolve<ILoggerClient> (); ServiceContainer.Resolve<LoggerUserManager> (); ServiceContainer.Resolve<ITracker> (); ServiceContainer.Resolve<APNSManager> (); ServiceContainer.Resolve<QuickActions> (); if (launchOptions != null) { LaunchedShortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; } return LaunchedShortcutItem == null; }
// if app is already running public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { Console.WriteLine("PerformActionForShortcutItem"); // Perform action var handled = HandleShortcutItem(shortcutItem); completionHandler(handled); }
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); }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { // Store the fact that we've signed in. This is where the shortcuts get their notifications. // Look at the Info.plist file for more info }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.StopCommand: MessagingCenter.Send(myApp, "StopCommand"); handled = true; break; case ShortcutIdentifier.StartCommand: MessagingCenter.Send(myApp, "StartCommand"); handled = true; break; } // Return results return(handled); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. var shouldPerformAdditionalDelegateHandling = true; // If a shortcut was launched, display its information and take the appropriate action if (launchOptions != null) { var shortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; if (shortcutItem != null) { launchedShortcutItem = shortcutItem; // This will block "performActionForShortcutItem:completionHandler" from being called. shouldPerformAdditionalDelegateHandling = false; } } // Install initial verstions of our two extra dynamic shortcuts. // Update the application providing the initial 'dynamic' shortcut items. if (application.ShortcutItems.Length == 0) { application.ShortcutItems = new [] { CreatePlayShortcut(), CreatePauseShortcut() } } ; return(shouldPerformAdditionalDelegateHandling); }
public override void OnActivated(UIApplication application) { PlaybackManager.Shared.NativePlayer.EnableVideo(); HandleShortcut(LaunchedShortcutItem); LaunchedShortcutItem = null; ScreenManager.Shared.OnActivated(); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { case "com.ellyfield.compasspro.000": Handler.magnetic = true; //Console.WriteLine("First shortcut selected"); handled = true; break; case "com.ellyfield.compasspro.001": Handler.magnetic = false; //Console.WriteLine("Second shortcut selected"); handled = true; break; case "com.ellyfield.compasspro.002": //Console.WriteLine("Second shortcut selected"); Handler.share(); handled = true; break; } // Return results return(handled); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { Console.WriteLine("HandleShortcutItem "); var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.Schedule: Console.WriteLine("QUICKACTION: Schedule"); ContinueNavigation(AppPage.Schedule); handled = true; break; case ShortcutIdentifier.Lunch: Console.WriteLine("QUICKACTION: Lunch Locations"); ContinueNavigation(AppPage.LunchLocations); handled = true; break; } Console.Write(handled); // Return results return(handled); }
// if app is already running public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { Console.WriteLine ("dddddddd PerformActionForShortcutItem"); // Perform action var handled = HandleShortcutItem(shortcutItem); completionHandler(handled); }
bool HandleShortCutItem(UIApplicationShortcutItem shortcutItem) { // Verify that the provided `shortcutItem`'s `type` is one handled by the application. var shortcutIdentifier = ShortcutIdentifier.Create(shortcutItem.Type); if (shortcutIdentifier == null) { return(false); } // Construct an alert using the details of the shortcut used to open the application. var alertController = UIAlertController.Create("Shortcut Handled", shortcutItem.LocalizedTitle, UIAlertControllerStyle.Alert); var okAction = UIAlertAction.Create("OK", UIAlertActionStyle.Default, null); alertController.AddAction(okAction); // Display an alert indicating the shortcut selected from the home screen. var rootViewController = Window.RootViewController; if (rootViewController != null) { rootViewController.PresentViewController(alertController, true, null); } return(true); }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { analyticsService.TrackAppShortcut(shortcutItem.LocalizedTitle); var url = shortcutItem.UserInfo[nameof(ApplicationShortcut.Url)].ToString(); navigationService.Navigate(url); }
bool HandleShortcut(UIApplicationShortcutItem shortcutItem) { if (shortcutItem == null) { return(false); } switch (shortcutItem.Type) { //play case "com.IIS.MusicPlayer.iOS.000": PlaybackManager.Shared.Play(); return(true); case "com.IIS.MusicPlayer.iOS.001": var vm = new MusicPlayer.ViewModels.RadioStationViewModel { IsIncluded = false }; var items = vm.RowsInSection(0); if (items == 0) { return(true); } var radio = vm.ItemFor(0, 0); Settings.ShowOfflineOnly = false; PlaybackManager.Shared.Play(radio); return(true); } return(false); }
// Handle force touch shortcuts being clicked. public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) return false; // Take action based on the shortcut type switch (shortcutItem.Type) { case "edu.usf.smartlab.000": if (UIDevice.CurrentDevice.CheckSystemVersion(9,0)) { var sfViewCtrl = new SFSafariViewController (new NSUrl(Api.SCHEDULE_URL)); this._Controller.PresentViewControllerAsync (sfViewCtrl, true); } else { UIApplication.SharedApplication.OpenUrl(new NSUrl(Api.SCHEDULE_URL)); } handled = true; break; case "edu.usf.smartlab.001": this._Controller.NavigationController.PushViewController(new CalloutViewCtrl(), true); handled = true; break; } // Return results return handled; }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.Continue: Console.WriteLine("Continue shortcut selected"); handled = true; break; case ShortcutIdentifier.Search: Console.WriteLine("Search shortcut selected"); handled = true; break; } // Return results return(handled); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { //TODO: Need to handle force touch menu options case ShortcutIdentifier.NewReport: //Handle New Report Force Touch Console.WriteLine("New Report Handle"); handled = true; break; case ShortcutIdentifier.NewExpense: //Handle New Report Force Touch Console.WriteLine("New Expense Handle"); handled = true; break; } // Return results return(handled); }
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); }
internal static bool IsUnoShortcut(this UIApplicationShortcutItem shortcut) { if (shortcut == null) { throw new ArgumentNullException(nameof(shortcut)); } return(shortcut.UserInfo?[JumpListItem.UnoShortcutKey] != null); }
public override void OnActivated(UIApplication application) { // Handle any shortcut item being selected HandleShortcutItem(LaunchedShortcutItem); // Clear shortcut after it's been handled LaunchedShortcutItem = null; }
private bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { if (shortcutItem == null) { return(false); } return((App.Current as App).ManageMenuAction(shortcutItem.Type)); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { Console.WriteLine("HandleShortcutItem "); var handled = false; // Anything to process? if (shortcutItem == null) return false; // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.Tweet: Console.WriteLine("QUICKACTION: Tweet"); var slComposer = SLComposeViewController.FromService(SLServiceType.Twitter); if (slComposer == null) { new UIAlertView("Unavailable", "Twitter is not available, please sign in on your devices settings screen.", null, "OK").Show(); } else { slComposer.SetInitialText("#UtahOpenSource"); if (slComposer.EditButtonItem != null) { slComposer.EditButtonItem.TintColor = UIColor.FromRGB(118, 53, 235); } slComposer.CompletionHandler += (result) => { InvokeOnMainThread(() => UIApplication.SharedApplication.KeyWindow.RootViewController.DismissViewController(true, null)); }; UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(slComposer, true); } handled = true; break; case ShortcutIdentifier.Announcements: Console.WriteLine("QUICKACTION: Accouncements"); ContinueNavigation(AppPage.Notification); handled = true; break; case ShortcutIdentifier.MiniHacks: Console.WriteLine("QUICKACTION: MiniHacks"); ContinueNavigation(AppPage.MiniHacks); handled = true; break; case ShortcutIdentifier.Events: Console.WriteLine("QUICKACTION: Events"); ContinueNavigation(AppPage.Events); handled = true; break; } Console.Write(handled); // Return results return handled; }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { ShortcutAction?action = ConvertShortcutItem(shortcutItem); if (action != null) { HandleShortcutAction(action.Value); } }
// Shourcut Plugin.AppShortcut public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { var uri = Plugin.AppShortcuts.iOS.ArgumentsHelper.GetUriFromApplicationShortcutItem(shortcutItem); if (uri != null) { Xamarin.Forms.Application.Current.SendOnAppLinkRequestReceived(uri); } }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { base.PerformActionForShortcutItem(application, shortcutItem, completionHandler); if (_useDefaultConfiguration) { Xamarin.Essentials.Platform.PerformActionForShortcutItem(application, shortcutItem, completionHandler); } }
public static void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { if (shortcutItem.Type == AppActions.Type) { var appAction = shortcutItem.ToAppAction(); AppActions.InvokeOnAppAction(application, shortcutItem.ToAppAction()); } }
public void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { if (shortcutItem.Type == ShortcutType) { var appAction = shortcutItem.ToAppAction(); AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction)); } }
public override void OnActivated (UIApplication application) { var shortcut = launchedShortcutItem; if (shortcut == null) return; HandleShortCutItem (shortcut); launchedShortcutItem = null; }
public static Uri GetUriFromApplicationShortcutItem(UIApplicationShortcutItem shortcutItem) { if (shortcutItem.UserInfo.ContainsKey(new NSString(ShortcutUriKey))) { var shortcutUri = shortcutItem.UserInfo[ShortcutUriKey].ToString(); return(new Uri(shortcutUri)); } return(null); }
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 override void PerformActionForShortcutItem( UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { if (!_preventSecondaryActivationHandling) { OnLaunched(new LaunchActivatedEventArgs(ActivationKind.Launch, shortcutItem.Type)); } _preventSecondaryActivationHandling = false; }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) { return(false); } // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.MyBeers: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 0; } handled = true; break; case ShortcutIdentifier.WishList: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 1; } handled = true; break; case ShortcutIdentifier.Search: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 2; } handled = true; break; case ShortcutIdentifier.Me: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 3; } handled = true; break; } Console.Write(handled); // Return results return(handled); }
public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { analyticsService.ApplicationShortcut.Track(shortcutItem.LocalizedTitle); var key = new NSString(nameof(ApplicationShortcut.Type)); if (!shortcutItem.UserInfo.ContainsKey(key)) { return; } var shortcutNumber = shortcutItem.UserInfo[key] as NSNumber; if (shortcutNumber == null) { return; } var shortcutType = (ShortcutType)(int)shortcutNumber; switch (shortcutType) { case ShortcutType.ContinueLastTimeEntry: navigationService.Navigate <MainViewModel>(); var interactorFactory = IosDependencyContainer.Instance.InteractorFactory; if (interactorFactory == null) { return; } IDisposable subscription = null; subscription = interactorFactory .ContinueMostRecentTimeEntry() .Execute() .Subscribe(_ => { subscription.Dispose(); subscription = null; }); break; case ShortcutType.Reports: navigationService.Navigate <ReportsViewModel>(); break; case ShortcutType.StartTimeEntry: navigationService.Navigate <MainViewModel>(); navigationService.Navigate <StartTimeEntryViewModel>(); break; case ShortcutType.Calendar: navigationService.Navigate <CalendarViewModel>(); break; } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Lets create some dynamic shortcut items var shortcuts = new List<UIApplicationShortcutItem> (); for (int counter = 1; counter <= 5; counter++) { var item = new UIApplicationShortcutItem ("com.xamarin.university.dynamicshortcutdemo", "Item " + counter); shortcuts.Add (item); } UIApplication.SharedApplication.ShortcutItems = shortcuts.ToArray (); return true; }
bool HandleShortCutItem(UIApplicationShortcutItem shortcutItem) { // Verify that the provided `shortcutItem`'s `type` is one handled by the application. var shortcutIdentifier = ShortcutIdentifier.Create (shortcutItem.Type); if (shortcutIdentifier == null) return false; // Construct an alert using the details of the shortcut used to open the application. var alertController = UIAlertController.Create ("Shortcut Handled", shortcutItem.LocalizedTitle, UIAlertControllerStyle.Alert); var okAction = UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null); alertController.AddAction (okAction); // Display an alert indicating the shortcut selected from the home screen. var rootViewController = Window.RootViewController; if (rootViewController != null) rootViewController.PresentViewController (alertController, true, null); return true; }
public bool HandleShortcut (UIApplicationShortcutItem shortcut, bool shouldHandleAfterSync = false) { this.shouldHandleAfterSync = shouldHandleAfterSync; if (shortcut == null) { return true; } if (shouldHandleAfterSync) { scheduledShortcut = shortcut; return true; } if (shortcut.Type == QuickActionsIdentifier.QuickStart) { StartNewEntry (); return true; } return false; }
public override async void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { try { await HandleShortcutItemAsync (shortcutItem); } catch (Exception ex) { Log.Error (ex); } try { completionHandler (true); } catch (Exception ex) { Log.Error (ex); } }
public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { var quickActions = ServiceContainer.Resolve<QuickActions> (); completionHandler (quickActions.HandleShortcut (shortcutItem)); }
public override void OnActivated (UIApplication application) { // Make sure the user data is refreshed when the application becomes active ServiceContainer.Resolve<ISyncManager> ().Run (); ServiceContainer.Resolve<NetworkIndicatorManager> (); if (systemVersion > minVersionWidget) { ServiceContainer.Resolve<WidgetSyncManager>(); var widgetService = ServiceContainer.Resolve<WidgetUpdateService>(); widgetService.SetAppOnBackground (false); } if (LaunchedShortcutItem != null) { ServiceContainer.Resolve<QuickActions> ().HandleShortcut (LaunchedShortcutItem, true); LaunchedShortcutItem = null; } }
// if app is already running public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { var handled = HandleShortcutItem(shortcutItem); completionHandler(handled); }
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"); Insights.Track("3DTouch", new Dictionary<string, string> { {"Type", "NewItem"} }); 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; }
public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { var selectedShortcutItem = ShortcutItem; if (selectedShortcutItem == null) throw new InvalidProgramException ("The `selectedShortcutItem` was not set."); if (segue.Identifier == "ShortcutDetailUpdated") { // In the updated case, create a shortcut item to represent the final state of the view controller. UIApplicationShortcutIconType iconType = IconTypeForSelectedRow ((int)PickerView.SelectedRowInComponent (0)); var icon = UIApplicationShortcutIcon.FromType (iconType); var userInfo = new NSDictionary<NSString, NSObject> (AppDelegate.ApplicationShortcutUserInfoIconKey, new NSNumber (PickerView.SelectedRowInComponent (0))); ShortcutItem = new UIApplicationShortcutItem (selectedShortcutItem.Type, TitleTextField.Text ?? string.Empty, SubtitleTextField.Text, icon, userInfo); } }
public override void OnActivated (UIApplication application) { Console.WriteLine ("ccccccc OnActivated"); // Handle any shortcut item being selected HandleShortcutItem(LaunchedShortcutItem); Xamarin.Insights.Track("3DTouch", new Dictionary<string, string> { {"Type", "Random"} }); // Clear shortcut after it's been handled LaunchedShortcutItem = null; }
// if app is already running public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { // Perform action completionHandler(HandleShortcutItem(shortcutItem)); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) return false; // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutHelper.ShortcutIdentifiers.Appointments: Tabs.SelectedIndex = 2; Tabs.Title = "Appointments"; handled = true; break; case ShortcutHelper.ShortcutIdentifiers.Treatments: Tabs.SelectedIndex = 3; Tabs.Title = "Treatments"; handled = true; break; case ShortcutHelper.ShortcutIdentifiers.User: Tabs.SelectedIndex = 1; Tabs.Title = "User"; // Show user handled = true; break; } // Return results return handled; }
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 RestaurantGuide.iOS.ShortcutHelper.ShortcutIdentifiers.Random: Console.WriteLine ("QUICKACTION: Choose Random Restaurant"); //HACK: show the detail with a random restaurant showing ContinueNavigation ("-1"); handled = true; break; } Console.Write (handled); // Return results return handled; }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { Console.WriteLine("HandleShortcutItem "); var handled = false; // Anything to process? if (shortcutItem == null) return false; // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.Tweet: Console.WriteLine("QUICKACTION: Tweet"); var slComposer = SLComposeViewController.FromService(SLServiceType.Twitter); if (slComposer == null) { new UIAlertView("Unavailable", "Twitter is not available, please sign in on your devices settings screen.", null, "OK").Show(); } else { slComposer.SetInitialText("#XamarinEvolve"); if (slComposer.EditButtonItem != null) { slComposer.EditButtonItem.TintColor = UIColor.FromRGB(118, 53, 235); } slComposer.CompletionHandler += (result) => { InvokeOnMainThread(() => UIApplication.SharedApplication.KeyWindow.RootViewController.DismissViewController(true, null)); }; UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(slComposer, true); } handled = true; break; case ShortcutIdentifier.Announcements: Console.WriteLine("QUICKACTION: Accouncements"); ContinueNavigation(AppPage.Notification); handled = true; break; case ShortcutIdentifier.MiniHacks: Console.WriteLine("QUICKACTION: MiniHacks"); ContinueNavigation(AppPage.MiniHacks); handled = true; break; case ShortcutIdentifier.Events: Console.WriteLine("QUICKACTION: Events"); ContinueNavigation(AppPage.Events); handled = true; break; } Console.Write(handled); // Return results return handled; }
async Task HandleShortcutItemAsync (UIApplicationShortcutItem scitem) { switch (scitem.Type) { case "new": { await AddAndOpenNewDocument (); } break; case "open": { var path = scitem.UserInfo ["path"].ToString (); var fsId = scitem.UserInfo ["fsId"].ToString (); if (FileSystem.Id != fsId) { var fs = FileSystemManager.Shared.ChooseFileSystem (fsId); await SetFileSystemAsync (fs, false); } await OpenDocument (path, false); } break; } }
//for when a user chooses a quick launch shortcut public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { completionHandler (ShortcutManager.HandleShortcut (application, shortcutItem)); }
public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) { var handled = false; // Anything to process? if (shortcutItem == null) return false; // Take action based on the shortcut type switch (shortcutItem.Type) { case ShortcutIdentifier.MyBeers: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 0; } handled = true; break; case ShortcutIdentifier.WishList: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 1; } handled = true; break; case ShortcutIdentifier.Search: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 2; } handled = true; break; case ShortcutIdentifier.Me: if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 3; } handled = true; break; } Console.Write (handled); // Return results return handled; }
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 First: App.GoToRoot(); ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[0]; handled = true; break; case Second: App.GoToRoot(); ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[1]; handled = true; break; case Third: App.GoToRoot(); ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[2]; handled = true; break; } Console.Write (handled); // Return results return handled; }
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. var shouldPerformAdditionalDelegateHandling = true; // If a shortcut was launched, display its information and take the appropriate action if(launchOptions != null) { var shortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem; if (shortcutItem != null) { launchedShortcutItem = shortcutItem; // This will block "performActionForShortcutItem:completionHandler" from being called. shouldPerformAdditionalDelegateHandling = false; } } // Install initial verstions of our two extra dynamic shortcuts. // Update the application providing the initial 'dynamic' shortcut items. if (application.ShortcutItems.Length == 0) application.ShortcutItems = new [] { CreatePlayShortcut (), CreatePauseShortcut () }; return shouldPerformAdditionalDelegateHandling; }