예제 #1
0
 private void pbOpenPluginsStore_Click(object sender, EventArgs e)
 {
     var pc = new PluginsChecker();
     pc.ShowDialog(this);
 }
예제 #2
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            this.Opacity = 0;

            tstxtFilterPlugin.Focus();

            pManager = new PluginManagerExtended(this) { IsWatchingForNewPlugins = true };
            pManager.Initialize();
            pManager.PluginsListUpdated += pManager_PluginsListUpdated;

            tstxtFilterPlugin.AutoCompleteCustomSource.AddRange(pManager.Plugins.Select(p => p.Metadata.Name).ToArray());

            this.DisplayPlugins();

            var tasks = new List<Task>
            {
                this.LaunchWelcomeDialog(),
                this.CheckForPluginsUpdate(),
            };

            //if (!Debugger.IsAttached)
            //{
            tasks.Add(this.LaunchVersionCheck());
            //}

            if (!string.IsNullOrEmpty(this.initialConnectionName))
            {
                var connectionDetail = ConnectionManager.Instance.ConnectionsList.Connections.FirstOrDefault(x => x.ConnectionName == this.initialConnectionName); ;

                if (connectionDetail != null)
                {
                    // If initiall connection is present, connect to given sever is initiated.
                    // After connection try to open intial plugin will be attempted.
                    tasks.Add(this.launchInitialConnection(connectionDetail));
                }
                else
                {
                    // Connection detail was not found, so name provided was incorrect.
                    // But if name of the plugin is set, it should be started
                    if (!string.IsNullOrEmpty(this.initialPluginName))
                    {
                        this.StartPluginWithoutConnection();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(this.initialPluginName))
            {
                // If there is no initial connection, but initial plugin is set, openning plugin
                this.StartPluginWithoutConnection();
            }

            tasks.ForEach(x => x.Start());

            await Task.WhenAll(tasks.ToArray());

            // Adapt size of current form
            if (currentOptions.Size.IsMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                currentOptions.Size.ApplyFormSize(this);
            }

            AdaptPluginControlSize();

            WebProxyHelper.ApplyProxy();

            this.Opacity = 100;

            if (!currentOptions.AllowLogUsage.HasValue)
            {
                currentOptions.AllowLogUsage = LogUsage.PromptToLog();
                currentOptions.Save();
            }

            if (currentOptions.DisplayPluginsStoreOnStartup)
            {
                var dlg = new PluginsChecker();
                dlg.ShowDialog(this);
            }
        }
예제 #3
0
 private void tsbPlugins_Click(object sender, EventArgs e)
 {
     var dialog = new PluginsChecker();
     dialog.ShowDialog(this);
 }
예제 #4
0
        private Task CheckForPluginsUpdate()
        {
            return new Task(() => this.Invoke(new Action(() =>
            {
                try
                {
                    var pc = new PluginsChecker();
                    var packages = pc.RetrieveNugetPackages();

                    if (packages.Any(p => p.Action == PackageInstallAction.Update))
                    {
                        var image = pluginsCheckerImageList.Images[3];
                        var text = packages.Count(p => p.Action == PackageInstallAction.Update).ToString();

                        using (Graphics graphics = Graphics.FromImage(image))
                        {
                            using (Font arialFont = new Font("Courrier MS", 8, FontStyle.Bold))
                            {
                                var location = new Point(16 - (text.Length * 9), 5);
                                graphics.DrawString(text, arialFont, Brushes.Black, location);
                            }
                        }
                        
                        tsbPlugins.Image = image;

                        tsbPlugins.ToolTipText = string.Format("{0} new plugins\r\n{1} plugins updates",
                            packages.Count(p => p.Action == PackageInstallAction.Install),
                            packages.Count(p => p.Action == PackageInstallAction.Update));
                    }
                    else
                    {
                        tsbPlugins.Image = pluginsCheckerImageList.Images[2];
                    }
                }
                catch (Exception error)
                {
                    tsbPlugins.ToolTipText = "Failed to retrieve plugins updates: " + error.Message;
                }
            })));
        }