示例#1
0
        public NavigationViewModelAttribute(Type viewModel, NavigationViewSupportedPlatform platform = NavigationViewSupportedPlatform.All, bool useDataContextInsteadOfCreating = false)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel");
            }

            ViewModel          = viewModel;
            SupportedPlatforms = platform;
            UseDataContextInsteadOfCreating = useDataContextInsteadOfCreating;
        }
示例#2
0
        private bool CurrentPlatformSupportsView(NavigationViewSupportedPlatform platformType)
        {
            var platform = DeviceInformation.GetDevicePlatform();

            NavigationViewSupportedPlatform convertedNavPlatform = NavigationViewSupportedPlatform.All;

            switch (platform)
            {
            case Core.Platform.Desktop:
                convertedNavPlatform = NavigationViewSupportedPlatform.Desktop;
                break;

            case Core.Platform.Holographic:
                convertedNavPlatform = NavigationViewSupportedPlatform.Holographic;
                break;

            case Core.Platform.Mobile:
                convertedNavPlatform = NavigationViewSupportedPlatform.Mobile;
                break;

            case Core.Platform.IoT:
                convertedNavPlatform = NavigationViewSupportedPlatform.IoT;
                break;

            case Core.Platform.Xbox:
                convertedNavPlatform = NavigationViewSupportedPlatform.Xbox;
                break;

            case Core.Platform.Team:
                convertedNavPlatform = NavigationViewSupportedPlatform.Team;
                break;

            default:
                throw new Exception();
            }

            //cool bitwise method http://stackoverflow.com/a/18001375

            return((platformType & convertedNavPlatform) > 0);
        }