FrmScreenAutomation: Process bots always.
This commit is contained in:
@@ -109,6 +109,7 @@
|
|||||||
this.ddlAutomationBot.Name = "ddlAutomationBot";
|
this.ddlAutomationBot.Name = "ddlAutomationBot";
|
||||||
this.ddlAutomationBot.Size = new System.Drawing.Size(293, 24);
|
this.ddlAutomationBot.Size = new System.Drawing.Size(293, 24);
|
||||||
this.ddlAutomationBot.TabIndex = 4;
|
this.ddlAutomationBot.TabIndex = 4;
|
||||||
|
this.ddlAutomationBot.SelectedIndexChanged += new System.EventHandler(this.DdlAutomationBot_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// btnStartEnd
|
// btnStartEnd
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace VAR.ScreenAutomation
|
|||||||
|
|
||||||
ddlAutomationBot.Items.AddRange(AutomationBotFactory.GetAllAutomationBots());
|
ddlAutomationBot.Items.AddRange(AutomationBotFactory.GetAllAutomationBots());
|
||||||
ddlAutomationBot.SelectedIndex = 0;
|
ddlAutomationBot.SelectedIndex = 0;
|
||||||
|
_automationBot = AutomationBotFactory.CreateFromName((string)ddlAutomationBot.SelectedItem);
|
||||||
|
_automationBot?.Init(ctrOutput);
|
||||||
|
|
||||||
|
|
||||||
if (components == null) { components = new Container(); }
|
if (components == null) { components = new Container(); }
|
||||||
@@ -53,13 +55,16 @@ namespace VAR.ScreenAutomation
|
|||||||
|
|
||||||
bmpScreen = Screenshoter.CaptureControl(picCapturer, bmpScreen);
|
bmpScreen = Screenshoter.CaptureControl(picCapturer, bmpScreen);
|
||||||
|
|
||||||
if (_automationBot != null && _running)
|
if (_automationBot != null)
|
||||||
{
|
{
|
||||||
bmpScreen = _automationBot.Process(bmpScreen, ctrOutput);
|
bmpScreen = _automationBot.Process(bmpScreen, ctrOutput);
|
||||||
string responseKeys = _automationBot.ResponseKeys();
|
if (_running)
|
||||||
if (string.IsNullOrEmpty(responseKeys) == false && WindowHandling.ApplicationIsActivated() == false)
|
|
||||||
{
|
{
|
||||||
SendKeys.Send(responseKeys);
|
string responseKeys = _automationBot.ResponseKeys();
|
||||||
|
if (string.IsNullOrEmpty(responseKeys) == false && WindowHandling.ApplicationIsActivated() == false)
|
||||||
|
{
|
||||||
|
SendKeys.Send(responseKeys);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
picPreview.ImageShow = bmpScreen;
|
picPreview.ImageShow = bmpScreen;
|
||||||
@@ -97,5 +102,11 @@ namespace VAR.ScreenAutomation
|
|||||||
_running = false;
|
_running = false;
|
||||||
btnStartEnd.Text = "Start";
|
btnStartEnd.Text = "Start";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DdlAutomationBot_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_automationBot = AutomationBotFactory.CreateFromName((string)ddlAutomationBot.SelectedItem);
|
||||||
|
_automationBot?.Init(ctrOutput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user