Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.welcomePage.Description =
                string.Format(@"This wizard will guide you through the steps of installing {0} plugin",
                              _pluginPackageInfo.PluginName);


            textLicense.Rtf = Resources._160627__SDL_AppStore_End_User_Terms__Conditions_July_29_2016_Final;

            var installedStudioVersions = _studioVersionService.GetInstalledStudioVersions();

            if (installedStudioVersions.Count == 0)
            {
                this.finalPage.Description             = string.Format("There are no versions of SDL Trados Studio installed.");
                this.pluginInstallWizzard.SelectedPage = this.finalPage;
            }

            studioVersionColumn.AspectGetter = delegate(object rowObject)
            {
                var studioVersion = (StudioVersion)rowObject;
                return(string.Format("{0} - {1}", string.IsNullOrEmpty(studioVersion.Edition) ? studioVersion.PublicVersion : studioVersion.PublicVersion + " " + studioVersion.Edition, studioVersion.ExecutableVersion));
            };

            chkStudioVersions.SetObjects(installedStudioVersions);
            var versionsNotSupportedByPlugin = _studioVersionService.GetNotSupportedStudioVersions(_pluginPackageInfo); chkStudioVersions.DisableObjects(versionsNotSupportedByPlugin);

            chkStudioVersions.BuildList(true);
            appDataBtn.Checked = true;
            _bw = new BackgroundWorker {
                WorkerSupportsCancellation = true, WorkerReportsProgress = true
            };
            _bw.ProgressChanged    += bw_ProgressChanged;
            _bw.DoWork             += bw_DoWork;
            _bw.RunWorkerCompleted += bw_RunWorkerCompleted;

            //tooltips for radio buttons

            var appDataToolTip = new ToolTip();

            appDataToolTip.SetToolTip(appDataBtn, "This location should be used if you want the plugin to be available to all your domain machines.");

            var localAppDataToolTip = new ToolTip();

            localAppDataToolTip.SetToolTip(localAppDataBtn, "Install only for the current user");

            var commonToolTip = new ToolTip();

            commonToolTip.SetToolTip(commonAppDataBtn, "Install for all users of this local machine (requires Administrator rights)");
        }
Пример #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);
                    }
                }
            }
        }