예제 #1
0
        public void CheckRight()
        {
            CardMatcher matcher = new CardMatcher();
            Card        card    = Items[2].Model.CardDetails;
            SystemCard  system  = OtherItems[0].Model.SystemCardDetails;

            if (matcher.CheckForMatch(card, system))
            {
                CorrectAnswer       = true;
                Model.PassFailImage = $"pack://application:,,,/Window;component/Images/Checkmark.png";
            }
            else
            {
                Model.PassFailImage = "pack://application:,,,/Window;component/Images/Red X.png";
            }
        }
예제 #2
0
        public PlayViewModel()
        {
            Model = new TabModel();
            CardDealer  dealer = new CardDealer();
            SystemCard  sensor = dealer.ChooseRandomSensor();
            List <Card> cards  = dealer.DealCardsForSensor(sensor);

            this.Items = new ObservableCollection <CardBaseViewModel>();
            this.Items.Add(new CardBaseViewModel(cards[0].Name));
            this.Items.Add(new CardBaseViewModel(cards[1].Name));
            this.Items.Add(new CardBaseViewModel(cards[2].Name));
            this.OtherItems = new ObservableCollection <SystemBaseViewModel>();
            this.OtherItems.Add(new SystemBaseViewModel(sensor.Name));

            SelectLeftCommand   = new ButtonCommand(this.CheckLeft, true);
            SelectMiddleCommand = new ButtonCommand(this.CheckMiddle, true);
            SelectRightCommand  = new ButtonCommand(this.CheckRight, true);
        }
예제 #3
0
 public SystemBaseModel(string System)
 {
     SystemCardDetails = new SystemCard();
     GenerateSystem(System);
 }
예제 #4
0
 public SystemBaseModel()
 {
     SystemCardDetails = new SystemCard();
 }
예제 #5
0
        static void Main(string[] args)
        {
            // Choose Test
            Console.WriteLine("account or gameElements?");
            string response1 = Console.ReadLine();

            // Test Accounts
            if (response1 == "account")
            {
                Console.WriteLine("read or write?");
                string response2 = Console.ReadLine();
                // Test Writing a New Account
                if (response2 == "write")
                {
                    Console.WriteLine("Beginning Write Test...");
                    AccountRecord   testRecord = new AccountRecord();
                    AccountDatabase database   = new AccountDatabase();
                    database.OpenConnection();
                    //request dummy data
                    Console.WriteLine("Please provide a username:"******"Please provide a password:"******"A duplicate exists.  No account was created.  Try a different name.");
                    }
                    database.CloseConnection();
                }
                // Test Reading an Existing Account
                else
                {
                    Console.WriteLine("Beginning Read Test...");
                    AccountRecord   testRecord = new AccountRecord();
                    AccountDatabase database   = new AccountDatabase();
                    database.OpenConnection();
                    //request dummy data
                    Console.WriteLine("Please provide a username:"******"Please provide a password:"******"Hello {testRecord.Username}!");
                    Console.WriteLine(testRecord.ErrorString);
                    database.CloseConnection();
                }
            }
            // Test Other Database Activity
            else
            {
                Console.WriteLine("Beginning Other Database Test...");
                CardDatabase  database = new CardDatabase();
                List <string> names    = new List <string>();
                database.OpenConnection();
                // Test Pull All String Names
                names = database.RequestAllGameElementNames();
                foreach (string name in names)
                {
                    Console.WriteLine(name);
                }
                Console.WriteLine("Test 1 Complete.");
                CardDealer  dealer = new CardDealer();
                List <Card> cards1 = dealer.ListAllCards();
                // Test Pull All Card Records
                List <Card> moreCards = new List <Card>();
                foreach (Card card2 in cards1)
                {
                    Console.WriteLine(card2.Name);
                }
                Console.WriteLine("Test 2 Complete.");
                // Test Pull a Specific Card Record
                SystemCard  sensor = dealer.ChooseRandomSensor();
                List <Card> cards6 = dealer.DealCardsForSensor(sensor);
                foreach (Card carde in cards6)
                {
                    Console.WriteLine(carde.Name);
                }
                Console.WriteLine(sensor.Name);
                Console.WriteLine("Please Provide the name of one of the cards above (type exactly):");
                CardRecord card = database.RequestCardByName(Console.ReadLine());
                Console.WriteLine($"{card.Name},{card.ADCType},{card.IsMultiplexed},{card.SignalConditioning}");

                database.CloseConnection();
            }
            Console.WriteLine("Nothing went wrong in this tests");
            Console.ReadLine();
        }