private void connectToMessageBoard() { try { // Configure the ABCs of using the MessageBoard service DuplexChannelFactory <IShoe> channel = new DuplexChannelFactory <IShoe>(this, "ShoeEndPoint"); // Activate a MessageBoard object shoe = channel.CreateChannel(); if (shoe.Join(nameTxtBox.Text)) { // Alias accepted by the service so update GUI boardListBox.ItemsSource = shoe.GetAllMessages(); playersListBox.ItemsSource = shoe.GetAllPlayers(); nameTxtBox.IsEnabled = nameSetBtn.IsEnabled = false; } else { // Alias rejected by the service so nullify service proxies shoe = null; MessageBox.Show("ERROR: Alias in use. Please try again."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Open() { Console.WriteLine(" ...::: Welcome to the SHOUTIQUE :::..."); Console.WriteLine("Please Select one of the following options:"); var exit = false; while (!exit) { Console.WriteLine("1) List of all the shoes 2) Order your favourite shoe 3) Exit "); var selectedOption = Console.ReadLine(); switch (selectedOption) { case "1": Console.WriteLine("Please select from the following options:"); Console.WriteLine("1> Boots 2> Sneakers 3> Sandals 4> Slippers 5> Oxford"); ChooseOneFromList(); break; case "2": IShoe shoe = CreateCustomShoe(); PrintShoeDetails(shoe); break; case "3": Console.WriteLine("GOODBYE"); exit = true; break; default: Console.WriteLine("You didn't choose a valid option!"); break; } } }
private void AddToBasket(IShoe shoe) { Console.WriteLine(" <ADD TO CART>"); _store.ShoppingBasket.Add(shoe); decimal total = _store.Checkout(); Console.WriteLine("Total to Pay: £" + total + ".00 "); }
public override void display() { string shoeChoice; string materialChoice; double shoeSize; double leatherPrice = 0.20; double syntheticPrice = 0.10; Console.WriteLine("Bonjour, Quelle type de Chaussure voulez vous ?"); Console.WriteLine("1 - Sandale | 2 Basket"); shoeChoice = Console.ReadLine(); Console.WriteLine("En quel materiaux les voulez vous ?"); Console.WriteLine("1 - Cuir | 2 Synthetique"); materialChoice = Console.ReadLine(); Console.WriteLine("Quelle est votre pointure ?"); shoeSize = Int32.Parse(Console.ReadLine()); if (shoeChoice.Equals("1") || shoeChoice.Equals("2")) { switch (shoeChoice) { case "1": switch (materialChoice) { case "1": shoe = (Sandal)ShoeCreator.CreateLeatherSandal(); price = shoe.getPrice() + (shoeSize * leatherPrice); break; case "2": shoe = (Sandal)ShoeCreator.CreateSyntheticSandal(); price = shoe.getPrice() + (shoeSize * syntheticPrice); break; } break; case "2": switch (materialChoice) { case "1": shoe = (StreetShoe)ShoeCreator.CreateLeatherShoe(); price = shoe.getPrice() + (shoeSize * leatherPrice); break; case "2": shoe = (StreetShoe)ShoeCreator.CreateSyntheticShoe(); price = shoe.getPrice() + (shoeSize * syntheticPrice); break; } shoe = (StreetShoe)shoe; break; } Console.WriteLine("Merci d'avoir attendu"); Console.WriteLine("Vos " + shoe.getName() + " sont prête, merci de payer: " + price); Client.Client.GetInstance().DeductMoney(price); } }
public GameState(IShoe shoe) { Players = new ConcurrentBag <Player>(); Dealer = new Player { PlayerID = Guid.NewGuid(), Bankroll = double.MaxValue }; Shoe = shoe; TableID = Guid.NewGuid(); }
public IEnumerable<uint> PlayHand(IShoe _shoe) { var cardsDealt = new List<uint>(); while (Hand.HandValue < 17) { var card = _shoe.CardRequest(); Hand.Cards.Add(card); cardsDealt.Add(card); } return cardsDealt; }
public Dealer(IEnumerator<IPlayer> players, int numberOfRounds, int numberOfDecksToBeUsed, int tableMinBet, int tableMaxBet, Percent whenToShuffle) { //////Do(new InitialCards().Deal(), new PlayCollection()); _shoe = new Shoe(numberOfDecksToBeUsed, whenToShuffle); _shoe.AnnounceTimeToShuffle += ShoeOnAnnounceTimeToShuffle; //Table.TableMaxBet = tableMaxBet; //Table.TableMinBet = tableMinBet; //_players = players; _numberOfRounds = numberOfRounds; _dealersCards = new List<uint>(); // TheCount.CurrentCount = 0; }
static void Main(string[] args) { var shoeFactory = new ShoeFactory(); IShoe boot = shoeFactory.ProduceShoe(ShoeType.Boot); boot.TypeInfo(); IShoe sneaker = shoeFactory.ProduceShoe(ShoeType.Sneaker); sneaker.TypeInfo(); IShoe spikes = shoeFactory.ProduceShoe(ShoeType.Spikes); spikes.TypeInfo(); }
public IEnumerable<uint> DealToDealer(List<uint> dealerHand, IShoe theshoe, ICardHelper cardHelper, IBasicStrategy basicStrategy ) { var cardsAddedToDealer = new List<uint>(); if (!cardHelper.IsBlackJack(dealerHand[0], dealerHand[1])) { var handValue = basicStrategy.DetermineHandValue(dealerHand); var value = handValue.Value; while (value <= 17) { var card = theshoe.GiveMeSomeCards(1)[0]; cardsAddedToDealer.Add(card); dealerHand.Add(card); handValue = basicStrategy.DetermineHandValue(dealerHand); value = handValue.Value; } } return cardsAddedToDealer; }
private void PrintShoeDetails(IShoe shoe) { Console.WriteLine($"You have Selected a {shoe.Colour} {shoe.Type} of size {shoe.Size} and it will cost you £{shoe.Price}.00"); Console.WriteLine("Add to basket? [] Y [] N"); var buyOrLeave = Console.ReadLine(); switch (buyOrLeave) { case "y": AddToBasket(shoe); break; case "n": Console.WriteLine("Thanks for visiting SHOUTIQUE"); break; default: Console.WriteLine("GOODBYE"); break; } }
private void ChooseOneFromList() { var selectedShoe = Console.ReadLine(); Console.WriteLine("What's your shoe size?"); var sizeSelected = Console.ReadLine(); IShoe shoe = null; switch (selectedShoe) { case "1": shoe = new Boots(sizeSelected); break; case "2": shoe = new Sneakers(sizeSelected); break; case "3": shoe = new Sandals(sizeSelected); break; case "4": shoe = new Slippers(sizeSelected); break; case "5": shoe = new Oxford(sizeSelected); break; default: Console.WriteLine("You didn't choose a valid option!"); break; } if (shoe != null) { PrintShoeDetails(shoe); } }
// ******************* Helper methods ********************** private void connectToCardTable() { try { // Connect to the Shoe service using DUPLEX channel (for callbacks) DuplexChannelFactory <IShoe> channel = new DuplexChannelFactory <IShoe>(this, "ShoeEndPoint"); shoe = channel.CreateChannel(); if (shoe.Join(txtAlias.Text)) { // Deal two cards to each player and the dealer in the first round for (int i = 0; i < 2; i++) { Card card = shoe.Deal(); // Update the current player info myLstCards.Items.Insert(0, card); } UpdateCurrentPlayerInfo(CalculatePoints()); txtAlias.IsEnabled = btnSet.IsEnabled = false; } else { // Alias rejected by the service so nullify service proxies shoe = null; txtAlias.IsEnabled = btnSet.IsEnabled = true; MessageBox.Show("ERROR: Alias in use. Please try again."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void DealInitialCardsToDealer(List<uint> dealerCards, IShoe theshoe, ITable table) { dealerCards.Clear(); dealerCards.AddRange(theshoe.GiveMeSomeCards(2)); table.AddCardToVisibleCards(dealerCards[0]); }