public static APIForm Instance(MainForm maniform) { if (sForm == null) { sForm = new APIForm(maniform); } else { sForm.Close(); sForm = new APIForm(maniform); } return(sForm); }
public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { string dest_dir = replacementsDictionary["$destinationdirectory$"]; try { // first element of customParams is the vstemplate file string template_source_path = customParams[0].ToString(); string template_source_folder = Path.GetDirectoryName(template_source_path); using (APIForm input_form = new APIForm()) { // Display a form to the user. The form collects // input for the custom message. if (input_form.ShowDialog() != DialogResult.OK) { // abort throw new WizardCancelledException(); } MatlabConfiguration ml_config = APIForm.ml_config; // Add custom parameters. replacementsDictionary.Add("$TARGET_MACHINE$", ml_config.imports.TargetMachine); replacementsDictionary.Add("$COMPILE_AS$", ml_config.imports.CompileAs); replacementsDictionary.Add("$TARGETS_FILE$", @"$(MSBuildProjectDirectory)\matlab.targets"); replacementsDictionary.Add("$RULE_FILE$", @"$(MSBuildProjectDirectory)\matlab.xml"); replacementsDictionary.Add("$PROJECTEXT$", ml_config.imports.ProjectExtension); replacementsDictionary.Add("$FILEEXT$", ml_config.imports.FileExtension); replacementsDictionary.Add("$API_SHORT_NAME$", ml_config.imports.APIShortName); replacementsDictionary.Add("$MATLABROOT$", ml_config.imports.MatlabRoot); replacementsDictionary.Add("$PLATFORM$", ml_config.imports.Platform); replacementsDictionary.Add("$MATLAB_INCLUDE_PATH$", ml_config.imports.IncludePath); replacementsDictionary.Add("$MATLAB_LIBRARY_PATH$", ml_config.imports.LibraryPath); replacementsDictionary.Add("$MATLAB_DEPENDS$", ml_config.imports.Dependencies); replacementsDictionary.Add("$MATLAB_PREPROCESSOR_DEFINITIONS$", ml_config.imports.PreprocessorDefinitions); replacementsDictionary.Add("$MEXEXT$", ml_config.imports.MEXExtension); /* vstemplate system doesn't allow copying of these without hacking like this */ string src_path = Path.Combine(template_source_folder, "matlab.targets"); string dst_path = Path.Combine(dest_dir, "matlab.targets"); File.Copy(src_path, dst_path, true); src_path = Path.Combine(template_source_folder, "matlab.xml"); dst_path = Path.Combine(dest_dir, "matlab.xml"); File.Copy(src_path, dst_path, true); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex); if (ex is WizardCancelledException || ex is WizardBackoutException) { // Clean up the template that was written to disk if (Directory.Exists(dest_dir)) { Directory.Delete(dest_dir, true); } throw; } else { throw; } } }
void IB1Form.Select() { APIForm.Select(); }