private void ProcessStart(Step step) { if (step != Step.Next) //invalid { return; } state = P2WizardState.InitialPrint; }
private void ProcessInitialPrint(Step step) { if (step != Step.Next) //invalid { return; } Cursor.Current = Cursors.WaitCursor; #if Print GenerateCellPage(); #endif Cursor.Current = Cursors.Default; state = P2WizardState.ValidBlend; }
private void ProcessIsValidPanto(Step step) { if (step == Step.Next || step == Step.Back) //invalid { return; } if (step == Step.Yes) { state = P2WizardState.Complete; } if (step == Step.No) { state = P2WizardState.PrintFullPanto; } }
private void ProcessValidBlend(Step step) { if (step == Step.Next || step == Step.Back) //invalid { return; } if (step == Step.Yes) { state = P2WizardState.PrintFullPanto; nudDarknessBG.Value = Density; nudPageNumberBG.Value = Page + 1; } if (step == Step.No) { state = P2WizardState.FailReason; } }
private void ProcessFailReason(Step step) { if (step != Step.Next) //invalid { return; } if (rdNoGoodPattern.Checked) { Page++; } if (rdTooDark.Checked) { if (Density == 0) { MessageBox.Show("Cannot go any lighter"); return; } Density--; Page = 0; } if (rdTooLight.Checked) { if (Density == 10) { MessageBox.Show("Cannot go any darker"); return; } Density++; Page = 0; } if (rdStripe.Checked) { state = P2WizardState.FGAdjust; nudDarknessFG.Value = Density; nudPageNumberFG.Value = Page + 1; ResetDensityChoices(); return; } state = P2WizardState.InitialPrint; ResetDensityChoices(); }
private void ProcessFGAdjust(Step step) { if (step != Step.Cancel && step != Step.Next) //invalid { return; } if (step == Step.Cancel) { state = P2WizardState.FailReason; return; } GenerateCartesian((int)nudPageNumberFG.Value, (int)nudDarknessFG.Value); Dot d = GetDot((int)nudPageNumberFG.Value, (int)nudDarknessFG.Value, txtCellFG.Text, "FG"); if (d == null) { MessageBox.Show("Invalid foreground pattern parameters, please re-enter"); return; } CurrentFG = d; state = P2WizardState.InitialPrint; }
private void cmdAdvanced_Click(object sender, EventArgs e) { state = P2WizardState.Advanced; HighlightCurrentStep(); }
private void ProcessAdvanced(Step step) { state = P2WizardState.Start; }
private void ProcessPrintFullPanto(Step step) { if (step != Step.Next && step != Step.Back) //invalid { return; } if (step == Step.Back) { state = P2WizardState.FailReason; return; } #if !Print state = P2WizardState.IsValidPanto; return; #endif Dot bg = GetDot((int)nudPageNumberBG.Value, (int)nudDarknessBG.Value, txtCellBG.Text, "BG"); if (bg == null) { MessageBox.Show("You have entered an invalid page number or cell index. Please correct and try again"); return; } if (CurrentFG == null) { CurrentFG = Cartesian.First(); } byte[] data = bg.GetBytes(true); byte[] dataFg = CurrentFG.GetBytes(true); //MessageBox.Show("TODO - Print pantograph based on entered cell"); CustomConfiguration cc = new CustomConfiguration(); //Using interference pattern? if (!string.IsNullOrEmpty(IntfFontPath)) { //Set the interference enabled bit and chessboard bit cc.PantographConfiguration = "257"; } else { //Set only the chessboard bit cc.PantographConfiguration = "1"; IntfFontPath = Application.StartupPath; //TBD Temporary until I fix the panto builder. Does not like a blank string. } cc.PageOrientation = PageOrientationType.poPortrait; cc.PageType = PageType.ptLetter; cc.UseDefaultInclusionForPaperSize = true; cc.InterferencePatternId = 20; cc.CellList.Clear(); //Create a cell with the text COPY and id = 10 PantographCellDescriptorType pcdt = new PantographCellDescriptorType(); pcdt.msg = "COPY"; pcdt.pidx = 10; cc.CellList.Add(pcdt); //Set the custom pattern cc.CustomBackgroundPatternData = data; //TBD use real foreground cc.CustomForegroundPatternData = dataFg; //Create the full page pantograph string filename = "PantographProfile1Page1.pcl"; var xser = new XmlSerializer(typeof(CustomConfiguration)); string cfilename = IntfFontPath + "TroyPantographConfiguration.xml"; var writer = new StreamWriter(cfilename); xser.Serialize(writer, cc); var bp = new BuildPantographWrap.Wrapper(); int rc = bp.ManagedCreatePantograph(IntfFontPath); //Print the pantograph file PrinterLib.PrintToSpooler.SendFileToPrinter(PrinterName, filename, "Test"); //TBD Temporary kluge to make the other temporary kluge work properly if (cc.PantographConfiguration == "1") { IntfFontPath = ""; } state = P2WizardState.IsValidPanto; }