Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone. I defined a command class that considers Execute method and some other defined methods by me to call in Execute method or other classes. I tend to call my method with name of " LoadFamily" and its first parameter is UIApplication of my command class. The point is that I don't know how should I call that parameter when I'm in a form button.(In other word, how should I call the UIApplication of my command class somewhere out of command class?) .see the codes below.
// my button in my Form
private void btn1_Click(object sender, EventArgs e)
{
AddFamilies addFamilies1 = new AddFamilies();
addFamilies1.LoadFamily(--!!???????!!--,@"E:\","HazardSign");
}
below is my method in command class
//My command class
public class AddFamilies : IExternalCommand
{
public Document MyDoc;
public UIApplication MyApplication;
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
using (System.Windows.Forms.Form form = new LoadFamilies(doc))
{
if (form.ShowDialog() == DialogResult.OK)
{
return Result.Succeeded;
}
else
{
return Result.Cancelled;
}
}
return Result.Succeeded;
}
public void LoadFamily(UIApplication uiApplication, string FamiliesAddress, string FamilyName)
{
Document document = uiApplication.ActiveUIDocument.Document;
Application application = uiApplication.Application;
...codes...
}
}
Solved! Go to Solution.
Developer Advocacy and Support +