private void aboutToolStripMenuItem1_Click(object sender, EventArgs e) { licenseInfo = new BingoLicense(); //splash = new SplashScreen(false, licenseInfo.licenseText, licenseInfo.isLicensed); using (About aboutBox = new About(licenseInfo.licenseText, licenseInfo.isLicensed)) { if (aboutBox.ShowDialog() == DialogResult.OK) { this.WindowState = FormWindowState.Minimized; } } }
//Thread redrawThread = new Thread(new ThreadStart(data.regeneratePuzzle)); public WordList() { InitializeComponent(); gridSizeTextBox.Text = data.gridSize.ToString(); //System.Threading.Thread.Sleep(3000); // splashThread.Abort(); refreshItemsListBox(); //this.WindowState = FormWindowState.Normal; //Hide the registration menu if the app is already registered licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == true) { registerToolStripMenuItem.Visible = false; } }
private void PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //Here we can do a license check to see how much we should randomize the cards System.Drawing.Graphics graphicsObj; graphicsObj = e.Graphics; Rectangle rect = e.MarginBounds; Point pt = new Point(rect.X, rect.Y); Size sz = new Size(rect.Width, rect.Height); Random rand = new Random(); BingoLicense licenseInfo = new BingoLicense(); //find the shortest dimension. That will be our top. //Now, rows = cardsPerPage/2, columms = 2. //Except, 1 and 2 cards per page are special cases if (this.numCardsToPrint > 0) { if (bingoTable.numCardsPerPage == 1) { //Find shortest dimension if (rect.Width <= rect.Height) { sz.Width = sz.Height = rect.Width; } else { sz.Width = sz.Height = rect.Height; } if (this.numCardsToPrint > 0) { PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } } else if (bingoTable.numCardsPerPage == 2) { Rectangle tempRect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); //find shortest dimension that is less than 2x the longer dimension. Add 10 pixels so we have some space between the tables if (tempRect.Width >= tempRect.Height) { //We are in landscape mode, print out side by side while ((tempRect.Height * 2 + 10) > tempRect.Width) { tempRect.Height -= 1; } //Adjust pt.y so we print in the center of the page pt.Y = pt.Y + ((rect.Height - tempRect.Height) / 2); //Now, the height is 1/2 the width. Draw the first table. sz.Width = sz.Height = tempRect.Height; if (this.numCardsToPrint > 0) { /* e.HasMorePages =*/ PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } //bingoTable.RandSeed += 1; //Add the size of the first card + 10px to pt and draw again if (this.numCardsToPrint > 0) { pt.X = pt.X + sz.Width + 10; /* e.HasMorePages =*/ PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } } else { //We are in portrait mode while ((tempRect.Width * 2 + 10) > tempRect.Height) { tempRect.Width -= 1; } //Adjust pt.x so we print in the center of the page. pt.X = pt.X + ((rect.Width - tempRect.Width) / 2); //Now, the width is 1/2 the height. Draw the first table. sz.Width = sz.Height = tempRect.Width; /*e.HasMorePages = */ if (this.numCardsToPrint > 0) { PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } if (this.numCardsToPrint > 0) { pt.Y = pt.Y + sz.Height + 10; /* e.HasMorePages =*/ PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } } } else if (bingoTable.numCardsPerPage > 2) { Rectangle tempRect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); if (tempRect.Width >= tempRect.Height) { //We are in landscape mode int numCols = bingoTable.numCardsPerPage / 2; tempRect.Width = (rect.Width - 10 * (numCols - 1)) / numCols; tempRect.Height = (rect.Height - 10) / 2; if (tempRect.Height > tempRect.Width) { while (tempRect.Height > tempRect.Width) { tempRect.Height -= 1; } //tempRect.Width = tempRect.Height; } else if (tempRect.Height < tempRect.Width) { while (tempRect.Height < tempRect.Width) { tempRect.Width -= 1; } //tempRect.Height = tempRect.Width; } //Remove a few px becausee we may gain some when we even everything out sz.Height = sz.Width = tempRect.Width - 5; //Adjust the height and column size so they divide evenly into table.row and table.column //This is done because we use integer sizes and we want everything to line up correctly. //Otherwise, there will be badness. int rowSize = bingoTable.rowSize; if (bingoTable.printTitle == true) { rowSize += 1; } int remainder = sz.Height % rowSize; while (remainder != 0) { sz.Height += 1; remainder = sz.Height % rowSize; } int colSize = bingoTable.colSize; remainder = sz.Width % colSize; while (remainder != 0) { sz.Width += 1; remainder = sz.Width % colSize; } //End resize if ((sz.Height <= 0) || (sz.Width <= 0)) { MessageBox.Show("Unable to Print. Bingo card size is less than 0!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //Avoid badness // for (int card = 0; (card < bingoTable.numCardsPerPage) && (totalCardsToPrint > 0); card++, numCardsToPrint -= 1) //{ for (int row = 0; row < 2; row++) { int rowHeight = (rect.Height - 10) / 2; pt.Y = rect.Y + (row * rowHeight) + (10 * row); for (int col = 0; col < numCols; col++) { //bingoTable.RandSeed = rand.Next() % 9999; pt.X = rect.X + (col * tempRect.Width) + (10 * col); if (this.numCardsToPrint > 0) { PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } } } } else { //We are in portrait mode int numRows = bingoTable.numCardsPerPage / 2; tempRect.Height = (rect.Height - 10 * (numRows - 1)) / numRows; //(10 * numRows - 1) is the gap between each square //Find the largest box that fits. tempRect.Width = (rect.Width - 10) / 2; //10px gap between each square if (tempRect.Width > tempRect.Height) { while (tempRect.Width > tempRect.Height) { tempRect.Width -= 1; } // tempRect.Height = tempRect.Width; } else if (tempRect.Width < tempRect.Height) { while (tempRect.Width < tempRect.Height) { tempRect.Height -= 1; } //tempRect.Width = tempRect.Height; } //Now, tempRect contains the perfect square size sz.Height = sz.Width = tempRect.Width - 3; //Adjust the height and column size so they divide evenly into table.row and table.column //This is done because we use integer sizes and we want everything to line up correctly. //Otherwise, there will be badness. int rowSize = bingoTable.rowSize; if (bingoTable.printTitle == true) { rowSize += 1; } int remainder = sz.Height % rowSize; while (remainder != 0) { sz.Height += 1; remainder = sz.Height % rowSize; } int colSize = bingoTable.colSize; remainder = sz.Width % colSize; while (remainder != 0) { sz.Width += 1; remainder = sz.Width % colSize; } //End resize if ((sz.Height <= 0) || (sz.Width <= 0)) { MessageBox.Show("Unable to Print. Bingo card size is less than 0!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //Avoid badness //for (int card = 0; (card < bingoTable.numCardsPerPage && numCardsToPrint > 0); card++, numCardsToPrint -= 1) //{ for (int col = 0; col < 2; col++) { //Center the columns int colWidth = (rect.Width - 10) / 2; //10px gap between each square pt.X = rect.X + (col * colWidth) + (10 * col); for (int row = 0; row < numRows; row++) { // if (e.HasMorePages == true) { //bingoTable.RandSeed = rand.Next() % 9999; pt.Y = rect.Y + (row * tempRect.Height) + (10 * row); if (this.numCardsToPrint > 0) { PrintCard(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo); } } } } } } } else if (printCallListOnNextPage == true) { printBingoCallList(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo, "Hello World!", false); printCallListOnNextPage = false; e.HasMorePages = false; return; } if (this.numCardsToPrint > 0) { e.HasMorePages = true; return; } else if (this.numCardsToPrint <= 0) { if (bingoTable.printCallList == true) { e.HasMorePages = true; printCallListOnNextPage = true; return; } else { e.HasMorePages = false; return; } } }
public void PrintCard(Point pt, Size sz, BingoTable table, Color color, ref Graphics graphicsObj, BingoLicense licenseInfo) { if (this.numCardsToPrint > 0) { if (licenseInfo.isLicensed == true) { Random rand = new Random(); bingoTable.RandSeed = rand.Next() % 9999; } else { bingoTable.RandSeed += 1; } DrawBingoCard(pt, sz, bingoTable, Color.Black, ref graphicsObj); //return (true); } this.numCardsToPrint -= 1; }
public void printBingoCallList(Point pt, Size sz, BingoTable table, Color color, ref Graphics graphicsObj, BingoLicense licenseInfo, string Message, bool printMessage) { Font titleFont = new Font(FontFamily.GenericMonospace, 14, FontStyle.Bold); Font itemFont = new Font(FontFamily.GenericMonospace, 12); Brush blackBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); string wordList = ""; foreach (string item in table.items) { wordList += item + "\n"; } if (printMessage == true) { wordList += "\n\n" + Message + "\n"; } //Draw title string listTitle = "Call List"; SizeF itemSize = graphicsObj.MeasureString(listTitle.ToString(), titleFont); Point titlePoint = new Point(pt.X + (int)((sz.Width - itemSize.Width) / 2), pt.Y); graphicsObj.DrawString(listTitle, titleFont, blackBrush, titlePoint); pt.Y += (int)(itemSize.Height + 0.5); //Draw words graphicsObj.DrawString(wordList, itemFont, blackBrush, pt); return; }
private bool readLicenceFile() { licenseInfo = new BingoLicense(); return (licenseInfo.isLicensed); }
public RegistrationScreen() { InitializeComponent(); licenseInfo = new BingoLicense(); }
private void addWord() { licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == false) { if (data.words.Count >= licenseInfo.maxWordSearchWords) { splash = new SplashScreen(true, "Sorry, the trial version of Word Search Designer\nis limited to " + licenseInfo.maxWordSearchWords + " words at a time.", licenseInfo.isLicensed); using (splash) { splash.ShowDialog(); return; } } } data.words.Add(addNewItemTextBox.Text); refreshItemsListBox(); }
private void WordSearchPrintDocument() { bool printPerformed = screenDraw.PrintWordSearchDocument(ref this.data); if (printPerformed == true) { licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == false) { FeatureList features = new FeatureList(); //splash = new SplashScreen(true, "Thank you for trying Bingo Card Designer.\nThis version will print the same cards for the same word list.\nPurchasing Bingo Card Designer will allow you to print unique cards every time.", licenseInfo.isLicensed); using (features) { if (features.ShowDialog() == DialogResult.OK) { this.WindowState = FormWindowState.Minimized; } } } } }
private void WordList_Load(object sender, EventArgs e) { itemsListBoxToolTip.SetToolTip(this.itemsListBox, "Word will not fit. Try refreshing \nor a larger grid size."); licenseInfo = new BingoLicense(); splash = new SplashScreen(false, licenseInfo.licenseText, licenseInfo.isLicensed); Thread splashThread = new Thread(new ThreadStart(showSplashScreen)); splashThread.Start(); }
private void regeneratePuzzleAndGrid() { int temp; try { temp = int.Parse(gridSizeTextBox.Text); } catch { MessageBox.Show("Grid Size Must be a Number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == false) { if (temp > licenseInfo.gridSize) { temp = licenseInfo.gridSize; gridSizeTextBox.Text = temp.ToString(); splash = new SplashScreen(true, "Sorry, the trial version of Word Search Designer\nis limited to a grid size of 15.", licenseInfo.isLicensed); using (splash) { splash.ShowDialog(); } } } data.gridSize = temp; regeneratingPuzzleWait wait = new regeneratingPuzzleWait(ref data); using (wait) { wait.ShowDialog(); // data.gridSize = int.Parse(gridSizeTextBox.Text); } this.Refresh(); }
private void numberCardsToPrintTextBox_TextChanged(object sender, EventArgs e) { int numCardsToPrint = -1; if (numberCardsToPrintTextBox.Text == "") { data.numCardsToPrint = 1; return; } //If they clear it out, set it to 1 by default try { numCardsToPrint = int.Parse(numberCardsToPrintTextBox.Text); } catch { numberCardsToPrintTextBox.Text = data.numCardsToPrint.ToString(); numCardsToPrint = data.numCardsToPrint; //data.numCardsToPrint = int.Parse(numberCardsToPrintTextBox.Text); } finally { licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == false) { if (numCardsToPrint > licenseInfo.maxWordSearchCardsToPrint) { numCardsToPrint = licenseInfo.maxWordSearchCardsToPrint; splash = new SplashScreen(true, "Sorry, the trial version of Word Search Designer\nis limited to printing " + licenseInfo.maxWordSearchCardsToPrint + " puzzles at a time.", licenseInfo.isLicensed); using (splash) { splash.ShowDialog(); } } data.numCardsToPrint = numCardsToPrint; numberCardsToPrintTextBox.Text = data.numCardsToPrint.ToString(); } } }
private void helpToolStripMenuItem_Click(object sender, EventArgs e) { //Hide the registration menu if the app is already registered licenseInfo = new BingoLicense(); if (licenseInfo.isLicensed == true) { registerToolStripMenuItem.Visible = false; } }