示例#1
0
        private void MainPageLoaded(object sender, RoutedEventArgs e)
        {
            var settings = IsolatedStorageSettings.ApplicationSettings;

            PolicyDown.LowThresholdMb = (int)settings["LowThreshold"];
            PolicyDown.MidThresholdMb = (int)settings["MidThreshold"];
            PolicyUp.LowThresholdMb   = (int)settings["LowThreshold"];
            PolicyUp.MidThresholdMb   = (int)settings["MidThreshold"];

            var lowThresholdMultipliedByDiscount = (int)settings["LowThreshold"] * Math.Pow(1 - ((int)settings["PctDiscount"]) / 100.0, -1);
            var midThresholdMultipliedByDiscount = (int)settings["MidThreshold"] * Math.Pow(1 - ((int)settings["PctDiscount"]) / 100.0, -1);

            ActualDown.LowThresholdMb = (int)lowThresholdMultipliedByDiscount;
            ActualDown.MidThresholdMb = (int)midThresholdMultipliedByDiscount;
            ActualUp.LowThresholdMb   = (int)lowThresholdMultipliedByDiscount;
            ActualUp.MidThresholdMb   = (int)midThresholdMultipliedByDiscount;

            if (settings.Contains("BandwidthClass"))
            {
                UpdateUi(BandwidthResults.RetrieveFromIsolatedStorage(), false);
            }

            var indicator = new ProgressIndicator
            {
                IsVisible       = true,
                Text            = "Updating usage...",
                IsIndeterminate = true
            };

            SystemTray.ProgressIndicator = indicator;

            Task.Run(() => Scraper.Scrape(this));
        }