/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            NetworkUsageStates    = new NetworkUsageStates();
            StartTimePicker.Time -= TimeSpan.FromHours(1);
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            NetworkUsageStates result = new NetworkUsageStates {
                Roaming = roaming, Shared = shared
            };

            WriteObject(result);
        }
예제 #3
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            NetworkUsageStates   = new NetworkUsageStates();
            StartDatePicker.Date = DateTimeOffset.Now;
            EndDatePicker.Date   = DateTimeOffset.Now;
            StartTimePicker.Time = DateTimeOffset.Now.TimeOfDay.Subtract(new TimeSpan(0, 0, 10, 0));
            EndTimePicker.Time   = DateTimeOffset.Now.TimeOfDay;
        }
예제 #4
0
 private async Task <NetworkUsage> GetDataUsegesAsync(DateTime startDate, DateTime endDate, ConnectionProfile internetConnectionProfile)
 {
     try
     {
         NetworkUsageStates NetworkUsageStates = new NetworkUsageStates();
         NetworkUsageStates.Roaming = TriStates.DoNotCare;
         NetworkUsageStates.Shared  = TriStates.DoNotCare;
         return((await internetConnectionProfile.GetNetworkUsageAsync(startDate, endDate, DataUsageGranularity.Total, NetworkUsageStates)).FirstOrDefault());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();

            NetworkUsageStates = new NetworkUsageStates();
        }
        public static IReadOnlyList <ProviderNetworkUsage> GetProviderNetworkUsage(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
        {
            Task <IReadOnlyList <ProviderNetworkUsage> > task = Task.Run(() => GetProviderNetworkUsageSync(connectionProfile, startTime, endTime, networkUsageStates));

            return(task.Result);
        }
 public static async Task <IReadOnlyList <ProviderNetworkUsage> > GetProviderNetworkUsageSync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
 {
     return(await GetProviderNetworkUsageAsync(connectionProfile, startTime, endTime, networkUsageStates));
 }
 static async Task <IReadOnlyList <ConnectivityInterval> > GetConnectivityIntervalsSync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
 {
     return(await GetConnectivityIntervalsAsync(connectionProfile, startTime, endTime, networkUsageStates));
 }
 public static async Task <IReadOnlyList <NetworkUsage> > GetNetworkUsageSync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates networkUsageStates)
 {
     return(await GetNetworkUsageAsync(connectionProfile, startTime, endTime, granularity, networkUsageStates));
 }
        private static async Task <IReadOnlyList <ConnectivityInterval> > GetConnectivityIntervalsAsync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
        {
            try
            {
                DateTimeOffset StartTimeOffset = new DateTimeOffset(startTime);
                DateTimeOffset EndTimeOffset   = new DateTimeOffset(endTime);

                return(await connectionProfile.GetConnectivityIntervalsAsync(StartTimeOffset, EndTimeOffset, networkUsageStates));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private static async Task <IReadOnlyList <NetworkUsage> > GetNetworkUsageAsync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates networkUsageStates)
        {
            try
            {
                DateTimeOffset StartTimeOffset = new DateTimeOffset(startTime);
                DateTimeOffset EndTimeOffset   = new DateTimeOffset(endTime);

                return(await connectionProfile.GetNetworkUsageAsync(StartTimeOffset, EndTimeOffset, granularity, networkUsageStates));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static IReadOnlyList <ConnectivityInterval> GetConnectivityIntervals(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
        {
            Task <IReadOnlyList <ConnectivityInterval> > task = Task.Run(() => GetConnectivityIntervalsSync(connectionProfile, startTime, endTime, networkUsageStates));

            return(task.Result);
        }
 private static async Task <IReadOnlyList <Windows.Networking.Connectivity.AttributedNetworkUsage> > GetAttributedNetworkUsageAsync(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, NetworkUsageStates networkUsageStates)
 {
     try
     {
         DateTimeOffset StartTimeOffset = new DateTimeOffset(startTime);
         DateTimeOffset EndTimeOffset   = new DateTimeOffset(endTime);
         return(await connectionProfile.GetAttributedNetworkUsageAsync(StartTimeOffset, EndTimeOffset, networkUsageStates));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static IReadOnlyList <NetworkUsage> GetNetworkUsage(ConnectionProfile connectionProfile, DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates networkUsageStates)
        {
            Task <IReadOnlyList <NetworkUsage> > task = Task.Run(() => GetNetworkUsageSync(connectionProfile, startTime, endTime, granularity, networkUsageStates));

            return(task.Result);
        }