Here is what I have in C# Windows Form that shortcuts the user to the built-in geoprocessing tool "create feature class" with some tweaks to the input values. My users want a shapefile. This sample provides a "starting point" for reference to be used in an add-in button, or in a custom Windows Form.
(Resulting inputs in the geoprocessing tool attached.)
private void Create_Shp_Click(object sender, EventArgs e)
{
if (!(Directory.Exists(GVar.DL + @"GISdata\My_Shapefiles\")))
{
try
{
new FileInfo(GVar.DL + @"GISdata\My_Shapefiles\").Directory.Create();
}
catch (Exception)
{
MessageBox.Show(GVar.DL + @"GISdata\My_Shapefiles\ does not exist.", " Missing Outpath Folder",
MessageBoxButtons.OK,
MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly);
return;
}
}
string out_path = GVar.DL + @"GISdata\My_Shapefiles\";
string out_name = "my_shapefile.shp";
var param_values = Geoprocessing.MakeValueArray(out_path,out_name);
Geoprocessing.OpenToolDialog("CreateFeatureclass_management", param_values);
}