private void btn_LoadObj_Click(object sender, EventArgs e) { if (state == CookerState.Action) { pIn.WriteLine("-1"); state = CookerState.File; } m_OpenFileDialog.FileName = ""; if (m_OpenFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.Cancel) { m_OpenFileDialog.InitialDirectory = m_OpenFileDialog.FileName; m_SaveFileDialog.InitialDirectory = m_OpenFileDialog.InitialDirectory; pB_LoadObj.Value = 0; pIn.WriteLine(m_OpenFileDialog.FileName); pB_LoadObj.Value = 100; } }
public Form1() { InitializeComponent(); p = new Process(); p.StartInfo.FileName = "HappyCooker.exe"; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = false; p.StartInfo.RedirectStandardError = false; p.StartInfo.UseShellExecute = false; p.Start(); pIn = p.StandardInput; state = CookerState.File; m_OpenFileDialog = new OpenFileDialog(); m_OpenFileDialog.AddExtension = true; m_OpenFileDialog.AutoUpgradeEnabled = true; m_OpenFileDialog.CheckFileExists = true; m_OpenFileDialog.CheckPathExists = true; m_OpenFileDialog.DefaultExt = ".obj"; m_OpenFileDialog.Filter = "*.obj|*.obj"; m_OpenFileDialog.InitialDirectory = Environment.CurrentDirectory; m_OpenFileDialog.Multiselect = false; m_OpenFileDialog.RestoreDirectory = true; m_OpenFileDialog.Title = "Import Obj"; m_SaveFileDialog = new SaveFileDialog(); m_SaveFileDialog.AddExtension = true; m_SaveFileDialog.AutoUpgradeEnabled = true; m_SaveFileDialog.CheckPathExists = true; m_SaveFileDialog.DefaultExt = ".bin"; m_SaveFileDialog.Filter = "*.bin|*.bin"; m_SaveFileDialog.InitialDirectory = Environment.CurrentDirectory; m_SaveFileDialog.RestoreDirectory = true; m_SaveFileDialog.Title = "Export Obj"; }