public void UpdateProgressIndicator(OperationContext context) { bool startLoginOperation = context.State == OperationState.Started; if (!AllowCancel) { if (startLoginOperation) { ParentWindow.DisableCloseButton(); } else { ParentWindow.EnableCloseButton(); } } if (TaskProgressChanged != null) { TaskProgressChanged(this, new TaskStateChangedEventArgs(context)); } okButton1.Enabled = !startLoginOperation; cancelButton1.Enabled = AllowCancel || !startLoginOperation; if (startLoginOperation) { progressIndicator1.Start(); } else { progressIndicator1.Stop(); } progressIndicator1.Visible = startLoginOperation; }