コード例 #1
0
        private async Task setDetails()
        {
            try
            {
                // Ensure that the information being presented is current
                bool loadedModelIsCurrent = model.modifiedDate == (await ServiceClient.GetModifiedDateAsync(model.name));
                if (!loadedModelIsCurrent)
                {
                    model = await ServiceClient.GetComputerModelAsync(model.name);
                }
            }
            catch (HttpRequestException)
            {
                showConnectionError();
            }

            lblName.Text            = $"{model.manufacturer} Desktop: {model.name}";
            lblPrice.Text           = $"Price: {model.price.ToString("C2")}";
            lblStock.Text           = $"Number Available: {model.quantity}";
            lblOperatingSystem.Text = $"Operating System: {model.operatingSystem}";
            lblMemory.Text          = $"RAM: {model.memory} Gigabytes";
            lblStorage.Text         = $"Storage: {model.storage} Gigabytes";
            lblProcessorFamily.Text = $"Processor: {model.processorFamily}";
            lblGraphicsFamily.Text  = $"Graphics: {model.graphicsFamily}";
            lblTowerSize.Text       = $"Tower Size: {model.towerForm}";
            lblPowerSupply.Text     = $"Power Supply: {model.powerSupply}";
        }
コード例 #2
0
        private async void setDetails()
        {
            try
            {
                // Ensure that the information being presented is current
                bool loadedModelIsCurrent = model.modifiedDate == (await ServiceClient.GetModifiedDateAsync(model.name));
                if (!loadedModelIsCurrent)
                {
                    model = await ServiceClient.GetComputerModelAsync(model.name);
                }
            }
            catch (HttpRequestException)
            {
                showConnectionError();
            }

            lblName.Text                  = $"{model.manufacturer} Laptop: {model.name}";
            lblPrice.Text                 = $"Price: {model.price.ToString("C2")}";
            lblStock.Text                 = $"Number Available: {model.quantity}";
            lblOperatingSystem.Text       = $"Operating System: {model.operatingSystem}";
            lblMemory.Text                = $"RAM: {model.memory} Gigabytes";
            lblStorage.Text               = $"Storage: {model.storage} Gigabytes";
            lblProcessorFamily.Text       = $"Processor: {model.processorFamily}";
            lblGraphicsFamily.Text        = $"Graphics: {model.graphicsFamily}";
            lblScreenSize.Text            = $"Tower Size: {model.screenSize}";
            lblBatteryLife.Text           = $"Power Supply: {model.batteryLife}";
            chbFullsizeKeyboard.IsChecked = model.fullsizeKeyboard;
            chbWebCamera.IsChecked        = model.webcamera;
        }
コード例 #3
0
        private async Task viewModel()
        {
            if (lbModels.SelectedItem != null)
            {
                try
                {
                    ComputerModel model      = (ComputerModel)lbModels.SelectedItem;
                    bool          itemExists = await ServiceClient.GetComputerModelExistsAsync(model.name);

                    if (itemExists)
                    {
                        // Navigate to form
                        if (detailPages.ContainsKey(model.type))
                        {
                            this.Frame.Navigate(detailPages[model.type], model);
                        }
                    }
                    else
                    {
                        showMessage("The selected item no longer exists.");
                        btnMessageGridOK.Click += btnMessageGridOK_ClickRefresh;
                    }
                }
                catch (HttpRequestException ex)
                {
                    showConnectionError();
                }
            }
        }
コード例 #4
0
        private void refreshModelDetails(ComputerModel model)
        {
            bool b = model != null;

            lblModel.Text  = $"Selected product: { (b? model.name: "")}";
            lblType.Text   = $"Computer Type: { (b? model.type: "")}";
            lblSystem.Text = $"Operating System: { (b? model.operatingSystem: "")}";
        }
コード例 #5
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.Parameter != null)
     {
         model = (ComputerModel)e.Parameter;
         setDetails();
     }
 }