コード例 #1
0
        private async void ButtonInstall(object sender, RoutedEventArgs e)
        {
            PackageModel SelectedValue = listPackages.SelectedValue as PackageModel;

            if (SelectedValue == null)
            {
                return;
            }
            listPackages.SelectedValue = null;
            listPackages.IsEnabled     = false;
            await InstallPackageAsync(SelectedValue.Package);

            listPackages.IsEnabled     = true;
            listPackages.SelectedValue = SelectedValue;
        }
コード例 #2
0
        private async Task UpgradePackageAsync(PackageModel SelectedValue)
        {
            if (SelectedValue == null)
            {
                return;
            }
            var exists = packageManager.LocalRepository.FindPackage(SelectedValue.Package.Id);

            if (exists != null)
            {
                listPackages.SelectedValue = null;
                listPackages.IsEnabled     = false;
                await Task.Run(() =>
                {
                    try
                    {
                        //packageManager.UpdatePackage(exists, true, false);
                        packageManager.UpdatePackage(exists.Id, new SemanticVersion(SelectedValue.LatestVersion), false, false);
                        exists = packageManager.LocalRepository.FindPackage(SelectedValue.Package.Id);
                        SelectedValue.canUpgrade = false;
                        PackageInstalled(null, new PackageOperationEventArgs(exists, FileSystem, RepositoryPath + @"\" + exists.Id + "." + exists.Version.ToString()));
                        InstallPackageDependencies(TargetFramework, exists);
                    }
                    catch (Exception ex)
                    {
                        logger.Log(MessageLevel.Error, ex.ToString());
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                    }
                    finally
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            listPackages.IsEnabled     = true;
                            listPackages.SelectedValue = SelectedValue;
                        });
                        LoadPackages();
                    }
                });
            }
        }
コード例 #3
0
        private void ButtonUninstall(object sender, RoutedEventArgs e)
        {
            PackageModel SelectedValue = listPackages.SelectedValue as PackageModel;

            if (SelectedValue == null)
            {
                return;
            }
            var exists = packageManager.LocalRepository.FindPackage(SelectedValue.Package.Id);

            if (exists != null)
            {
                listPackages.SelectedValue = null;
                listPackages.IsEnabled     = false;
                Task.Run(() =>
                {
                    try
                    {
                        packageManager.UninstallPackage(exists);
                    }
                    catch (Exception ex)
                    {
                        logger.Log(MessageLevel.Error, ex.ToString());
                        logger.Logs = ex.ToString() + Environment.NewLine + logger.Logs;
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                    }
                    finally
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            listPackages.IsEnabled     = true;
                            listPackages.SelectedValue = SelectedValue;
                        });
                        LoadPackages();
                    }
                });
            }
        }
コード例 #4
0
        public void LoadPackages(string searchString = "OpenRPA")
        {
            var result = new List <PackageModel>();

            foreach (var m in Packages)
            {
                result.Add(m);
            }
            Task.Run(async() =>
            {
                var packagesearch = await OpenRPAPackageManager.Instance.Search(searchString);
                foreach (var p in packagesearch)
                {
                    var exists = result.Where(x => x.Package.Identity.Id == p.Identity.Id).FirstOrDefault();
                    if (exists == null)
                    {
                        PackageModel m = new PackageModel()
                        {
                            Package = p, canUpgrade = false, isDownloaded = false
                        };
                        m.LocalPackage = OpenRPAPackageManager.Instance.GetLocal(p.Identity.Id);
                        result.Add(m);
                    }
                    else
                    {
                        exists.LocalPackage = OpenRPAPackageManager.Instance.GetLocal(p.Identity.Id);
                    }
                }
                foreach (var m in result)
                {
                    if (m.LocalPackage != null)
                    {
                        await Dispatcher.Invoke(async() =>
                        {
                            try
                            {
                                m.isDownloaded = true;
                                m.isInstalled  = await OpenRPAPackageManager.Instance.IsPackageInstalled(m.LocalPackage);
                                m.canUpgrade   = m.Version > m.LocalPackage.Identity.Version;
                            }
                            catch (Exception ex)
                            {
                                OpenRPAPackageManagerLogger.Instance.LogError(ex.ToString());
                            }
                        });
                    }
                }
                Dispatcher.Invoke(() =>
                {
                    foreach (var p in result)
                    {
                        var exists = Packages.Where(x => x.Package.Identity.Id == p.Package.Identity.Id).FirstOrDefault();
                        if (exists == null)
                        {
                            Packages.Add(p);
                        }
                        if (exists != null)
                        {
                            p.NotifyPropertyChanged("Image");
                            p.NotifyPropertyChanged("Name");
                            p.NotifyPropertyChanged("IsNotDownloaded");
                            p.NotifyPropertyChanged("isDownloaded");
                            p.NotifyPropertyChanged("canUpgrade");
                            p.NotifyPropertyChanged("isDownloaded");
                            p.NotifyPropertyChanged("Name");
                            p.NotifyPropertyChanged("InstalledVersionString");
                            p.NotifyPropertyChanged("LatestVersion");
                            p.NotifyPropertyChanged("LatestVersion");
                        }
                    }
                    ButtonUpdateAll.IsEnabled = result.Where(x => x.canUpgrade == true).Count() > 0;
                });

                if (!System.IO.Directory.Exists(OpenRPAPackageManager.Instance.Destinationfolder) || !System.IO.File.Exists(OpenRPAPackageManager.Instance.Destinationfolder + @"\OpenRPA.exe"))
                {
                    if (FirstRun)
                    {
                        FirstRun         = false;
                        var dialogResult = MessageBox.Show("Install OpenRPA and most common packages?", "First run", MessageBoxButton.YesNo);
                        if (dialogResult == MessageBoxResult.Yes)
                        {
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA").First().Package.Identity);
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.IE").First().Package.Identity);
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.NM").First().Package.Identity);
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.Forms").First().Package.Identity);
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.Script").First().Package.Identity);
                            if (IsOfficeInstalled())
                            {
                                await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.Office").First().Package.Identity);
                            }
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.AviRecorder").First().Package.Identity);
                            await OpenRPAPackageManager.Instance.DownloadAndInstall(result.Where(x => x.Package.Identity.Id == "OpenRPA.FileWatcher").First().Package.Identity);
                        }
                        LoadPackages();
                        ButtonLaunch(null, null);
                    }
                }
                bussy = bussy;

                //                // IPackageRepository localRepository = PackageRepositoryFactory.Default.CreateRepository(RepositoryPath);
                //                PackageModel m = null;
                //                foreach (var p in packageManager.LocalRepository.GetPackages())
                //                {
                //                    if (p.Id.ToLower() == "openrpa" || p.Id.ToLower().StartsWith("openrpa."))
                //                    {
                //                        this.Dispatcher.Invoke(() =>
                //                        {
                //                            m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                //                            if (m == null)
                //                            {
                //                                m = new PackageModel() { Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version };
                //                                m.LatestVersion = p.Version.ToString();
                //                                Packages.Add(m);
                //                            }
                //                            else
                //                            {
                //                                if (new Version(p.Version.ToString()) > new Version(m.Version.ToString())) { m.Version = p.Version; m.LatestVersion = p.Version.ToString(); m.Package = p; }
                //                            }
                //                        });
                //                        m.isDownloaded = true;
                //                        if (!m.isInstalled) m.isInstalled = IsPackageInstalled(p);
                //                    }
                //                }
                //                foreach (var p in Packages)
                //                {
                //                    var id = p.Package.Id.ToString();
                //                    var exists = packages.Where(x => x.Id == p.Package.Id && new Version(x.Version.ToString()) > new Version(p.Version.ToString())).FirstOrDefault();
                //                    if (exists != null)
                //                    {
                //                        if (new Version(exists.Version.ToString()) > new Version(p.Version.ToString()))
                //                        {
                //                            p.canUpgrade = true;
                //                            p.LatestVersion = exists.Version.ToString();
                //                        }

                //                    }
                //                }
                //                foreach (var p in packages)
                //                {
                //                    if (p.Id.ToLower().Contains("openrpa.interfaces") || p.Id.ToLower().Contains("openrpa.namedpipewrapper")) continue;
                //                    this.Dispatcher.Invoke(() =>
                //                    {
                //                        m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                //                        if (m == null)
                //                        {
                //                            m = new PackageModel() { Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version };
                //                            m.LatestVersion = p.Version.ToString();
                //                            Packages.Add(m);
                //                        }
                //                        var exists = packageManager.LocalRepository.FindPackage(p.Id);
                //                        m.isDownloaded = (exists != null);
                //                        if (m.isDownloaded && !m.isInstalled) m.isInstalled = IsPackageInstalled(p);
                //                    });
                //                }
                //                foreach (var p in packageManager.LocalRepository.GetPackages())
                //                {
                //                    // if (p.Id.ToLower().Contains("openrpa.interfaces") || p.Id.ToLower().Contains("openrpa.namedpipewrapper")) continue;

                //                    this.Dispatcher.Invoke(() =>
                //                    {
                //                        m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                //                        if (m == null)
                //                        {
                //                            m = new PackageModel() { Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version };
                //                            m.LatestVersion = p.Version.ToString();
                //                            Packages.Add(m);
                //                        }
                //                    });

                //                    m.isDownloaded = true;
                //                    if (!m.isInstalled) m.isInstalled = IsPackageInstalled(p);
                //                }
                //                this.Dispatcher.Invoke(() =>
                //                {
                //                    ButtonUpdateAll.IsEnabled = false;
                //                });
                //                //if (!System.IO.Directory.Exists(RepositoryPath) && !System.IO.Directory.Exists(InstallPath))
                //                if (!System.IO.Directory.Exists(InstallPath) || !System.IO.File.Exists(InstallPath + @"\OpenRPA.exe"))
                //                {
                //                    FirstRun = false;
                //                    var dialogResult = MessageBox.Show("Install OpenRPA and most common packages?", "First run", MessageBoxButton.YesNo);
                //                    if (dialogResult == MessageBoxResult.Yes)
                //                    {
                //                        this.Dispatcher.Invoke(() =>
                //                        {
                //                            listPackages.IsEnabled = false;
                //                            listPackages.SelectedValue = null;
                //                        });
                //                        try
                //                        {
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.IE").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.NM").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Java").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Forms").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Script").FirstOrDefault());
                //                            if (IsOfficeInstalled())
                //                            {
                //                                await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Office").FirstOrDefault());
                //                            }
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.AviRecorder").FirstOrDefault());
                //                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.FileWatcher").FirstOrDefault());
                //                        }
                //                        catch (Exception ex)
                //                        {
                //                            MessageBox.Show(ex.ToString());
                //                        }
                //                        this.Dispatcher.Invoke(() =>
                //                        {
                //                            listPackages.IsEnabled = true;
                //                            ButtonLaunch(null, null);
                //                        });
                //                    }
                //                } else if(FirstRun) {
                //                    FirstRun = false;
                //                    int UpgradeCount = Packages.Where(x => x.canUpgrade).Count();
                //                    bool hasUpgrades = (UpgradeCount > 0);
                //                    if (hasUpgrades)
                //                    {
                //                        var dialogResult = MessageBox.Show(UpgradeCount + " packages has updates, update all ?", "Upgrades available", MessageBoxButton.YesNo);
                //                        if (dialogResult == MessageBoxResult.Yes)
                //                        {
                //                            ButtonUpdateAllClick(null, null);
                //                        }
                //                        else
                //                        {
                //                            this.Dispatcher.Invoke(() =>
                //                            {
                //                                ButtonUpdateAll.IsEnabled = true;
                //                            });

                //                        }
                //                    }

                //                }
            });
        }
コード例 #5
0
        public void LoadPackages()
        {
            ReloadPackageManager();
            Task.Run(async() =>
            {
                List <IPackage> packages;
                IPackage ip;
#if DEBUG
                // packages = repo.GetPackages().ToList();
                // packages = repo.Search("OpenRPA", false).ToList();

                packages = new List <IPackage>();
                ip       = packageManager.SourceRepository.FindPackage("OpenRPA"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.AviRecorder"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.ExpressionEditor"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.FileWatcher"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Forms"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.IE"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Image"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Interfaces"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Java"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.JavaBridge"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NamedPipeWrapper"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NativeMessagingHost"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Net"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NM"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Office"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Script"); if (ip != null)
                {
                    packages.Add(ip);
                }
                // ip = packageManager.SourceRepository.FindPackage("OpenRPA.Updater"); if(ip!=null) packages.Add(ip);
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Windows"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.WindowsAccessBridgeInterop"); if (ip != null)
                {
                    packages.Add(ip);
                }
#else
                // packages = repo.Search("OpenRPA.*", false).ToList();

                packages = new List <IPackage>();
                ip       = packageManager.SourceRepository.FindPackage("OpenRPA"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.AviRecorder"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.ExpressionEditor"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.FileWatcher"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Forms"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.IE"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Image"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Interfaces"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Java"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.JavaBridge"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NamedPipeWrapper"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NativeMessagingHost"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Net"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.NM"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Office"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Script"); if (ip != null)
                {
                    packages.Add(ip);
                }
                // ip = packageManager.SourceRepository.FindPackage("OpenRPA.Updater"); if(ip!=null) packages.Add(ip);
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.Windows"); if (ip != null)
                {
                    packages.Add(ip);
                }
                ip = packageManager.SourceRepository.FindPackage("OpenRPA.WindowsAccessBridgeInterop"); if (ip != null)
                {
                    packages.Add(ip);
                }
#endif

                // IPackageRepository localRepository = PackageRepositoryFactory.Default.CreateRepository(RepositoryPath);
                PackageModel m = null;
                foreach (var p in packageManager.LocalRepository.GetPackages())
                {
                    if (p.Id.ToLower() == "openrpa" || p.Id.ToLower().StartsWith("openrpa."))
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                            if (m == null)
                            {
                                m = new PackageModel()
                                {
                                    Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version
                                };
                                m.LatestVersion = p.Version.ToString();
                                Packages.Add(m);
                            }
                            else
                            {
                                if (new Version(p.Version.ToString()) > new Version(m.Version.ToString()))
                                {
                                    m.Version = p.Version; m.LatestVersion = p.Version.ToString(); m.Package = p;
                                }
                            }
                        });
                        m.isDownloaded = true;
                        if (!m.isInstalled)
                        {
                            m.isInstalled = isPackageInstalled(p);
                        }
                    }
                }
                foreach (var p in Packages)
                {
                    var id     = p.Package.Id.ToString();
                    var exists = packages.Where(x => x.Id == p.Package.Id && new Version(x.Version.ToString()) > new Version(p.Version.ToString())).FirstOrDefault();
                    if (exists != null)
                    {
                        if (new Version(exists.Version.ToString()) > new Version(p.Version.ToString()))
                        {
                            p.canUpgrade    = true;
                            p.LatestVersion = exists.Version.ToString();
                        }
                    }
                }
                foreach (var p in packages)
                {
                    if (p.Id.ToLower().Contains("openrpa.interfaces") || p.Id.ToLower().Contains("openrpa.namedpipewrapper"))
                    {
                        continue;
                    }
                    this.Dispatcher.Invoke(() =>
                    {
                        m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                        if (m == null)
                        {
                            m = new PackageModel()
                            {
                                Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version
                            };
                            m.LatestVersion = p.Version.ToString();
                            Packages.Add(m);
                        }
                        var exists     = packageManager.LocalRepository.FindPackage(p.Id);
                        m.isDownloaded = (exists != null);
                        if (m.isDownloaded && !m.isInstalled)
                        {
                            m.isInstalled = isPackageInstalled(p);
                        }
                    });
                }
                foreach (var p in packageManager.LocalRepository.GetPackages())
                {
                    // if (p.Id.ToLower().Contains("openrpa.interfaces") || p.Id.ToLower().Contains("openrpa.namedpipewrapper")) continue;

                    this.Dispatcher.Invoke(() =>
                    {
                        m = Packages.Where(x => x.Package.Id == p.Id).FirstOrDefault();
                        if (m == null)
                        {
                            m = new PackageModel()
                            {
                                Package = p, canUpgrade = false, isDownloaded = false, Version = p.Version
                            };
                            m.LatestVersion = p.Version.ToString();
                            Packages.Add(m);
                        }
                    });

                    m.isDownloaded = true;
                    if (!m.isInstalled)
                    {
                        m.isInstalled = isPackageInstalled(p);
                    }
                }
                this.Dispatcher.Invoke(() =>
                {
                    ButtonUpdateAll.IsEnabled = false;
                });
                //if (!System.IO.Directory.Exists(RepositoryPath) && !System.IO.Directory.Exists(InstallPath))
                if (!System.IO.Directory.Exists(InstallPath) || !System.IO.File.Exists(InstallPath + @"\OpenRPA.exe"))
                {
                    FirstRun         = false;
                    var dialogResult = MessageBox.Show("Install OpenRPA and most common packages?", "First run", MessageBoxButton.YesNo);
                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            listPackages.IsEnabled     = false;
                            listPackages.SelectedValue = null;
                        });
                        try
                        {
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.IE").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.NM").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Java").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Forms").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Script").FirstOrDefault());
                            if (IsOfficeInstalled())
                            {
                                await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.Office").FirstOrDefault());
                            }
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.AviRecorder").FirstOrDefault());
                            await InstallPackageAsync(packages.Where(x => x.Id == "OpenRPA.FileWatcher").FirstOrDefault());
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        this.Dispatcher.Invoke(() =>
                        {
                            listPackages.IsEnabled = true;
                            ButtonLaunch(null, null);
                        });
                    }
                }
                else if (FirstRun)
                {
                    FirstRun         = false;
                    int UpgradeCount = Packages.Where(x => x.canUpgrade).Count();
                    bool hasUpgrades = (UpgradeCount > 0);
                    if (hasUpgrades)
                    {
                        var dialogResult = MessageBox.Show(UpgradeCount + " packages has updates, update all ?", "Upgrades available", MessageBoxButton.YesNo);
                        if (dialogResult == MessageBoxResult.Yes)
                        {
                            ButtonUpdateAllClick(null, null);
                        }
                        else
                        {
                            this.Dispatcher.Invoke(() =>
                            {
                                ButtonUpdateAll.IsEnabled = true;
                            });
                        }
                    }
                }
            });
        }