Esempio n. 1
0
        public NavigationRootPage()
        {
            this.InitializeComponent();

            if (navigationRootViewModel == null)
            {
                if (!SimpleIoc.Default.IsRegistered <NavigationRootViewModel>())
                {
                    SimpleIoc.Default.Register <NavigationRootViewModel>();
                }

                navigationRootViewModel = SimpleIoc.Default.GetInstance <NavigationRootViewModel>();
            }

            this.DataContext = navigationRootViewModel;

            this.Loaded += NavigationRootPage_Loaded;

            //注册物理或者虚拟后退键 - 已无用
            //SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            //DisplayInformation.GetForCurrentView().OrientationChanged += NavigationRootPage_OrientationChanged;
            //如果是手机,则默认全屏模式
            if (AppEnvironment.IsPhone)
            {
                ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
                //ApplicationView.GetForCurrentView().TitleBar
            }
            else
            {
                // DisplayProperties.CurrentOrientation 发生变化时触发的事件

                //设置平板窗口的最小宽高
                ApplicationView.GetForCurrentView().SetPreferredMinSize(AppEnvironment.DesktopSize);
            }
        }
Esempio n. 2
0
        public NavigationRootPage()
        {
            this.InitializeComponent();

            if (navigationRootViewModel == null)
            {
                if (!SimpleIoc.Default.IsRegistered <NavigationRootViewModel>())
                {
                    SimpleIoc.Default.Register <NavigationRootViewModel>();
                }

                navigationRootViewModel = SimpleIoc.Default.GetInstance <NavigationRootViewModel>();
            }

            this.DataContext = navigationRootViewModel;

            this.Loaded += async(ss, ee) =>
            {
                if (!AppEnvironment.IsPhone)
                {
                    this.rootFrame.Margin            = new Thickness(-1, -1, -0.5, -0.5);
                    this.appBarRefreshBtn.Visibility = Visibility.Visible;
                    InitZoomSemanticButtonMessenger();
                }
                else
                {
                    this.rootFrame.Margin            = new Thickness(0, 0, 0, 0);
                    this.appBarRefreshBtn.Visibility = Visibility.Collapsed;
                }

                InitFavoriteMessenger();

                InitDownloadMessenger();

                InitVideoMessenger();

                InitRankSelectedNameMessenger();

                if (navigationRootViewModel != null)
                {
                    await navigationRootViewModel.InitCategoryPngs();

                    //获取类别展示数据
                    navigationRootViewModel.GetEyeSightCommonCollection();

                    //获取底部展示数据
                    navigationRootViewModel.GetEyeSightBottomCollection();

                    //默认选中第一条
                    lvCommonCategory.SelectedIndex = 0;
                }
            };

            this.Unloaded += (ss, ee) =>
            {
                Messenger.Default.Unregister(this);

                if (AppEnvironment.IsPhone)
                {
                    LeftSliderGuestureBox.Instance.HideLeftSliderGuestureUIControl();
                }
            };
        }