C# Class MBC.App.WPF.FieldControl

The FieldControl class is a WPF control that graphically displays the state of a Field object. The FieldControl must be given the IBattleshipController index that is being displayed on this Field. Usage of this class is simple by utilizing three class members: SetController(int) - Sets the controller index in a Field. SetField(Field) - Sets the Field to display. UpdateFieldDisplay() - Updates the FieldControl to display the Field's current state.
Inheritance: System.Windows.Controls.UserControl
ファイルを表示 Open project: aiclub/Mohawk_Battleship

Public Properties

Property Type Description
ControllerColorProperty System.Windows.DependencyProperty

Public Methods

Method Description
SetController ( int ibc ) : void
UpdateFieldDisplay ( ) : void

Private Methods

Method Description
CreateShips ( ) : void

Creates the graphics that represent the ships that will be displayed. Internally used.

FieldControl ( ) : System
FieldLoaded ( object sender, RoutedEventArgs e ) : void

Invoked when the FieldControl has been loaded into the WPF interface.

LayShips ( ) : void

Sets the Rectangle objects that represent the ships that will be displayed. Internally used.

LayShots ( ) : void

Sets the Ellipse objects that represent the opponent controller's shots which will be displayed on the grid. Internally used.

MakeGrid ( int rows, int cols ) : void

Generates the WPF grid with a specified number of rows and columns. Internally used.

Method Details

SetController() public method

public SetController ( int ibc ) : void
ibc int
return void

UpdateFieldDisplay() public method

public UpdateFieldDisplay ( ) : void
return void

Property Details

ControllerColorProperty public_oe static_oe property

The Color property that this FieldControl uses to display a certain controller.
public static DependencyProperty,System.Windows ControllerColorProperty
return System.Windows.DependencyProperty