Esempio n. 1
0
        // When a button is clicked, we need to check if this is the 1st click or 2nd click
        private void ButtonPressed(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            Debug.WriteLine(button.Background);
            string text = (string)button.Content;

            // Clicked NVIDIA model
            if (NVIDIAModels.Contains(text))
            {
                // Currently this model is contained in our wants query
                // This means this is a 2nd click, remove from list and revert button pressed ui
                if (NVIDIAWanted.Contains(text))
                {
                    SecondPress(button);
                    NVIDIAWanted.Remove(text);
                }
                // 1st click
                // Add to wanted list
                else
                {
                    FirstPress(button);
                    NVIDIAWanted.Add(text);
                }
            }
            // Repeat above but this is for AMD
            else if (AMDModels.Contains(text))
            {
                if (AMDWanted.Contains(text))
                {
                    SecondPress(button);
                    AMDWanted.Remove(text);
                }
                else
                {
                    FirstPress(button);
                    AMDWanted.Add(text);
                }
            }
        }