public bool WorkWithProgress() { bool?nullable = new AsyncProcessDialog((AsyncProcess)this, this.expressionInformationService, 0.0).ShowDialog(); bool flag = nullable.HasValue && nullable.GetValueOrDefault(); this.ShowDefaultDialogs(); return(flag); }
private void CleanUp(AsyncExecuteCommandProcess process) { if (process != null) { process.Killed -= new EventHandler(this.OnKill); process.Complete -= new EventHandler(this.OnComplete); process.Progress -= new EventHandler(this.OnProgress); } this.asyncProgressDialog = (AsyncProcessDialog)null; }
private bool?ShowReferencesFoundDialog(ReferencesFoundModel model) { bool?nullable1 = new bool?(true); bool?nullable2 = new ReferencesFoundDialog(model).ShowDialog(); if (nullable2.GetValueOrDefault(false) && model.SelectedUpdateMethod != ReferencesFoundModel.UpdateMethod.DontFix) { nullable2 = new AsyncProcessDialog(model.FixReferencesAsync(), this.DesignerContext.ExpressionInformationService).ShowDialog(); } return(nullable2); }
private void ShowProgressDialog(bool show) { if (this.asyncProgressDialog == null) { return; } if (show) { this.asyncProgressDialog.ShowDialog(); } else { this.asyncProgressDialog.Close(new bool?(false)); this.asyncProgressDialog = (AsyncProcessDialog)null; } }
public void StartAsyncProcess(IExpressionInformationService expressionInformationService, Action <object, DoWorkEventArgs> workerDelegate, EventHandler onBegun, EventHandler onComplete, EventHandler onProgress, EventHandler onKill) { AsyncExecuteCommandProcess executeCommandProcess = new AsyncExecuteCommandProcess(string.Empty, workerDelegate); executeCommandProcess.Begun += onBegun; executeCommandProcess.Killed += onKill; executeCommandProcess.Complete += onComplete; executeCommandProcess.Progress += onProgress; executeCommandProcess.Progress += new EventHandler(this.OnProgress); executeCommandProcess.Killed += new EventHandler(this.OnKill); executeCommandProcess.Complete += new EventHandler(this.OnComplete); this.processingQueue.Add((AsyncProcess)executeCommandProcess, false); if (this.asyncProgressDialog != null) { return; } this.asyncProgressDialog = new AsyncProcessDialog((AsyncProcess)this.processingQueue, expressionInformationService, 0.0); this.ShowProgressDialog(true); this.CleanUp((AsyncExecuteCommandProcess)null); this.asyncProgressDialog = (AsyncProcessDialog)null; }
private void InteractiveRenameResource() { if (this.DocumentNode == null || this.DocumentNode.DocumentRoot == null || this.DocumentNode.DocumentRoot.DocumentContext == null) { return; } string key = this.currentName; this.currentName = (string)null; if (key == null || key.Equals(this.resource.Name)) { this.OnKeyChanged(); } else { SceneViewModel viewModel = this.Container.ViewModel; if (new ResourceSite(viewModel.Document.DocumentContext, this.Container.ResourcesCollection).FindResource((IDocumentRootResolver)null, key, (ICollection <DocumentCompositeNode>)null, (ICollection <IDocumentRoot>)null) != null) { viewModel.DesignerContext.MessageDisplayService.ShowError(StringTable.CreateResourceKeyStringIssueDirectConflict); this.OnKeyChanged(); } else { List <SceneNode> list = new List <SceneNode>(); ReferencesFoundModel model = (ReferencesFoundModel)null; viewModel.FindInternalResourceReferences(this.resource.ResourceNode, (ICollection <SceneNode>)list); ITypeId type = (ITypeId)viewModel.RootNode.Type; bool flag = PlatformTypes.ResourceDictionary.IsAssignableFrom(type) || PlatformTypes.Application.IsAssignableFrom(type); DictionaryEntryNode dictionaryEntryNode = (DictionaryEntryNode)viewModel.GetSceneNode((DocumentNode)this.resource.ResourceNode); if (list.Count > 0 || flag) { model = new ReferencesFoundModel((SceneNode)dictionaryEntryNode, (ICollection <SceneNode>)list, ReferencesFoundModel.UseScenario.RenameResource); bool valueOrDefault = new AsyncProcessDialog((AsyncProcess) new SerialAsyncProcess((IAsyncMechanism) new CurrentDispatcherAsyncMechanism(DispatcherPriority.Background), new AsyncProcess[2] { (AsyncProcess) new ExternalOpenSceneResourceReferenceAnalyzer(model), (AsyncProcess) new ExternalClosedSceneResourceReferenceAnalyzer(model) }), this.DesignerContext.ExpressionInformationService).ShowDialog().GetValueOrDefault(false); if (valueOrDefault && model.ReferenceNames.Count > 0) { valueOrDefault = new ReferencesFoundDialog(model).ShowDialog().GetValueOrDefault(false); } if (!valueOrDefault) { this.OnKeyChanged(); return; } } using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.UndoUnitRenameResource)) { if (model != null && model.SelectedUpdateMethod != ReferencesFoundModel.UpdateMethod.DontFix && model.ReferenceNames.Count > 0) { model.NewKey = (object)key; new AsyncProcessDialog(model.FixReferencesAsync(), this.DesignerContext.ExpressionInformationService).ShowDialog(); } dictionaryEntryNode.Key = (object)key; editTransaction.Commit(); } this.OnKeyChanged(); } } }