コード例 #1
0
ファイル: App.xaml.cs プロジェクト: uzbekdev1/openrpa
 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)
         {
             Console.WriteLine(ex.ToString());
         }
     });
 }