private void PerformPackageDeploymentAsync(ShModalDialogControlClosingEventArgs e, NuGetPackageDeploymentViewModel model)
        {
            TraceService.OnTrace += onLogHandler;

            ShAsync.DoAsync(new ShAsyncOptions
            {
                Do = () =>
                {
                    var count = 10;

                    e.Control.TsEnableOkButton(false);
                    e.Control.TsEnableCancelButton(false);

                    try
                    {
                        DeployNuGetPackageInternal(
                            model.SharePointConnection.Dto,
                            model.NuGetPackage.Package,
                            model.IsForceDeploy);
                    }
                    finally
                    {
                        e.Control.TsEnableOkButton(true);
                        e.Control.TsEnableCancelButton(true);

                        TraceService.OnTrace -= onLogHandler;
                    }
                },
                OnDone = () =>
                {
                }
            });
        }
예제 #2
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));
                        });
                    }
                });
            });
        }
예제 #3
0
        private void InternalAsyncRefresh(string search, bool incluePrerelease, Action onFinished)
        {
            ShAsync.DoAsync(new ShAsyncOptions
            {
                Do = () =>
                {
                    _tmpAllPackagesFetch = false;
                    _tmpAllPackages      = MpCommands.Instance.FetchAvailableNuGetPackages(search, incluePrerelease);
                },
                OnDone = () =>
                {
                    _tmpAllPackagesFetch = true;

                    if (onFinished != null)
                    {
                        onFinished();
                    }
                }
            });
        }