Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            GamesRepository mygame    = new Octgn.Data.GamesRepository();
            int             gamecount = mygame.Games.Count;

            if (gamecount > 1)
            {
                GameSelection chooserForm = new GameSelection();
                chooserForm.gameList = new string[gamecount];
                for (int i = 0; i < gamecount; i++)
                {
                    chooserForm.gameList[i] = mygame.Games[i].Name;
                }
                chooserForm.ShowDialog();
                gameindex = chooserForm.GameIndex;
            }

            Game octgnGame = proxy.Games[gameindex];

            try
            {
                // Retrieve Card Image
                System.Windows.Controls.Image CardImage = new System.Windows.Controls.Image();
                BitmapImage src = new BitmapImage();
                src.BeginInit();
                src.UriSource   = octgnGame.GetCardBackUri();
                src.CacheOption = BitmapCacheOption.OnLoad;
                src.EndInit();
                pictureBox1.Image = SourceConvert.BitmapSourceToBitmap(src);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            // Default Page Setups
            printDocument1.DefaultPageSettings.Landscape = true;
            Margins margins = new Margins(25, 25, 25, 25); // 100ths of an inch. Ex. 25 = 0.25, 150 = 1.5

            printDocument1.DefaultPageSettings.Margins = margins;
            groupBox2.Focus();
            txtSearch.Focus();
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            GamesRepository mygame = new Octgn.Data.GamesRepository();
            int gamecount = mygame.Games.Count;
            if (gamecount > 1)
            {
                GameSelection chooserForm = new GameSelection();
                chooserForm.gameList = new string[gamecount];
                for (int i = 0; i < gamecount; i++) { chooserForm.gameList[i] = mygame.Games[i].Name; }
                chooserForm.ShowDialog();
                gameindex = chooserForm.GameIndex;
            }

            Game octgnGame = proxy.Games[gameindex];
            try
            {
                // Retrieve Card Image
                System.Windows.Controls.Image CardImage = new System.Windows.Controls.Image();
                BitmapImage src = new BitmapImage();
                src.BeginInit();
                src.UriSource = octgnGame.GetCardBackUri();
                src.CacheOption = BitmapCacheOption.OnLoad;
                src.EndInit();
                pictureBox1.Image = SourceConvert.BitmapSourceToBitmap(src);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            // Default Page Setups
            printDocument1.DefaultPageSettings.Landscape = true;
            Margins margins = new Margins(25,25,25,25); // 100ths of an inch. Ex. 25 = 0.25, 150 = 1.5
            printDocument1.DefaultPageSettings.Margins = margins;
            groupBox2.Focus();
            txtSearch.Focus();
        }