private void InitializeDataService() { if (Connection.AutomaticallyUpdate && !string.IsNullOrEmpty(Connection.WebRootPath)) { UpdateServerComponentsManager.AutomaticUpdate(Connection, Connection.WebRootPath); } dataService = CreateDataService(); var busy = true; var aspxAuthCookieBehavior = new AspxAuthCookieBehavior(GetHostName()); dataService.Endpoint.Behaviors.Add(aspxAuthCookieBehavior); AppHost.Statusbar.SetText(string.Format(Resources.LoginWindow_ControlLoaded_Connecting_to___0______, Connection.HostName)); EventHandler <LoginCompletedEventArgs> completed = delegate(object sender, LoginCompletedEventArgs e) { if (e.Error != null) { if (DisableLoginErrorMessage) { busy = false; dataService = null; return; } Dispatcher.CurrentDispatcher.Invoke(new Action(delegate { var endPoint = dataService != null ? dataService.Endpoint : null; var pipeline = TroubleshooterPipeline.Run().WithParameters(this, true, e.Error, endPoint); if (pipeline.Retry) { if (dataService == null) { dataService = CreateDataService(); } dataService.LoginAsync(GetCredentials()); return; } dataService = null; busy = false; })); return; } var root = e.Result.ToXElement(); if (root.Name == "error") { Dispatcher.CurrentDispatcher.Invoke(new Action <string>(x => { AppHost.MessageBox(x, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); }), root.Value); dataService = null; busy = false; return; } WebServiceVersion = @"0.0.0.0"; SitecoreVersionString = string.Empty; SitecoreVersion = RuntimeVersion.Empty; if (root != null) { LoggedInPipeline.Run().WithParameters(this, root); } busy = false; }; AppHost.DoEvents(); if (dataService != null) { dataService.LoginCompleted += completed; var dispatcherOperation = Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => dataService.LoginAsync(GetCredentials()))); if (!AppHost.DoEvents(ref busy)) { dispatcherOperation.Abort(); ServiceEndpoint endPoint = null; if (dataService != null) { endPoint = dataService.Endpoint; } var pipeline = TroubleshooterPipeline.Run().WithParameters(this, true, new TimeoutException("The operation timed out after 2 minutes."), endPoint); if (pipeline.Retry && dataService != null) { dataService.LoginAsync(GetCredentials()); return; } dataService = null; } } if (dataService != null) { dataService.LoginCompleted -= completed; } if (dataService != null && dataService.InnerChannel.State == CommunicationState.Opened) { Status = DataServiceStatus.Connected; } else { Status = DataServiceStatus.Failed; } }
protected override void Process(UpdateServerPipeline pipeline) { Debug.ArgumentNotNull(pipeline, nameof(pipeline)); UpdateServerComponentsManager.CopyFiles(pipeline.Updates, pipeline.WebRootPath); }