Ejemplo n.º 1
0
 public FFmpeg()
 {
     try
     {
         tryInit();
     }
     catch (Exception e)
     {
         FaultOperation.caught(e);
         chooseFFmpegDir();
         tryInit();
     }
 }
Ejemplo n.º 2
0
 public static void init()
 {
     try
     {
         _bDir = mkBDir(Gnd.i.ffmpegDir);
     }
     catch (Exception e)
     {
         FaultOperation.caught(e);
         chooseFFmpegDir();
         _bDir = mkBDir(Gnd.i.ffmpegDir);
     }
 }
Ejemplo n.º 3
0
        public EngineTh()
        {
            try
            {
                init();
            }
            catch (Exception e)
            {
                FaultOperation.caught(e);
            }

            th = new Thread((ThreadStart) delegate
            {
                while (death == false)
                {
                    using (MutexObject.section(m))
                    {
                        try
                        {
                            perform();
                        }
                        catch (Exception e)
                        {
                            Gnd.i.logger.writeLine("EngineTh error: " + e);

                            doInvoke(delegate
                            {
                                FaultOperation.caught(e);
                            });

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait start");

                            for (int c = 0; c < 15 && death == false; c++)                             // MBoxラッシュ回避
                            {
                                Thread.Sleep(2000);
                            }

                            Gnd.i.logger.writeLine("EngineTh MBoxラッシュ回避 wait end");
                        }
                    }
                    Thread.Sleep(100);
                }
            });
            th.Start();

            Gnd.i.logger.writeLine("EngineTh started");
        }
Ejemplo n.º 4
0
        private void MainWin_Shown(object sender, EventArgs e)
        {
            this.Visible = false;

            this.BeginInvoke((MethodInvoker) delegate
            {
                try
                {
                    main2();
                }
                catch (Exception ex)
                {
                    FaultOperation.caught(ex);
                }
                this.Close();
            });
        }
Ejemplo n.º 5
0
        public void Dispose()
        {
            if (th != null)
            {
                death = true;

                th.Join();
                th = null;

                try
                {
                    fnlz();
                }
                catch (Exception e)
                {
                    FaultOperation.caught(e);
                }

                Gnd.i.logger.writeLine("EngineTh ended");
            }
        }
Ejemplo n.º 6
0
        private void btnMkAndPrint_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;
            this.Visible   = false;
            Gnd.i.mkAndPrintWinParentWin.Visible = false;

            try
            {
                CancellableBusyDlg.perform(false, delegate
                {
                    if (_historyData == null)                     // ? 作成未完了
                    {
                        if (Gnd.i.mkSudokuProc == null)
                        {
                            throw null;
                        }

                        Gnd.i.cancellableBusyDlg.setTitle("ナンプレを作成しています... (印刷は自動的に開始されます)");

                        while (Gnd.i.mkSudokuProc.isEnded() == false)
                        {
                            if (Gnd.i.cancelled)
                            {
                                Gnd.i.cancellableBusyDlg.setTitle("キャンセルしています...");
                                Gnd.i.mkSudokuProc.bCancel();
                                throw new Cancelled();
                            }
                            Thread.Sleep(2000);
                        }
                        Gnd.i.cancellableBusyDlg.setTitle("作成した問題を画像に変換しています...");

                        _historyData = Gnd.i.mkSudokuProc.getResult();
                        //historyDataCreated(); // もうこのフォームを表示しないので、呼ばなくて良い。

                        if (Gnd.i.cancelled)
                        {
                            throw new Cancelled();
                        }
                    }
                    Gnd.i.cancellableBusyDlg.setTitle("ナンプレを印刷しています...");

                    {
                        ImagePrinter imgPrn = new ImagePrinter();

                        if (this.cbUseDefaultMargin.Checked == false)
                        {
                            imgPrn.setMargin(getMaringLTRB());
                        }

                        if (this.cbUseDefaultPrinter.Checked == false)
                        {
                            imgPrn.setPrinterName(this.cmbPrinterName.SelectedItem.ToString());
                        }

                        if (this.cbUseDefaultPaperSize.Checked == false)
                        {
                            imgPrn.setPaperSizeName(this.cmbPaperSizeName.SelectedItem.ToString());
                        }

                        if (this.cbPrintProblem.Checked)
                        {
                            imgPrn.addImage(_historyData.getProblemImage());
                        }

                        if (this.cbPrintAnswer.Checked)
                        {
                            imgPrn.addImage(_historyData.getAnswerImage());
                        }

                        imgPrn.doPrint();
                    }

                    throw new Completed("印刷しました。");
                });
            }
            catch (Exception ex)
            {
                FaultOperation.caught(ex);
            }

            Gnd.i.mkAndPrintWinParentWin.Visible = true;
            //this.Visible = true;
            this.Close();
        }