Esempio n. 1
0
        private void showScanPage(object sender, RoutedEventArgs e)
        {
            //List models in descending order for uniformity
            NVIDIAWanted = NVIDIAWanted.OrderByDescending(x => x).ToList();
            AMDWanted    = AMDWanted.OrderByDescending(x => x).ToList();

            // Testing module.
            // Query will include pages where the items are always in stock.
            bool testing = true;

            if (testing)
            {
                NVIDIAWanted.Add("Test1");
                NVIDIAWanted.Add("Test2");
            }


            // If selection is valid, then transition into ScanPage
            if (isSelectionValid())
            {
                ScanPage sp = new ScanPage(NVIDIAWanted, AMDWanted);
                sp.AsyncInitUIM();
                this.NavigationService.Navigate(sp);

                Task.Delay(3000);
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => sp.start())).Wait();
            }
            // Selection is not valid (selection is null - no items chosen)
            // Error message should be displayed
            else
            {
                DisplayErrorMessage();
            }
        }
Esempio n. 2
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);
                }
            }
        }