Exemple #1
0
        void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            // Don't handle events fired for old application instances
            // and cleanup the old instance's event handler

            if (Application.Current != this && Application.Current is App app)
            {
                AppActions.OnAppAction -= app.AppActions_OnAppAction;
                return;
            }

            Device.BeginInvokeOnMainThread(async() =>
            {
                var page = e.AppAction.Id switch
                {
                    "battery_info" => new BatteryPage(),
                    "app_info" => new AppInfoPage(),
                    _ => default(Page)
                };

                if (page != null)
                {
                    await Application.Current.MainPage.Navigation.PopToRootAsync();
                    await Application.Current.MainPage.Navigation.PushAsync(page);
                }
            });
        }
Exemple #2
0
 private void AppActions_OnAppAction(object sender, AppActionEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(async() =>
     {
         if (e.AppAction.Id == "app_info")
         {
             await Shell.Current.GoToAsync("//" + nameof(AppInfoPage));
         }
     });
 }
Exemple #3
0
        private void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            if ((Current != this) && (Current is App app))
            {
                AppActions.OnAppAction -= app.AppActions_OnAppAction;

                return;
            }

            MainThread.BeginInvokeOnMainThread(() => { MainPage = new MainPage(e.AppAction.Id); });
        }
Exemple #4
0
        private void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            if (Application.Current != this && Application.Current is App app)
            {
                AppActions.OnAppAction -= app.AppActions_OnAppAction;
                return;
            }

            //TODO Make the related action
            Debug.WriteLine($"{e.AppAction.Id}");
        }
Exemple #5
0
 void AppActions_OnAppAction(object sender, AppActionEventArgs e)
 {
     // Don't handle events fired for old application instances
     // and cleanup the old instance's event handler
     if (Application.Current != this && Application.Current is App app)
     {
         AppActions.OnAppAction -= app.AppActions_OnAppAction;
         return;
     }
     //MainPage = new Page();
     MainPage.DisplayAlert("App Actions détectée", "L'action " + e.AppAction.Id + " a été détectée", "Ok", "Cancel");
 }
Exemple #6
0
        void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            MainPage.Dispatcher.BeginInvokeOnMainThread(async() =>
            {
                var page = e.AppAction.Id switch
                {
                    "battery_info" => new BatteryPage(),
                    "app_info" => new AppInfoPage(),
                    _ => default(Page)
                };

                if (page != null)
                {
                    await Application.Current.MainPage.Navigation.PopToRootAsync();
                    await Application.Current.MainPage.Navigation.PushAsync(page);
                }
            });
        }
        private void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            if (Application.Current != this && Application.Current is App app)
            {
                AppActions.OnAppAction -= app.AppActions_OnAppAction;
                return;
            }
            Device.BeginInvokeOnMainThread(() =>
            {
                var page = e.AppAction.Id;
                switch (page)
                {
                case "Option1":
                    NavigationService.NavigateAsync("NavigationPage/TravelHome");
                    break;

                case "Option2":
                    NavigationService.NavigateAsync("NavigationPage/MainPage");
                    break;
                }
            });
        }
Exemple #8
0
        void AppActions_OnAppAction(object sender, AppActionEventArgs e)
        {
            // Don't handle events fired for old application instances
            // and cleanup the old instance's event handler
            if (Application.Current != this && Application.Current is App app)
            {
                AppActions.OnAppAction -= app.AppActions_OnAppAction;
                return;
            }

            Device.BeginInvokeOnMainThread(async() =>
            {
                Page targetPage = null;

                // Determine the app action type or id which user selected
                switch (e.AppAction.Id)
                {
                case Helpers.ActionType.AddNote:
                    targetPage = new NewItemPage();
                    break;

                case Helpers.ActionType.ViewFavourites:
                    // targetPage = new FavouritesPage();
                    break;

                // Other id cases:

                default:
                    break;
                }

                // Handle the navigation to target page
                if (targetPage != null)
                {
                    await Current.MainPage.Navigation.PushModalAsync(new NavigationPage(new NewItemPage()));
                }
            });
        }
 void HandleOnAppAction(object?sender, AppActionEventArgs e)
 {
     _essentialsBuilder?.AppActionHandlers?.Invoke(e.AppAction);
 }