Esempio n. 1
0
        void ReleaseDesignerOutlets()
        {
            if (Binary_Label != null)
            {
                Binary_Label.Dispose();
                Binary_Label = null;
            }

            if (Binary_TextBox != null)
            {
                Binary_TextBox.Dispose();
                Binary_TextBox = null;
            }

            if (Clear_Button != null)
            {
                Clear_Button.Dispose();
                Clear_Button = null;
            }

            if (CS_Label != null)
            {
                CS_Label.Dispose();
                CS_Label = null;
            }

            if (Decimal_Label != null)
            {
                Decimal_Label.Dispose();
                Decimal_Label = null;
            }

            if (Decimal_TextBox != null)
            {
                Decimal_TextBox.Dispose();
                Decimal_TextBox = null;
            }

            if (Hexadecimal_Label != null)
            {
                Hexadecimal_Label.Dispose();
                Hexadecimal_Label = null;
            }

            if (Hexadecimal_TextBox != null)
            {
                Hexadecimal_TextBox.Dispose();
                Hexadecimal_TextBox = null;
            }

            if (String_Label != null)
            {
                String_Label.Dispose();
                String_Label = null;
            }

            if (String_TextBox != null)
            {
                String_TextBox.Dispose();
                String_TextBox = null;
            }
        }
Esempio n. 2
0
        void ReleaseDesignerOutlets()
        {
            if (Binary_Label != null)
            {
                Binary_Label.Dispose();
                Binary_Label = null;
            }

            if (Binary_TextBox != null)
            {
                Binary_TextBox.Dispose();
                Binary_TextBox = null;
            }

            if (Clear_Button != null)
            {
                Clear_Button.Dispose();
                Clear_Button = null;
            }

            if (Converter != null)
            {
                Converter.Dispose();
                Converter = null;
            }

            if (CSC_Label != null)
            {
                CSC_Label.Dispose();
                CSC_Label = null;
            }

            if (Decimal_Label != null)
            {
                Decimal_Label.Dispose();
                Decimal_Label = null;
            }

            if (Decimal_TextBox != null)
            {
                Decimal_TextBox.Dispose();
                Decimal_TextBox = null;
            }

            if (Hex_TextBox != null)
            {
                Hex_TextBox.Dispose();
                Hex_TextBox = null;
            }

            if (Hexadecimal_label != null)
            {
                Hexadecimal_label.Dispose();
                Hexadecimal_label = null;
            }

            if (Octal_Label != null)
            {
                Octal_Label.Dispose();
                Octal_Label = null;
            }

            if (Octal_TextBox != null)
            {
                Octal_TextBox.Dispose();
                Octal_TextBox = null;
            }

            if (TwosComplamentLabel != null)
            {
                TwosComplamentLabel.Dispose();
                TwosComplamentLabel = null;
            }

            if (TwosComplamentSwitch != null)
            {
                TwosComplamentSwitch.Dispose();
                TwosComplamentSwitch = null;
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     Clear_Button.PerformClick();
     FormPanel.Show();
     Update_Button.Show();
 }
Esempio n. 4
0
        async public void Decision(bool Player_Bust = false, bool Dealer_Bust = false, bool Player_BJ = false, bool Dealer_BJ = false)
        {
            //Console.WriteLine("796: Player: " + Player_Current_Total + " Dealer: " + Dealer_Current_Total);
            if (Player_Bust)
            {
                // reset bet on loss
                Manage_Bet(Current_Bet, false, false);

                Player_Decision_TextBox.Text = "BUST";
                Player_Loss_Count++;
                Dealer_Win_Count++;
            }
            else if (Dealer_Bust)
            {
                Manage_Bet(Current_Bet, true, false);

                Dealer_Result_TextBox.Text   = "BUST";
                Player_Decision_TextBox.Text = "WIN";
                Player_Win_Count++;
                Dealer_Loss_Count++;
            }
            else if (Player_BJ)
            {
                Manage_Bet(Current_Bet, true, true);
                Player_Decision_TextBox.Text = "BLACKJACK";
                Player_Win_Count++;
                Dealer_Loss_Count++;
            }
            else if (Dealer_BJ)
            {
                Manage_Bet(Current_Bet, false, false);

                Dealer_Result_TextBox.Text   = "BLACKJACK";
                Player_Decision_TextBox.Text = "LOSS";
                Player_Loss_Count++;
                Dealer_Win_Count++;
            }
            // If method was called with no parameters (decision)
            else
            {
                if (Player_Current_Total > Dealer_Current_Total)
                {
                    Manage_Bet(Current_Bet, true, false);

                    Player_Decision_TextBox.Text = "WIN";
                    Player_Win_Count++;
                    Dealer_Loss_Count++;
                }
                else if (Player_Current_Total == Dealer_Current_Total)
                {
                    Manage_Bet(Current_Bet, false, false, true);

                    Player_Decision_TextBox.Text = "PUSH";
                    Push_Count++;
                }
                else
                {
                    Manage_Bet(Current_Bet, false, false);
                    // Console.WriteLine("854: " + "Player: " + Player_Current_Total + " Dealer: " + Dealer_Current_Total);
                    Player_Decision_TextBox.Text = "LOSS 2";
                    Player_Loss_Count++;
                    Dealer_Win_Count++;
                }
            }

            // delay to show table at the end of hand
            await Task.Delay(DELAY_TASK_TIME);

            //Thread.Sleep(1000);

            Clear_Button.Enabled  = true;
            Hit_Button.Enabled    = false;
            Double_Button.Enabled = false;
            Stand_Button.Enabled  = false;
            Deal_Button.Enabled   = false;

            Hand_Count++;

            Player_Wins_TextBox.Text   = Player_Win_Count.ToString();
            Player_Losses_TextBox.Text = Dealer_Win_Count.ToString();
            Dealer_Wins_TextBox.Text   = Dealer_Win_Count.ToString();
            Dealer_Losses_TextBox.Text = Player_Win_Count.ToString();
            Pushes_TextBox.Text        = Push_Count.ToString();
            No_Hands_TextBox.Text      = Hand_Count.ToString();

            // Console.WriteLine("         ===================================");
            Console.WriteLine("         Hands Dealt: " + Hand_Count);
            Console.WriteLine("         Current Bet: " + Current_Bet);
            Console.WriteLine("         Bet_TextBox: " + Bet_TextBox.Text);
            //  Console.WriteLine("         ===================================");


            //Decision_Reached = true;

            // updategraph
            Update_Graph();

            //Decision_Reached = true;

            Status_Label.Text = "Status: Round over.";
            //Console.WriteLine("Player Result TextBox: " + Player_Result_TextBox.Text);

            // perform clear_button
            //Console.WriteLine("CLEAR BUTTON CLICKED here 893");
            if (Status_Label.Text.Equals("Status: Round over."))
            {
                Console.WriteLine("End of hand ============================");
                // Console.WriteLine("DECISION REACHED!");
                //Thread.Sleep(2000);
                Clear_Button.PerformClick();
                Decision_Reached = true;

                // delay before dealing new hand
                if (!d.Is_Empty())
                {
                    await Task.Delay(DELAY_TASK_TIME);

                    Deal_Button.PerformClick();
                }
                else
                {
                    Display_Empty_Message();
                    return;
                }
            }
        }