static void Main() { IWin32Window vissimHandle = null; Process[] processes = Process.GetProcessesByName("vissim"); if (processes.Length > 0) { vissimHandle = new Classes.WindowWrapper(processes[0].MainWindowHandle); } if (vissimHandle != null && vissimHandle.Handle != IntPtr.Zero) { Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new MainForm(vissimHandle); switch (Settings.Default.windowModeIndex) { case 0: // Standalone frmMain.ShowInTaskbar = true; frmMain.Show(); break; case 1: // Modeless frmMain.Show(vissimHandle); break; case 2: // Modal frmMain.ShowDialog(vissimHandle); break; case 3: // Topmost frmMain.ShowInTaskbar = true; frmMain.TopMost = true; frmMain.Show(); break; } Application.Run(); } else { MessageBox.Show( "Please, start VISSIM 5.3 with [/Automation] parameter first!\nVisLab application will be closed!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
static void Main() { IWin32Window vissimHandle = null; Process[] processes = Process.GetProcessesByName("vissim"); if (processes.Length > 0) vissimHandle = new Classes.WindowWrapper(processes[0].MainWindowHandle); if (vissimHandle != null && vissimHandle.Handle != IntPtr.Zero) { Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new MainForm(vissimHandle); switch (Settings.Default.windowModeIndex) { case 0: // Standalone frmMain.ShowInTaskbar = true; frmMain.Show(); break; case 1: // Modeless frmMain.Show(vissimHandle); break; case 2: // Modal frmMain.ShowDialog(vissimHandle); break; case 3: // Topmost frmMain.ShowInTaskbar = true; frmMain.TopMost = true; frmMain.Show(); break; } Application.Run(); } else { MessageBox.Show( "Please, start VISSIM 5.3 with [/Automation] parameter first!\nVisLab application will be closed!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void ShadowButton_CreateProject_Click(object sender, RoutedEventArgs e) { if (sliderPosition == SliderPositions.spExperiments) sliderPosition = SliderPositions.spTree; var wnd = new CreateProjectForm(); var ww = new WindowWrapper(new WindowInteropHelper(this).Handle); if (wnd.ShowDialog(ww) == System.Windows.Forms.DialogResult.OK) { string projectName = wnd.tbxProjectName.Text; string projectDir = wnd.tbxProjectLocation.Text; string modelName = wnd.tbxNewModelName.Text; string modelFileName = wnd.tbxModelFile.Text; switch (wnd.checkedRadioButtonName) { case "rbCreateNew": pm.Initialize(projectName, projectDir, ModelCreationMode.cmCreateNew, modelName); break; case "rbSelectFromFile": pm.Initialize(projectName, projectDir, ModelCreationMode.cmClone, System.IO.Path.GetDirectoryName(modelFileName)); break; case "rbSelectCurrent": pm.Initialize(projectName, projectDir, ModelCreationMode.cmClone, vissim.Instance.GetWorkingDirectory()); break; } } }