Example #1
0
        private void RefreshInstalledPackages()
        {
            // "Fetching installed packages..."
            MetroUtils.WithLongOperation(ParentForm,
                                         progressForm => { progressForm.Text = "Fetching installed packages..."; },
                                         handle =>
            {
                var metaLog = MetaPackServiceContainer.Instance.GetService <TraceServiceBase>()
                              as MetaPackUITraceService;

                EventHandler <TraceServiceEventArgs> onLogHandler = (sender, args) =>
                {
                    if (handle != null)
                    {
                        handle.Output(args.Message);
                    }
                };

                WithSafeUIUpdate(() =>
                {
                    var activeConnection = AppService.ActiveSharePointConnection;
                    var url = activeConnection.Url;

                    AppDesktopService.SetApplicationTitle(string.Format("{0} connecting to {1}",
                                                                        AppDesktopService.AppName, url));
                });

                ShAsync.DoAsync(new ShAsyncOptions
                {
                    Do = () =>
                    {
                        metaLog.OnTrace += onLogHandler;

                        _tmpAllPackagesFetch = false;
                        _tmpAllPackages      = MpCommands.Instance.FetchInstalledNuGetPackages();
                    },
                    OnDone = () =>
                    {
                        metaLog.OnTrace -= onLogHandler;
                        handle.End();
                        _tmpAllPackagesFetch = true;

                        WithSafeUIUpdate(() =>
                        {
                            var activeConnection = AppService.ActiveSharePointConnection;
                            var url = activeConnection.Url;

                            AppDesktopService.SetApplicationTitle(string.Format("{0} on {1}",
                                                                                AppDesktopService.AppName, url));
                        });
                    }
                });
            });
        }
Example #2
0
        protected void RefreshAvailablePackages(string search, bool incluePrerelease)
        {
            grData.Enabled = false;

            //  "Fetching available packages...",
            MetroUtils.WithLongOperation(this.ParentForm,
                                         progressForm =>
            {
                progressForm.Text = "Fetching available packages...";
            }, handle =>
            {
                handle.Output("Fetching available packages...");

                InternalAsyncRefresh(search, incluePrerelease, () =>
                {
                    handle.End();
                });
            });
        }