コード例 #1
0
ファイル: App.xaml.cs プロジェクト: arkll/openrpa
 private async void Application_Startup(object sender, StartupEventArgs e)
 {
     if (Config.local.showloadingscreen)
     {
         splash = new Views.SplashScreen();
         splash.Show();
         splash.BusyContent = "Loading main window";
     }
     AutomationHelper.syncContext = System.Threading.SynchronizationContext.Current;
     System.Threading.Thread.CurrentThread.Name = "UIThread";
     if (!Config.local.isagent)
     {
         RobotInstance.instance.MainWindow = new MainWindow();
         RobotInstance.instance.Window     = RobotInstance.instance.MainWindow;
         RobotInstance.instance.MainWindow.ReadyForAction += RobotInstance.instance.MainWindowReadyForAction;
         RobotInstance.instance.MainWindow.Status         += RobotInstance.instance.MainWindowStatus;
         GenericTools.MainWindow = RobotInstance.instance.MainWindow;
         MainWindow = RobotInstance.instance.MainWindow;
         if (!Config.local.showloadingscreen)
         {
             notifyIcon.Visible = true;
         }
     }
     else
     {
         RobotInstance.instance.AgentWindow = new AgentWindow();
         RobotInstance.instance.Window      = RobotInstance.instance.AgentWindow;
         RobotInstance.instance.AgentWindow.ReadyForAction += RobotInstance.instance.MainWindowReadyForAction;
         RobotInstance.instance.AgentWindow.Status         += RobotInstance.instance.MainWindowStatus;
         GenericTools.MainWindow = RobotInstance.instance.AgentWindow;
         MainWindow         = RobotInstance.instance.AgentWindow;
         notifyIcon.Visible = true;
     }
     RobotInstance.instance.Status += App_Status;
     Input.InputDriver.Instance.initCancelKey(Config.local.cancelkey);
     await Task.Run(() =>
     {
         try
         {
             if (Config.local.showloadingscreen)
             {
                 splash.BusyContent = "loading plugins";
             }
             Plugins.LoadPlugins(RobotInstance.instance, Interfaces.Extensions.PluginsDirectory);
             if (Config.local.showloadingscreen)
             {
                 splash.BusyContent = "Initialize main window";
             }
             RobotInstance.instance.init();
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.ToString());
         }
     });
 }
コード例 #2
0
 private async void Application_Startup(object sender, StartupEventArgs e)
 {
     if (Config.local.showloadingscreen)
     {
         splash         = new Views.SplashScreen();
         splash.Topmost = false;
         splash.Show();
         splash.BusyContent = "Loading main window";
     }
     AutomationHelper.syncContext = System.Threading.SynchronizationContext.Current;
     System.Threading.Thread.CurrentThread.Name = "UIThread";
     if (!Config.local.isagent)
     {
         if (!Config.local.showloadingscreen)
         {
             notifyIcon.Visible = true;
         }
     }
     else
     {
         notifyIcon.Visible = true;
     }
     if (Config.local.files_pending_deletion.Length > 0)
     {
         bool sucess = true;
         foreach (var f in Config.local.files_pending_deletion)
         {
             try
             {
                 if (System.IO.File.Exists(f))
                 {
                     System.IO.File.Delete(f);
                 }
             }
             catch (Exception ex)
             {
                 sucess = false;
                 Log.Error(ex.ToString());
             }
         }
         if (sucess)
         {
             Config.local.files_pending_deletion = new string[] { };
             Config.Save();
         }
     }
     RobotInstance.instance.Status += App_Status;
     Input.InputDriver.Instance.initCancelKey(Config.local.cancelkey);
     await Task.Run(async() =>
     {
         try
         {
             if (Config.local.showloadingscreen)
             {
                 splash.BusyContent = "loading plugins";
             }
             // Plugins.LoadPlugins(RobotInstance.instance, Interfaces.Extensions.ProjectsDirectory);
             Plugins.LoadPlugins(RobotInstance.instance, Interfaces.Extensions.PluginsDirectory, false);
             if (Config.local.showloadingscreen)
             {
                 splash.BusyContent = "Initialize main window";
             }
             await RobotInstance.instance.init();
         }
         catch (Exception ex)
         {
             Log.Error(ex.ToString());
             Console.WriteLine(ex.ToString());
         }
     });
 }