Skip to content

Commit

Permalink
Merge pull request #24 from skadefro/master
Browse files Browse the repository at this point in the history
Fix type detecting bug in autocomplete
  • Loading branch information
skadefro authored May 23, 2019
2 parents dc6e4d4 + 4609e65 commit d7c0b73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
6 changes: 5 additions & 1 deletion OpenRPA.ExpressionEditor/EditorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ private ExpressionNode AddVariablesToAutoCompletionList(ExpressionNode data, Lis

if (results.Count == 0)
{
Type child = item.ItemType.GenericTypeArguments[0];
Type child = typeof(string);
if (item.ItemType.GenericTypeArguments != null && item.ItemType.GenericTypeArguments.Length > 0)
{
child = item.ItemType.GenericTypeArguments[0];
}
var entityNode = new ExpressionNode
{
Name = computedName,
Expand Down
25 changes: 19 additions & 6 deletions OpenRPA/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private bool canSignout(object item)
private void onSignout(object item)
{
autoReconnect = true;
Projects.Clear();
Config.local.password = Config.local.ProtectString("BadPassword");
_ = global.webSocketClient.Close();
}
Expand Down Expand Up @@ -628,6 +629,9 @@ private void WebSocketClient_OnOpen()
{
AutomationHelper.syncContext.Post(async o =>
{
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
Log.Debug("WebSocketClient_OnOpen::begin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
LabelStatusBar.Content = "Connected to " + Config.local.wsurl;
TokenUser user = null;
while (user == null)
Expand All @@ -637,8 +641,11 @@ private void WebSocketClient_OnOpen()
{
try
{
Log.Debug("Signing in as " + Config.local.username);
LabelStatusBar.Content = "Connected to " + Config.local.wsurl + " signing in as " + Config.local.username + " ...";
Log.Debug("Signing in as " + Config.local.username + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
user = await global.webSocketClient.Signin(Config.local.username, Config.local.UnprotectString(Config.local.password));
Log.Debug("Signed in as " + Config.local.username + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
LabelStatusBar.Content = "Connected to " + Config.local.wsurl + " as " + user.name;
}
catch (Exception ex)
{
Expand Down Expand Up @@ -677,10 +684,11 @@ private void WebSocketClient_OnOpen()
{
var host = Environment.MachineName.ToLower();
var fqdn = System.Net.Dns.GetHostEntry(Environment.MachineName).HostName.ToLower();
Log.Debug("Registering robot in robot." + Config.local.username + " queue");
Log.Debug("Registering robot in robot." + Config.local.username + " queue " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
await global.webSocketClient.RegisterQueue("robot." + Config.local.username);
Log.Debug("Registering robot in robot." + fqdn + " queue");
Log.Debug("Registering robot in robot." + fqdn + " queue " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
await global.webSocketClient.RegisterQueue("robot." + fqdn);
Log.Debug("Registering robot conplete " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
}
catch (Exception ex)
{
Expand All @@ -694,10 +702,11 @@ private void WebSocketClient_OnOpen()

if (Projects.Count != 0) return;

Log.Debug("Get workflows from server");
Log.Debug("Get workflows from server " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
var workflows = await global.webSocketClient.Query<Workflow>("openrpa", "{_type: 'workflow'}");
Log.Debug("Get projects from server");
Log.Debug("Get projects from server " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
var projects = await global.webSocketClient.Query<Project>("openrpa", "{_type: 'project'}");
Log.Debug("Done getting workflows and projects " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));


var folders = new List<string>();
Expand All @@ -722,13 +731,16 @@ private void WebSocketClient_OnOpen()
p.Workflows.Add(workflow);
}
}
Log.Debug("Saving project " + p.name + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
p.SaveFile();
Projects.Add(p);
}
foreach(var workflow in workflows)
Log.Debug("RunPendingInstances::begin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
foreach (var workflow in workflows)
{
await workflow.RunPendingInstances();
}
Log.Debug("RunPendingInstances::end " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
if (workflows.Count() == 0 && projects.Count() == 0)
{
var _Projects = Project.loadProjects(Extensions.projectsDirectory);
Expand Down Expand Up @@ -756,6 +768,7 @@ private void WebSocketClient_OnOpen()
Log.Error(ex, "");
MessageBox.Show("WebSocketClient_OnOpen::Sync projects " + ex.Message);
}
Log.Debug("WebSocketClient_OnOpen::end " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
LabelStatusBar.Content = "Connected to " + Config.local.wsurl + " as " + user.name;
if (Projects.Count > 0)
{
Expand Down

0 comments on commit d7c0b73

Please sign in to comment.