vb.net print barcode free WEBPOK: THE WEB FORMS-BASED POKER MACHINE in Visual C#.NET

Creation Data Matrix ECC200 in Visual C#.NET WEBPOK: THE WEB FORMS-BASED POKER MACHINE

WEBPOK: THE WEB FORMS-BASED POKER MACHINE
Paint Data Matrix 2d Barcode In C#.NET
Using Barcode creator for .NET Control to generate, create DataMatrix image in Visual Studio .NET applications.
www.OnBarcode.com
Recognize ECC200 In Visual C#.NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
runat="server"/> </asp:tableCell> </asp:tablerow> </asp:table> <asp:label id="handLabel" visible="false" runat="server"/> </form> <center> </body> </html>
PDF-417 2d Barcode Maker In C#
Using Barcode printer for .NET Control to generate, create PDF-417 2d barcode image in .NET framework applications.
www.OnBarcode.com
UPC-A Generator In C#
Using Barcode creator for .NET framework Control to generate, create UPC-A Supplement 2 image in VS .NET applications.
www.OnBarcode.com
As you can see, the markup is very simple. When the page is first loaded, we display the backs of the cards and tell the user Click DEAL to Start. Also, we have just one event handler in the page, which deals and draws cards:
UCC-128 Generation In Visual C#
Using Barcode creator for Visual Studio .NET Control to generate, create UCC - 12 image in .NET applications.
www.OnBarcode.com
Barcode Maker In C#
Using Barcode generator for .NET Control to generate, create Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
<asp:button id="dealDrawButton" ... OnClick="dealDrawHandler" .../>
Encode EAN13 In Visual C#.NET
Using Barcode creation for Visual Studio .NET Control to generate, create EAN13 image in VS .NET applications.
www.OnBarcode.com
Printing Bookland EAN In Visual C#.NET
Using Barcode maker for .NET Control to generate, create Bookland EAN image in .NET applications.
www.OnBarcode.com
The dealDrawHandler is contained in the code behind the form, shown in listing 8.24.
Encode DataMatrix In VS .NET
Using Barcode generator for .NET framework Control to generate, create Data Matrix image in .NET framework applications.
www.OnBarcode.com
Printing ECC200 In Java
Using Barcode printer for Java Control to generate, create DataMatrix image in Java applications.
www.OnBarcode.com
Listing 8.24 The WebPok Web Form code
GS1 DataBar Truncated Generation In Java
Using Barcode creator for Java Control to generate, create GS1 DataBar Limited image in Java applications.
www.OnBarcode.com
Code 39 Printer In None
Using Barcode creator for Font Control to generate, create Code 39 image in Font applications.
www.OnBarcode.com
// file : WebPok.cs // This is the codebehind logic for WebPok.aspx. namespace Poker { using System; using System.Web.UI; using System.Web.UI.WebControls; public class WebPok : System.Web.UI.Page { protected void dealDrawHandler(object Source, EventArgs e) { Hand h; if (dealDrawButton.Text == "DEAL") { // deal... h = new SimpleMachine().Deal(); handLabel.Text = h.Text; card1.ImageUrl="images/" + h.CardName(1) + ".gif"; card2.ImageUrl="images/" + h.CardName(2) + ".gif"; card3.ImageUrl="images/" + h.CardName(3) + ".gif"; card4.ImageUrl="images/" + h.CardName(4) + ".gif"; card5.ImageUrl="images/" + h.CardName(5) + ".gif"; enableCheckBoxes(true); clearCheckBoxes(); dealDrawButton.Text = "DRAW"; messageLabel.Text = "Hold Cards and Click DRAW";
Creating Barcode In None
Using Barcode maker for Online Control to generate, create Barcode image in Online applications.
www.OnBarcode.com
GTIN - 128 Creation In Objective-C
Using Barcode drawer for iPad Control to generate, create GTIN - 128 image in iPad applications.
www.OnBarcode.com
CREATING THE WEB FORMS USER INTERFACE
EAN13 Encoder In None
Using Barcode generator for Excel Control to generate, create EAN-13 image in Microsoft Excel applications.
www.OnBarcode.com
QR Code JIS X 0510 Creator In VS .NET
Using Barcode generation for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications.
www.OnBarcode.com
return; } // draw... string holdCards = ""; if (hold1.Checked) holdCards += "1"; if (hold2.Checked) holdCards += "2"; if (hold3.Checked) holdCards += "3"; if (hold4.Checked) holdCards += "4"; if (hold5.Checked) holdCards += "5"; h = new SimpleMachine().Draw(handLabel.Text, holdCards); card1.ImageUrl="images/" + h.CardName(1) + ".gif"; card2.ImageUrl="images/" + h.CardName(2) + ".gif"; card3.ImageUrl="images/" + h.CardName(3) + ".gif"; card4.ImageUrl="images/" + h.CardName(4) + ".gif"; card5.ImageUrl="images/" + h.CardName(5) + ".gif"; dealDrawButton.Text = "DEAL"; enableCheckBoxes(false); messageLabel.Text = h.Title + " (Scores " + h.Score + ")"; } private void enableCheckBoxes(bool flag) { hold1.Enabled = hold2.Enabled = hold3.Enabled = hold4.Enabled = hold5.Enabled = flag; } private void clearCheckBoxes() { hold1.Checked = hold2.Checked = hold3.Checked = hold4.Checked = hold5.Checked = false; } protected protected protected protected } } Button dealDrawButton; Label handLabel,messageLabel; Image card1, card2, card3, card4, card5; CheckBox hold1, hold2, hold3, hold4, hold5;
Create Linear In VS .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create Linear image in .NET framework applications.
www.OnBarcode.com
Barcode Printer In None
Using Barcode maker for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
The WebPok class consists of the dealDrawHandler method and a couple of utility methods for clearing and enabling/disabling the check boxes. Since we don t allow betting, we use the Poker.SimpleMachine class which supports dealing and drawing only. The dealDrawHandler method checks the caption of the button. If it is DEAL, it deals cards. Otherwise cards are drawn.
USS Code 128 Generator In VS .NET
Using Barcode generator for ASP.NET Control to generate, create USS Code 128 image in ASP.NET applications.
www.OnBarcode.com
Generate Code 128C In None
Using Barcode printer for Office Word Control to generate, create Code 128A image in Microsoft Word applications.
www.OnBarcode.com
WEBPOK: THE WEB FORMS-BASED POKER MACHINE
MOBPOK: THE MOBILE INTERNET-BASED POKER MACHINE
At the time of writing, Microsoft was providing the Mobile Internet Toolkit for .NET as a separate download. The toolkit consists of a set of classes in the System.Web.Mobile and System.Web.UI.MobileControls namespaces, deployed in the System.Web.Mobile.dll assembly. A mobile Web Form is a specialized type of ASP.NET Web Form containing mobile server controls. Like regular Web Forms, mobile Web Forms are stored as .aspx pages. The chief advantage of the mobile Web Forms infrastructure is that it can detect supported mobile devices and render a page to suit a device s capabilities. We re going to develop a simple mobile interface to the poker game. Figure 8.19 shows the game in play using the UP.Simulator from Openwave Systems. (See http://developer.openwave.com.) To hold cards, we ll use the approach used in ConPok, so that the user can hold cards by entering card numbers using the numeric phone keypad. Listing 8.25 presents the mobile markup for the UI.
Playing MobPok
Listing 8.25 The MobPok Web Form
<!-- MobPok.aspx --> <%@ Page Language="C#" Inherits="Poker.MobPok" Src="MobPok.cs" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <mobile:Form runat="server"> <mobile:label runat="server" text=".NET Video Poker"/> <mobile:label runat="server" id="messageLabel" text="Click DEAL"/>
CREATING THE WEB FORMS USER INTERFACE
<mobile:label runat="server" id="handLabel"/> <mobile:textbox runat="server" id="holdTextBox" numeric="true" maxLength="5" size="5" visible="false"/> <mobile:command runat="server" id="dealDrawCommand" text="DEAL" OnClick="dealDrawHandler"/> </mobile:form>
As you can see, the markup is very simple. We start by registering the mobile tag prefix to tell ASP.NET the names of the namespace and assembly where the mobile controls reside. Then, we use just three labels, a text box, and a command button to present the user interface. The code behind the page is shown in Listing 8.26.
Listing 8.26 The MobPok Web Form code
// file : MobPok.cs // This is the codebehind logic for MobPok.aspx. namespace Poker { using System; using System.Web.UI.MobileControls; public class MobPok : System.Web.UI.MobileControls.MobilePage { protected void dealDrawHandler(object Source, EventArgs e) { Hand h; if (dealDrawCommand.Text == "DEAL") { // deal... h = new SimpleMachine().Deal(); handLabel.Text = h.Text; dealDrawCommand.Text = "DRAW"; holdTextBox.Visible = true; holdTextBox.Text = " "; messageLabel.Text = "Hold and Draw"; return; } // draw... string holdCards = holdTextBox.Text; h = new SimpleMachine().Draw(handLabel.Text, holdCards); handLabel.Text = h.Text; dealDrawCommand.Text = "DEAL"; holdTextBox.Visible = false;
Copyright © OnBarcode.com . All rights reserved.