Esempio n. 1
0
        public async Task InstallAsync(IRPackageViewModel package)
        {
            await _coreShell.SwitchToMainThreadAsync();

            if (package.IsInstalled || package.IsChanging)
            {
                return;
            }

            package.IsChanging = true;

            if (_selectedTab == SelectedTab.InstalledPackages)
            {
                IsLoading = true;
            }

            try {
                var libPath = await GetLibPath();

                await _packageManager.InstallPackageAsync(package.Name, libPath);
            } catch (RPackageManagerException ex) {
                AddErrorMessage(ex.Message);
            }

            await ReloadInstalledAndLoadedPackagesAsync();

            if (_selectedTab == SelectedTab.InstalledPackages)
            {
                IsLoading = false;
                ReplaceItems(_installedPackages);
            }
            package.IsChanging = false;
        }
Esempio n. 2
0
        public async Task InstallAsync(IRPackageViewModel package)
        {
            await _coreShell.SwitchToMainThreadAsync();

            if (package.IsInstalled || package.IsChanging)
            {
                return;
            }

            BeforeLoadUnload(package);
            var startingTab = _selectedTab;

            try {
                var libPath = await _packageManager.GetLibraryPathAsync();

                await _packageManager.InstallPackageAsync(package.Name, libPath);
            } catch (RHostDisconnectedException) {
                AddErrorMessage(string.Format(CultureInfo.CurrentCulture, Resources.PackageManager_CantInstallPackageNoRSession, package.Name));
            } catch (RPackageManagerException ex) {
                AddErrorMessage(ex.Message);
            }

            await ReloadInstalledAndLoadedPackagesAsync();
            await AfterLoadUnloadAsync(package, startingTab);
        }