Ejemplo n.º 1
0
        public MkSudokuProc(ProblemInfo pi, int level)
        {
            _pi    = pi;
            _level = level;

            this.startProc();
        }
Ejemplo n.º 2
0
 public ImageCreator(ProblemInfo pi, Color digitColor, string csvFile, Surface surface = null)
 {
     _pi         = pi;
     _digitColor = digitColor;
     _csvFile    = csvFile;
     _surface    = surface;
 }
Ejemplo n.º 3
0
        private void btnMkAndPrint_Click(object sender, EventArgs e)
        {
            ProblemInfo pi    = Gnd.i.problemInfos[lbKind.SelectedIndex];
            int         level = cmbDifficulty.SelectedIndex;

            Gnd.i.mkAndPrintWinParentWin = this;
            Gnd.i.mkSudokuProc           = new MkSudokuProc(pi, level);

            using (MkAndPrintWin f = new MkAndPrintWin(pi, level))
            {
                f.ShowDialog();
            }
            if (Gnd.i.mkSudokuProc.isEnded() == false)
            {
                CancellableBusyDlg.perform(true, delegate
                {
                    Gnd.i.cancellableBusyDlg.setTitle("問題作成プロセスを停止しています...");
                    Gnd.i.mkSudokuProc.bCancel();
                });
            }
            Gnd.i.mkSudokuProc.Dispose();
            Gnd.i.mkSudokuProc           = null;
            Gnd.i.mkAndPrintWinParentWin = null;

            HistoryDataUtils.trimHistories();

            GC.Collect();
        }
Ejemplo n.º 4
0
        private void lbKindChanged()
        {
            ProblemInfo pi = Gnd.i.problemInfos[this.lbKind.SelectedIndex];

            this.txtDescription.Text = pi.getDescription();
            this.imgPreview.Image    = pi.getPreview();

            GC.Collect();
        }
Ejemplo n.º 5
0
        public static HistoryData createHistory(ProblemInfo pi, int level, Bitmap imgProblem, Bitmap imgAnswer)
        {
            long   lStamp = DateTimeToSec.Now.getDateTime();
            string dir;

            for (; ;)
            {
                dir = Path.Combine(Gnd.i.historyDir, "" + lStamp);

                if (Directory.Exists(dir) == false)
                {
                    break;
                }

                lStamp++;
            }
            Directory.CreateDirectory(dir);

#if true
            {
                XNode root = new XNode("Root");

                root.children.Add(new XNode("PIName", pi.getName()));
                root.children.Add(new XNode("Level", "" + level));

                root.save(Path.Combine(dir, "Data.xml"));
            }
#else // old
            File.WriteAllText(Path.Combine(dir, "PIName.dat"), pi.getName(), StringTools.ENCODING_SJIS);
            File.WriteAllText(Path.Combine(dir, "Level.dat"), "" + level, StringTools.ENCODING_SJIS);
#endif
            imgProblem.Save(Path.Combine(dir, "Problem.png"), ImageFormat.Png);
            imgAnswer.Save(Path.Combine(dir, "Answer.png"), ImageFormat.Png);

            return(new HistoryData(dir));
        }
Ejemplo n.º 6
0
        private HistoryData _historyData;         // null == 作成未完了

        private MkAndPrintWin(ProblemInfo problemInfo, int level, HistoryData historyData)
        {
            _problemInfo = problemInfo;
            _level       = level;
            _historyData = historyData;

            InitializeComponent();

            this.lblProblemTitle.Text = "印刷する問題:" + _problemInfo.getName() + " , 難易度:" + Utils.levelToString(_level);
            this.lblMkStatus.Text     = "作成中...";

            this.cmbPrinterName.Items.Clear();
            foreach (string name in ImagePrinter.getPrinterNames())
            {
                this.cmbPrinterName.Items.Add(name);
            }
            this.cmbPrinterName.SelectedIndex = 0;

            this.cmbPaperSizeName.Items.Clear();
            foreach (string name in ImagePrinter.getPaperSizeNames())
            {
                this.cmbPaperSizeName.Items.Add(name);
            }
            this.cmbPaperSizeName.SelectedIndex = 0;

            // 前回のプリンタ選択を復元
            {
                string name = Gnd.i.lastPrinterName;

                if (name != "")
                {
                    int index = Utils.getIndex(cmbPrinterName, name);

                    if (index != -1)
                    {
                        cmbPrinterName.SelectedIndex = index;
                        cbUseDefaultPrinter.Checked  = false;
                    }
                }
            }
            // 前回の用紙サイズ選択を復元
            {
                string name = Gnd.i.lastPaperSizeName;

                if (name != "")
                {
                    int index = Utils.getIndex(cmbPaperSizeName, name);

                    if (index != -1)
                    {
                        cmbPaperSizeName.SelectedIndex = index;
                        cbUseDefaultPaperSize.Checked  = false;
                    }
                }
            }
            // 前回のマージンを復元
            {
                LTRB margin = Gnd.i.lastMargin;

                if (margin != null)
                {
                    marginL.Text = "" + margin.l;
                    marginT.Text = "" + margin.t;
                    marginR.Text = "" + margin.r;
                    marginB.Text = "" + margin.b;
                    cbUseDefaultMargin.Checked = false;
                }
                else
                {
                    marginL.Text = "" + 100;
                    marginT.Text = "" + 100;
                    marginR.Text = "" + 100;
                    marginB.Text = "" + 100;
                }
            }

            cbPrintProblem.Checked = Gnd.i.lastPrintProblem;
            cbPrintAnswer.Checked  = Gnd.i.lastPrintAnswer;

            refreshUI();

            if (_historyData != null)
            {
                historyDataCreated();
            }
        }
Ejemplo n.º 7
0
 public MkAndPrintWin(ProblemInfo problemInfo, int level)
     : this(problemInfo, level, null)
 {
 }