예제 #1
0
        public MainForm()
        {
            InitializeComponent();

            m_panelFont                = new Font(FontFamily.GenericSerif, 16, FontStyle.Regular);
            m_whiteBrush               = new SolidBrush(Color.White);
            m_blackBrush               = new SolidBrush(Color.Black);
            pictureWhiteTime.Image     = new Bitmap(pictureWhiteTime.Width - 4, pictureWhiteTime.Height - 4);
            pictureBlackTime.Image     = new Bitmap(pictureBlackTime.Width - 4, pictureBlackTime.Height - 4);
            pictureStateMessages.Image = new Bitmap(pictureStateMessages.Width - 4, pictureStateMessages.Height - 4);
            m_whiteTimeGraphic         = Graphics.FromImage(pictureWhiteTime.Image);
            m_blackTimeGraphic         = Graphics.FromImage(pictureBlackTime.Image);
            m_messagesGraphic          = Graphics.FromImage(pictureStateMessages.Image);

            m_chessFacade    = new ChessFacade();
            m_graphicHandler = new BasicDesign(boardPicture);

            m_chessFacade.BoardChanged       += HandleBoardChangedEvent;
            m_chessFacade.WhitePawnPromoted  += HandleWhitePawnPromotedEvent;
            m_chessFacade.BlackPawnPromoted  += HandleBlackPawnPromotedEvent;
            m_chessFacade.StatusInfo         += HandleStateChangedEvent;
            m_chessFacade.WhiteClockNotifier += HandleWhiteTimeEvent;
            m_chessFacade.BlackClockNotifier += HandleBlackTimeEvent;
            OutputWriter.WriteOutput         += HandleWriteOutput;

            m_chessFacade.RaiseEvents();
            m_chessFacade.LoadOpeningBook();
        }