Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi forum,
The code below adds iLogic and then runs a rule of my choice. which is great.
Now i want to run a rule multiple times, i call 'AddiLogic()' elsewhere in my code when i need the rule to run.
I assume it's not needed to run this whole block of code just for the rule to run. I think i only need the last part of block, so i could split the block into two:
one does AddiLogic();
the other does RunRule();
the problem is that i'm quite new to coding and when i split it it looses all references and creates a whole list of errors, see the code further below for what my goal is...
void AddiLogic()
{
string MyRuleName = textBox2.Text;
string iLogicAddinGuid = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}";
ApplicationAddIn iLogicAddin;
dynamic iLogicAutomation = null;
try
{
iLogicAddin = _invApp.ApplicationAddIns.ItemById[iLogicAddinGuid];
iLogicAutomation = iLogicAddin.Automation;
}
catch (Exception ex)
{
MessageBox.Show("Unable to access iLogic addin " + ex.Message);
}
// niet nodig om de hele AddIlogic toe te voegen, alleen de rule uitvoeren is voldoende...
try
{
iLogicAutomation.Runrule(oDoc, MyRuleName);
}
catch
{
MessageBox.Show("There is no rule called " + MyRuleName);
}
}
void AddiLogic()
{
string MyRuleName = textBox2.Text;
string iLogicAddinGuid = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}";
ApplicationAddIn iLogicAddin;
dynamic iLogicAutomation = null;
try
{
iLogicAddin = _invApp.ApplicationAddIns.ItemById[iLogicAddinGuid];
iLogicAutomation = iLogicAddin.Automation;
}
catch (Exception ex)
{
MessageBox.Show("Unable to access iLogic addin " + ex.Message);
}
}
void RunRule()
{
try
{
iLogicAutomation.Runrule(oDoc, MyRuleName);
}
catch
{
MessageBox.Show("There is no rule called " + MyRuleName);
}
}
Solved! Go to Solution.