Click here to Skip to main content
15,887,361 members
Home / Discussions / C#
   

C#

 
GeneralRe: Encrypt - Decrypt Pin
BobJanova12-Jul-12 23:39
BobJanova12-Jul-12 23:39 
Questionhow to use use transparent proxy(local host) in middle of browser and destination server?? Pin
modipavan12-Jul-12 0:03
modipavan12-Jul-12 0:03 
AnswerRe: how to use use transparent proxy(local host) in middle of browser and destination server?? Pin
Eddy Vluggen12-Jul-12 0:40
professionalEddy Vluggen12-Jul-12 0:40 
QuestionCookie based authentication - calling a get cookie script - cookiecollection empty Pin
psycik11-Jul-12 23:20
psycik11-Jul-12 23:20 
AnswerRe: Cookie based authentication - calling a get cookie script - cookiecollection empty Pin
BobJanova11-Jul-12 23:45
BobJanova11-Jul-12 23:45 
GeneralRe: Cookie based authentication - calling a get cookie script - cookiecollection empty Pin
psycik11-Jul-12 23:51
psycik11-Jul-12 23:51 
GeneralRe: Cookie based authentication - calling a get cookie script - cookiecollection empty Pin
BobJanova13-Jul-12 4:14
BobJanova13-Jul-12 4:14 
QuestionQuery on Delegate Pin
ashish711-Jul-12 21:23
ashish711-Jul-12 21:23 
I am going through one code and trying to understand the same.

There are two code file 1) PuzzleGame.cs and 2) PuzzlePage.cs, each contains class each and PuzzlePage.cs files consumes the class defined in PuzzleGame.cs.

Beloow is the snippet of code from both class, I have query on the bold code surrounded with the "*" and trying to understand what does it mean and how it needs to be interpreted.

Can someone make me understand in simple terms how this "+=" delgate is interpreted in the code and how it might be functioning.

1) PuzzleGame.cs:
public class PuzzleGame
{
private int colsAndRows;
private int[] board;
private int totalMoves;
private bool isPlaying;

public int ColsAndRows { get { return this.colsAndRows; } }
public int TotalMoves { get { return this.totalMoves; } }
public bool IsPlaying { get { return this.isPlaying; } }
public int[] BoardPieces { get { return this.board; } }


public PuzzleGame(int colsAndRows)
{
if (colsAndRows < 2)
{
throw new ArgumentOutOfRangeException("colsAndRows");
}

this.colsAndRows = colsAndRows;
int totalPieces = colsAndRows * colsAndRows;
this.board = new int[totalPieces];
this.Reset();
}

public EventHandler GameStarted;
public EventHandler<pieceupdatedeventargs> PieceUpdated;
public EventHandler<gameovereventargs> GameOver;

>>>>>>>>> further code after this.

2) PuzzlePage:
Constructor code snippet:

C#
***************************
this.game.GameStarted += delegate
           {
               this.ResetWinTransition.Begin();
               this.StatusPanel.Visibility = Visibility.Visible;
               this.TapToContinueTextBlock.Opacity = 0;
               this.TotalMovesTextBlock.Text = this.game.TotalMoves.ToString();
           };
**************************

******************************
           this.game.GameOver += delegate
           {
               this.WinTransition.Begin();
               this.TapToContinueTextBlock.Opacity = 1;
               this.StatusPanel.Visibility = Visibility.Visible;
               this.TotalMovesTextBlock.Text = this.game.TotalMoves.ToString();
           };
*******************************

**********************

           this.game.PieceUpdated +=  delegate(object sender, PieceUpdatedEventArgs args)
           {
               int pieceSize = ImageSize / this.game.ColsAndRows;
               this.AnimatePiece(this.puzzlePieces[args.PieceId], Canvas.LeftProperty, (int)args.NewPosition.X * pieceSize);
               this.AnimatePiece(this.puzzlePieces[args.PieceId], Canvas.TopProperty, (int)args.NewPosition.Y * pieceSize);
               this.TotalMovesTextBlock.Text = this.game.TotalMoves.ToString();
           };

**************************
AnswerRe: Query on Delegate Pin
OriginalGriff11-Jul-12 21:37
mveOriginalGriff11-Jul-12 21:37 
GeneralRe: Query on Delegate Pin
Simon_Whale11-Jul-12 22:27
Simon_Whale11-Jul-12 22:27 
GeneralRe: Query on Delegate Pin
ashish711-Jul-12 22:29
ashish711-Jul-12 22:29 
GeneralRe: Query on Delegate Pin
DaveyM6911-Jul-12 22:48
professionalDaveyM6911-Jul-12 22:48 
GeneralRe: Query on Delegate Pin
OriginalGriff11-Jul-12 22:55
mveOriginalGriff11-Jul-12 22:55 
GeneralRe: Query on Delegate Pin
ashish711-Jul-12 23:13
ashish711-Jul-12 23:13 
GeneralRe: Query on Delegate Pin
Pete O'Hanlon11-Jul-12 23:23
mvePete O'Hanlon11-Jul-12 23:23 
GeneralRe: Query on Delegate Pin
BobJanova11-Jul-12 23:41
BobJanova11-Jul-12 23:41 
GeneralRe: Query on Delegate Pin
Pete O'Hanlon11-Jul-12 22:50
mvePete O'Hanlon11-Jul-12 22:50 
GeneralRe: Query on Delegate Pin
OriginalGriff11-Jul-12 22:56
mveOriginalGriff11-Jul-12 22:56 
GeneralRe: Query on Delegate Pin
DaveyM6911-Jul-12 22:57
professionalDaveyM6911-Jul-12 22:57 
GeneralRe: Query on Delegate Pin
Wayne Gaylard11-Jul-12 23:02
professionalWayne Gaylard11-Jul-12 23:02 
GeneralRe: Query on Delegate Pin
ashish712-Jul-12 2:15
ashish712-Jul-12 2:15 
GeneralRe: Query on Delegate Pin
OriginalGriff12-Jul-12 2:23
mveOriginalGriff12-Jul-12 2:23 
GeneralRe: Query on Delegate Pin
ashish712-Jul-12 2:32
ashish712-Jul-12 2:32 
GeneralRe: Query on Delegate Pin
ashish712-Jul-12 2:44
ashish712-Jul-12 2:44 
QuestionRe: Query on Delegate Pin
DaveyM6912-Jul-12 3:22
professionalDaveyM6912-Jul-12 3:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.