Beispiel #1
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            WebProxyHelper.ApplyProxy();

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

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

            blackScreen.SetWorkingMessage("Loading plugins...");
            DisplayPlugins();

            var tasks = new List <Task>
            {
                LaunchVersionCheck()
            };

            if (!string.IsNullOrEmpty(initialConnectionName))
            {
                var connectionDetail = ConnectionManager.Instance.ConnectionsList.Connections.FirstOrDefault(x => x.ConnectionName == 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(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(initialPluginName))
                    {
                        StartPluginWithoutConnection();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(initialPluginName))
            {
                // If there is no initial connection, but initial plugin is set, openning plugin
                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();

            // Hide & remove Welcome screen
            Opacity = 100;
            blackScreen.Hide();
            blackScreen.Dispose();

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

            if (currentOptions.DisplayPluginsStoreOnStartup)
            {
                if (currentOptions.DisplayPluginsStoreOnlyIfUpdates)
                {
                    if (store == null)
                    {
                        store = new Store();
                    }

                    if (store.Packages == null)
                    {
                        store.LoadNugetPackages();
                    }

                    if (store.Packages.Any(p => p.Action == PluginsStore.PackageInstallAction.Update))
                    {
                        pbOpenPluginsStore_Click(sender, e);
                    }
                }
                else
                {
                    pbOpenPluginsStore_Click(sender, e);
                }
            }

            Action action = CheckForPluginsUpdate;

            action.BeginInvoke(ar => action.EndInvoke(ar), null);

            tstxtFilterPlugin.Focus();
        }
Beispiel #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);
            }
        }
Beispiel #3
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            this.Opacity = 0;

            tstxtFilterPlugin.Focus();

            pManager = new PluginManagerExtended(this);
            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()
            };

            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();
            }
        }