//protected override void OnDisappearing()
        //{
        //    MessagingCenter.Unsubscribe<MainPageViewModel, Host>(this, MessengerKeys.HostChanged);
        //    base.OnDisappearing();
        //}

        //protected override void OnAppearing()
        //{
        //    MessagingCenter.Subscribe<MainPageViewModel, Host>(
        //        this, MessengerKeys.HostChanged, async (sender, arg) =>
        //        {
        //            MainThread.BeginInvokeOnMainThread(() => { InitList(arg); });

        //        });
        //    base.OnAppearing();
        //}


        /// <summary>
        /// </summary>
        public MyCustomShellApp()
        {
            var config =
                App.Container.Resolve <IConfiguration>();
            var messagingCenter =
                App.Container.Resolve <IMessagingCenter>();

            messagingCenter.Subscribe <IConnctionService, Host>(
                this, MessengerKeys.HostChanged,
                async(sender, arg) => { MainThread.BeginInvokeOnMainThread(() => { InitList(arg); }); });
            if (!config.ModeOmvOnlyKey)
            {
                FlyoutHeader = new FlyoutHeader("MMS_graphic.png");
            }
            else
            {
                FlyoutHeader = new FlyoutHeader("OMV_graphic.png");
            }


            var homeItem = new FlyoutItem
            {
                Title = Title = openmediavault.Homepage,
                Items =
                {
                    new ShellSection
                    {
                        Items =
                        {
                            new ShellContent
                            {
                                Title           = openmediavault.Homepage,
                                ContentTemplate = new DataTemplate(typeof(MainPage))
                            }
                        }
                    }
                }
            };

            Items.AddRange(homeItem);


            //var commandsItem = CreateFlyoutItem(openmediavault.ExecuteCommand,
            //    typeof(CustomCommandListPage));
            var settingsItem = CreateFlyoutItem(openmediavault.Settings,
                                                typeof(SettingsPage));
            var aboutItem = CreateFlyoutItem(openmediavault.About,
                                             typeof(AboutPage));


            //Items.AddRange(commandsItem, settingsItem, aboutItem);
            Items.AddRange(settingsItem, aboutItem);
            BindingContext = App.Container.Resolve <AppShellViewModel>();
            // Item => section => content

            //this.PropertyChanged += OnPropertyChanged;
            //this.CurrentItem.PropertyChanged += CurrentItemOnPropertyChanged;
        }
Esempio n. 2
0
 protected override void Init()
 {
     FlyoutHeader = new FlyoutHeader();
     Items.Add(new FlyoutItem
     {
         Title = "Issue 6640",
         Items =
         {
             new ShellSection
             {
                 Items =
                 {
                     new ShellContent
                     {
                         Content = new ContentPage
                         {
                             Content = new StackLayout
                             {
                                 Children =
                                 {
                                     new Button
                                     {
                                         AutomationId = "Logout",
                                         Text         = "Click the button",
                                         Command      = new Command(() =>
                                         {
                                             Application.Current.MainPage = new ContentPage
                                             {
                                                 Content = new StackLayout
                                                 {
                                                     BackgroundColor = Color.White,
                                                     Children        =
                                                     {
                                                         new Label
                                                         {
                                                             Text = $"Press Back Arrow to send application to background and wait few seconds.{Environment.NewLine}Application must not crash."
                                                         }
                                                     }
                                                 }
                                             };
                                         })
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     });
 }