Пример #1
0
        void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            var backgroundWorker  = sender as BackgroundWorker;
            var destinationFolder = Environment.SpecialFolder.ApplicationData;

            if (localAppDataBtn.Checked)
            {
                destinationFolder = Environment.SpecialFolder.LocalApplicationData;
            }
            else if (commonAppDataBtn.Checked)
            {
                destinationFolder = Environment.SpecialFolder.CommonApplicationData;
            }
            if (backgroundWorker != null)
            {
                _installService.DeployPackage(backgroundWorker.ReportProgress, destinationFolder);
            }
        }
Пример #2
0
        private static void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var backgroundWorker = sender as BackgroundWorker;


            foreach (var plugin in PluginPackages)
            {
                var notSupportedVersions = _studioVersionService.GetNotSupportedStudioVersions(plugin);
                var selectedVersion      = string.Empty;

                switch (Dpo.Version)
                {
                case SelectedVersion.Studio2:
                    selectedVersion = "Studio2";
                    break;

                case SelectedVersion.Studio3:
                    selectedVersion = "Studio3";
                    break;

                case SelectedVersion.Studio4:
                    selectedVersion = "Studio4";
                    break;

                case SelectedVersion.Studio5:
                    selectedVersion = "Studio5";
                    break;

                case SelectedVersion.Studio6:
                    selectedVersion = "Studio6";
                    break;
                }

                var notSupported = notSupportedVersions.FirstOrDefault(v => v.Version == selectedVersion);
                if (notSupported != null)
                {
                    Console.WriteLine(@"Selected studio version {0} is not compatible with the plugin version {1}", notSupported.PublicVersion, plugin.Version);
                }
                else
                {
                    Console.WriteLine(@"Deploy started for following plugin: {0}", plugin.PluginName);

                    _shown40 = false;
                    _shown80 = false;

                    var installService = new InstallService(plugin, _installedStudioVersions);
                    var deployLocation = new Environment.SpecialFolder();
                    switch (Dpo.DeployLocation)
                    {
                    case DeployDestination.Local:
                        deployLocation = Environment.SpecialFolder.LocalApplicationData;
                        break;

                    case DeployDestination.ProgramData:
                        deployLocation = Environment.SpecialFolder.CommonApplicationData;
                        break;

                    case DeployDestination.Roaming:

                        deployLocation = Environment.SpecialFolder.ApplicationData;
                        break;
                    }

                    if (backgroundWorker != null)
                    {
                        installService.DeployPackage(backgroundWorker.ReportProgress, deployLocation);
                    }
                }
            }
        }