Пример #1
0
 private void ProcessStart(Step step)
 {
     if (step != Step.Next)  //invalid
     {
         return;
     }
     state = P2WizardState.InitialPrint;
 }
Пример #2
0
        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;
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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();
        }
Пример #6
0
        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;
        }
Пример #7
0
 private void cmdAdvanced_Click(object sender, EventArgs e)
 {
     state = P2WizardState.Advanced;
     HighlightCurrentStep();
 }
Пример #8
0
 private void ProcessAdvanced(Step step)
 {
     state = P2WizardState.Start;
 }
Пример #9
0
        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;
        }