private void Window_Closed(object sender, EventArgs e)
        {
            MediaElement1.Close();

            System.IO.FileInfo fi = new System.IO.FileInfo(System.Environment.CurrentDirectory + "\\temp.avi");
            fi.Delete();
            logwin.MainWin_Close();
        }
        private async void Create_button_Click(object sender, RoutedEventArgs e)
        {
            MediaElement1.Close();
            int x_size = int.Parse(X_TEXTBOX.Text);
            int y_size = int.Parse(Y_TEXTBOX.Text);

            if (x_size > 10000)
            {
                System.Windows.Forms.MessageBox.Show("横の解像度が範囲外です。\r\n解像度は10000x10000以下を指定してください。", "エラー", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            if (y_size > 10000)
            {
                System.Windows.Forms.MessageBox.Show("縦の解像度が範囲外です。\r\n解像度は10000x10000以下を指定してください。", "エラー", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            string lupin_text_data = LUPIN_TEXT.Text; //テキストデータ

            if (lupin_text_data.Length < 1)
            {
                System.Windows.Forms.MessageBox.Show("文字を入力してください。", "エラー", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            if (lupin_text_data.Length > 60)
            {
                System.Windows.Forms.MessageBox.Show("60文字以内にしてください。", "エラー", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            lupin_text_data = lupin_text_data.Replace(" ", " "); //半角スペースを全角スペースに変換(コマンドラインオプションでエラー起こさないように)


            string executablepath = "lupinavi2";
            string cmdline        = "-o temp.avi";

            cmdline += " -m ";
            cmdline += "\"";
            cmdline += lupin_text_data;
            cmdline += "\"";
            StringBuilder stb = new StringBuilder(lupin_text_data);

            swprintf(stb, " -s %dx%d", x_size, y_size);
            cmdline += stb;
            Process proc = new Process();

            proc.StartInfo.FileName               = executablepath;
            proc.StartInfo.Arguments              = cmdline;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardInput  = false;
            //ウィンドウを表示しないようにする
            proc.StartInfo.CreateNoWindow = true;
            TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
            Save_button.IsEnabled         = false;
            Play_Button.IsEnabled         = false;
            Create_button.IsEnabled       = false;
            string dataretu = "H**O";
            await Task.Run(() =>
            {
                proc.Start();
                this.Dispatcher.Invoke((Action)(() =>
                {
                    logwin.AddLog(DateTime.Now, "exec: " + executablepath + " " + cmdline);
                }));
                dataretu = proc.StandardOutput.ReadToEnd();
                proc.WaitForExit();
            });

            proc.Close();
            logwin.AddLog(DateTime.Now, dataretu);
            MediaElement1.Source  = new Uri("temp.avi", UriKind.RelativeOrAbsolute);
            Save_button.IsEnabled = true;
            Play_Button.IsEnabled = true;

            Create_button.IsEnabled       = true;
            TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
        }