Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            var installedStudioVersions = _studioVersionService.GetInstalledStudioVersions();


            sourceStudioVersionColumn.AspectGetter = delegate(object rowObject)
            {
                var studioVersion = (StudioVersion)rowObject;
                return(string.Format("{0} - {1}", studioVersion.PublicVersion, studioVersion.ExecutableVersion));
            };

            chkSourceStudioVersions.SetObjects(installedStudioVersions);

            destinationStudioVersionColumn.AspectGetter = delegate(object rowObject)
            {
                var studioVersion = (StudioVersion)rowObject;
                return(string.Format("{0} - {1}", studioVersion.PublicVersion, studioVersion.ExecutableVersion));
            };

            chkDestinationStudioVersion.SetObjects(installedStudioVersions);

            projectsNameColumn.AspectGetter = delegate(object rowObject)
            {
                var project = (Project)rowObject;
                return(project.Name);
            };
            _bw = new BackgroundWorker {
                WorkerSupportsCancellation = true, WorkerReportsProgress = true
            };
            _bw.ProgressChanged    += _bw_ProgressChanged;
            _bw.DoWork             += _bw_DoWork;
            _bw.RunWorkerCompleted += _bw_RunWorkerCompleted;
        }
Esempio n. 2
0
        public List <StudioVersion> GetInstalledStudioVersions()
        {
            var studioVersionService    = new StudioVersionService();
            var installedStudioVersions = studioVersionService.GetInstalledStudioVersions();

            return(installedStudioVersions
                   ?.Select(v => new StudioVersion(v.Version, v.PublicVersion, v.Edition)).ToList());
        }
Esempio n. 3
0
        private static void Main(string[] args)
        {
            var parser = new Parser();

            if (parser.ParseArguments(args, Dpo))
            {
                if (!string.IsNullOrEmpty(Dpo.SourcePlugin))
                {
                    var pluginPackageInfo = PluginPackageInfo.CreatePluginPackageInfo(Dpo.SourcePlugin);
                    PluginPackages.Add(pluginPackageInfo);
                }
                if (!string.IsNullOrEmpty(Dpo.FolderPath))
                {
                    var pluginsPath = Directory.GetFiles(Dpo.FolderPath, "*.sdlplugin", SearchOption.AllDirectories);
                    foreach (var plugin in pluginsPath)
                    {
                        var pluginInfo = PluginPackageInfo.CreatePluginPackageInfo(plugin);
                        PluginPackages.Add(pluginInfo);
                    }
                }
                _studioVersionService    = new StudioVersionService();
                _installedStudioVersions = _studioVersionService.GetInstalledStudioVersions();

                var backgroundWorker = new BackgroundWorker
                {
                    WorkerSupportsCancellation = true,
                    WorkerReportsProgress      = true
                };

                backgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
                backgroundWorker.DoWork             += BackgroundWorker_DoWork;
                backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

                if (!backgroundWorker.IsBusy)
                {
                    backgroundWorker.RunWorkerAsync();

                    while (backgroundWorker.IsBusy)
                    {
                        Thread.Sleep(100);
                    }

                    if (Dpo.CloseConsole)
                    {
                        Console.WriteLine(@"Please press q to close the window.");
                        var key = Console.ReadKey();
                        if (key.KeyChar.Equals('q'))
                        {
                            Environment.Exit(0);
                        }
                    }
                }
            }
        }
Esempio n. 4
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)");
        }
Esempio n. 5
0
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                _installedStudioVersions.AddRange(_studioVersionService.GetInstalledStudioVersions());
                _installedStudioVersions.Reverse();

                for (var j = 0; j < _installedStudioVersions.Count; j++)
                {
                    var label = new Label
                    {
                        Text      = string.IsNullOrEmpty(_installedStudioVersions[j].Edition) ? _installedStudioVersions[j].PublicVersion : _installedStudioVersions[j].PublicVersion + " " + _installedStudioVersions[j].Edition,
                        Anchor    = AnchorStyles.Left,
                        Tag       = j,
                        ForeColor = Color.FromArgb(76, 132, 169),
                        Font      = new Font(Font, FontStyle.Regular),
                        AutoSize  = true,
                        Cursor    = Cursors.Hand
                    };
                    label.Click += studioLabel_Click;

                    _labels.Add(label);
                    labelsPanel.Controls.Add(label);
                }

                _labels[0].Font = new Font(_labels[0].Font, FontStyle.Underline);

                installedPluginListView.ShowGroups = false;

                authorColumn.AspectGetter = delegate(object rowObject)
                {
                    var pluginObject = (PluginPackageInfo)rowObject;

                    if (pluginObject.Author == null)
                    {
                        return("N/A");
                    }
                    return(pluginObject.Author);
                };


                minStudioVersionColumn.AspectGetter = delegate(object rowObject)
                {
                    var pluginObject = (PluginPackageInfo)rowObject;
                    return(pluginObject.MinRequiredProductVersion);
                };

                installedPluginListView.CellToolTipShowing   += InstalledPluginListView_CellToolTipShowing;
                installedPluginListView.HeaderToolTipShowing += InstalledPluginListView_HeaderToolTipShowing;
                installedPluginListView.RowHeight             = 50;
                installedPluginListView.FullRowSelect         = true;
                //rendered for Name column
                DescribedTaskRenderer renderer = new DescribedTaskRenderer
                {
                    Aspect = "PluginName",
                    DescriptionAspectName = "Description",
                    DescriptionColor      = Color.Gray,
                    TitleFont             = new Font("Arial", 10, FontStyle.Bold)
                };
                nameColumn.Renderer = renderer;

                uninstallColumn.ButtonSize = new Size
                {
                    Width  = 53,
                    Height = 20
                };


                uninstallColumn.AspectGetter = rowObject => "Uninstall";

                descriptionHeaderLbl.Text =
                    @"All installed plugins are listed below.  Ensure Studio is closed and then click the Uninstall button for the plugins you wish to remove.  Plugins that require Administrator rights for installation will not be listed unless you run this uninstaller with Admin rights.";

                //initialize list view with the first available studio version
                InitializeListView(_installedStudioVersions[0]);

                //creates a label if you need admin rights to see a plugin
                if (_pluginManagementService.NeedsAdminRights())
                {
                    var adminRightsLabel = new Label

                    {
                        Text      = @"There are installed plugins requiring Administrator rights.",
                        ForeColor = Color.Red,
                        Bounds    = new Rectangle(0, 0, 300, 15),
                        Anchor    = AnchorStyles.Left
                    };
                    labelsPanel.Controls.Add(adminRightsLabel);
                }

                installedPluginListView.ButtonClick += InstalledPluginListView_ButtonClick;
            }
            catch (Exception exception)
            {
                _logger.Error(exception, "Error constructing plugin window");
                throw;
            }
        }
Esempio n. 6
0
        public List <StudioVersion> GetInstalledStudioVersion()
        {
            var studioVersionService = new StudioVersionService();

            return(studioVersionService.GetInstalledStudioVersions());
        }