//
        //Display Cost based suggestions to the user
        //
        string CostBasedSuggestions(ConnectionCost connectionCost)
        {
            string costBasedSuggestions = string.Empty;

            costBasedSuggestions += "Cost Based Suggestions: \n";
            costBasedSuggestions += "====================\n";

            if (connectionCost.Roaming)
            {
                costBasedSuggestions += "Connection is out of MNO's network, using the connection may result in additional charge. Application can implement High Cost behavior in this scenario\n";
            }
            else if (connectionCost.NetworkCostType == NetworkCostType.Variable)
            {
                costBasedSuggestions += "Connection cost is variable, and the connection is charged based on usage, so application can implement the Conservative behavior\n";
            }
            else if (connectionCost.NetworkCostType == NetworkCostType.Fixed)
            {
                if (connectionCost.OverDataLimit || connectionCost.ApproachingDataLimit)
                {
                    costBasedSuggestions += "Connection has exceeded the usage cap limit or is approaching the datalimit, and the application can implement High Cost behavior in this scenario\n";
                }
                else
                {
                    costBasedSuggestions += "Application can implemement the Conservative behavior\n";
                }
            }
            else
            {
                costBasedSuggestions += "Application can implement the Standard behavior\n";
            }
            return(costBasedSuggestions);
        }
Exemplo n.º 2
0
        private async Task LoadFilmDetails()
        {
            this.gFilmInfo.Visibility = Windows.UI.Xaml.Visibility.Visible;

            ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            ConnectionCost InternetConnectionCost = (InternetConnectionProfile == null ? null : InternetConnectionProfile.GetConnectionCost());

            Task <YouTubeUri> tYouTube = null;

            if (!String.IsNullOrEmpty(SelectedFilm.YoutubeTrailer) &&
                InternetConnectionProfile != null &&
                InternetConnectionProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess &&
                InternetConnectionCost != null &&
                InternetConnectionCost.NetworkCostType == NetworkCostType.Unrestricted)
            {
                tYouTube = MyToolkit.Multimedia.YouTube.GetVideoUriAsync(SelectedFilm.YoutubeTrailer, Config.TrailerQuality);
            }

            if (tYouTube != null)
            {
                try
                {
                    this.trailerUrl = await tYouTube;
                }
                catch { }
            }

            this.spFilmButtons.Visibility = this.btnTrailer.Visibility = btnPlay.Visibility = (trailerUrl != null ? Windows.UI.Xaml.Visibility.Visible : Windows.UI.Xaml.Visibility.Collapsed);
            this.mpTrailer.Visibility     = Windows.UI.Xaml.Visibility.Collapsed;
        }
Exemplo n.º 3
0
        public static bool IsConnectedToDataRoaming()
        {
            bool isRoaming = false;
            var  internetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            if (internetConnectionProfile != null && internetConnectionProfile.IsWwanConnectionProfile)
            {
                ConnectionCost cc = internetConnectionProfile.GetConnectionCost();
                isRoaming = cc.Roaming;
            }
            return(isRoaming);
        }
Exemplo n.º 4
0
        public static Boolean MeteredOrLimited()
        {
            ConnectionCost _connectionCost = NetworkInformation.GetInternetConnectionProfile().GetConnectionCost();

            if ((_connectionCost.Roaming) ||
                (_connectionCost.NetworkCostType == NetworkCostType.Fixed) && (_connectionCost.OverDataLimit || _connectionCost.ApproachingDataLimit))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private async Task LoadFilmDetails()
        {
            ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            ConnectionCost InternetConnectionCost = (InternetConnectionProfile == null ? null : InternetConnectionProfile.GetConnectionCost());

            Task <YouTubeUri> tYouTube = null;

            if (InternetConnectionProfile != null &&
                InternetConnectionProfile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess)
            {
                if (!String.IsNullOrEmpty(SelectedFilm.YoutubeTrailer) &&
                    InternetConnectionCost != null &&
                    InternetConnectionCost.NetworkCostType == NetworkCostType.Unrestricted)
                {
                    tYouTube = MyToolkit.Multimedia.YouTube.GetVideoUriAsync(SelectedFilm.YoutubeTrailer, Config.TrailerQuality);
                }
            }

            this.DataContext = this;

            CinemaData cd = new CinemaData(App.FilmCinemas[SelectedFilm.EDI]);

            dataLetter        = cd.GroupsByLetter;
            cvsCinemas.Source = dataLetter;

            gvZoomedInCinemas.SelectionChanged -= gvZoomedIn_SelectionChanged;
            gvZoomedInCinemas.SelectedItem      = null;
            (semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = cd.CinemaHeaders;
            gvZoomedInCinemas.SelectionChanged += gvZoomedIn_SelectionChanged;

            semanticZoom.ViewChangeStarted -= semanticZoom_ViewChangeStarted;
            semanticZoom.ViewChangeStarted += semanticZoom_ViewChangeStarted;

            if (tYouTube != null)
            {
                try
                {
                    this.trailerUrl = await tYouTube;
                }
                catch { }
            }

            this.btnTrailer.Visibility = btnPlay.Visibility = (trailerUrl != null ? Windows.UI.Xaml.Visibility.Visible : Windows.UI.Xaml.Visibility.Collapsed);
            this.mpTrailer.Visibility  = Windows.UI.Xaml.Visibility.Collapsed;

            //if(taskFilmReviews != null)
            //    await taskFilmReviews;
        }
        //
        //Get Profile Connection cost
        //
        string GetConnectionCostInfo(ConnectionCost connectionCost)
        {
            string cost = string.Empty;

            cost += "Connection Cost Information: \n";
            cost += "====================\n";

            if (connectionCost == null)
            {
                cost += "Connection Cost not available\n";
                return(cost);
            }

            switch (connectionCost.NetworkCostType)
            {
            case NetworkCostType.Unrestricted:
                cost += "Cost: Unrestricted";
                break;

            case NetworkCostType.Fixed:
                cost += "Cost: Fixed";
                break;

            case NetworkCostType.Variable:
                cost += "Cost: Variable";
                break;

            case NetworkCostType.Unknown:
                cost += "Cost: Unknown";
                break;

            default:
                cost += "Cost: Error";
                break;
            }
            cost += "\n";
            cost += "Roaming: " + connectionCost.Roaming + "\n";
            cost += "Over Data Limit: " + connectionCost.OverDataLimit + "\n";
            cost += "Approaching Data Limit : " + connectionCost.ApproachingDataLimit + "\n";

            //Display cost based suggestions to the user
            cost += CostBasedSuggestions(connectionCost);
            return(cost);
        }
        //
        //Get Connection Profile name and cost information
        //
        string GetConnectionProfile(ConnectionProfile connectionProfile)
        {
            string connectionProfileInfo = string.Empty;

            if (connectionProfile != null)
            {
                connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n";

                switch (connectionProfile.GetNetworkConnectivityLevel())
                {
                case NetworkConnectivityLevel.None:
                    connectionProfileInfo += "Connectivity Level : None\n";
                    break;

                case NetworkConnectivityLevel.LocalAccess:
                    connectionProfileInfo += "Connectivity Level : Local Access\n";
                    break;

                case NetworkConnectivityLevel.ConstrainedInternetAccess:
                    connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n";
                    break;

                case NetworkConnectivityLevel.InternetAccess:
                    connectionProfileInfo += "Connectivity Level : Internet Access\n";
                    break;
                }

                //Get Connection Cost information
                ConnectionCost connectionCost = connectionProfile.GetConnectionCost();
                connectionProfileInfo += GetConnectionCostInfo(connectionCost);

                //Get Dataplan Status information
                DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus();
                connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus);

                //Get Network Security Settings
                NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings;
                connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings);
            }
            return(connectionProfileInfo);
        }
        //
        //Get Connection Profile name and cost information
        //
        string GetConnectionProfile(ConnectionProfile connectionProfile)
        {
            string connectionProfileInfo = string.Empty;

            if (connectionProfile != null)
            {
                connectionProfileInfo = "Profile Name : " + connectionProfile.ProfileName + "\n";

                switch (connectionProfile.GetNetworkConnectivityLevel())
                {
                case NetworkConnectivityLevel.None:
                    connectionProfileInfo += "Connectivity Level : None\n";
                    break;

                case NetworkConnectivityLevel.LocalAccess:
                    connectionProfileInfo += "Connectivity Level : Local Access\n";
                    break;

                case NetworkConnectivityLevel.ConstrainedInternetAccess:
                    connectionProfileInfo += "Connectivity Level : Constrained Internet Access\n";
                    break;

                case NetworkConnectivityLevel.InternetAccess:
                    connectionProfileInfo += "Connectivity Level : Internet Access\n";
                    break;
                }

                switch (connectionProfile.GetDomainConnectivityLevel())
                {
                case DomainConnectivityLevel.None:
                    connectionProfileInfo += "Domain Connectivity Level : None\n";
                    break;

                case DomainConnectivityLevel.Unauthenticated:
                    connectionProfileInfo += "Domain Connectivity Level : Unauthenticated\n";
                    break;

                case DomainConnectivityLevel.Authenticated:
                    connectionProfileInfo += "Domain Connectivity Level : Authenticated\n";
                    break;
                }

                //Get Connection Cost information
                ConnectionCost connectionCost = connectionProfile.GetConnectionCost();
                connectionProfileInfo += GetConnectionCostInfo(connectionCost);

                //Get Dataplan Status information
                DataPlanStatus dataPlanStatus = connectionProfile.GetDataPlanStatus();
                connectionProfileInfo += GetDataPlanStatusInfo(dataPlanStatus);

                //Get Network Security Settings
                NetworkSecuritySettings netSecuritySettings = connectionProfile.NetworkSecuritySettings;
                connectionProfileInfo += GetNetworkSecuritySettingsInfo(netSecuritySettings);

                //Get Wlan Connection Profile Details if this is a Wlan ConnectionProfile
                if (connectionProfile.IsWlanConnectionProfile)
                {
                    WlanConnectionProfileDetails wlanConnectionProfileDetails = connectionProfile.WlanConnectionProfileDetails;
                    connectionProfileInfo += GetWlanConnectionProfileDetailsInfo(wlanConnectionProfileDetails);
                }

                //Get Wwan Connection Profile Details if this is a Wwan ConnectionProfile
                if (connectionProfile.IsWwanConnectionProfile)
                {
                    WwanConnectionProfileDetails wwanConnectionProfileDetails = connectionProfile.WwanConnectionProfileDetails;
                    connectionProfileInfo += GetWwanConnectionProfileDetailsInfo(wwanConnectionProfileDetails);
                }

                //Get the Service Provider GUID
                if (connectionProfile.ServiceProviderGuid.HasValue)
                {
                    connectionProfileInfo += "====================\n";
                    connectionProfileInfo += "Service Provider GUID: " + connectionProfile.ServiceProviderGuid + "\n";
                }

                //Get the number of signal bars
                if (connectionProfile.GetSignalBars().HasValue)
                {
                    connectionProfileInfo += "====================\n";
                    connectionProfileInfo += "Signal Bars: " + connectionProfile.GetSignalBars() + "\n";
                }
            }
            return(connectionProfileInfo);
        }
Exemplo n.º 9
0
        /// <inheritdoc/>
        public bool IsInternetCostFree()
        {
            ConnectionCost cost = NetworkInformation.GetInternetConnectionProfile()?.GetConnectionCost();

            return((cost != null) && (cost.NetworkCostType == NetworkCostType.Unrestricted));
        }