public void Load(string fileName) { if (string.IsNullOrEmpty(fileName)) { throw FxTrace.Exception.AsError(new ArgumentNullException("fileName")); } DesignerConfigurationService service = this.Context.Services.GetService <DesignerConfigurationService>(); service.SetDefaultOfLoadingFromUntrustedSourceEnabled(); if (!service.LoadingFromUntrustedSourceEnabled && !IsFromUnrestrictedPath(fileName)) { throw FxTrace.Exception.AsError(new SecurityException(string.Format(CultureInfo.CurrentUICulture, SR.UntrustedSourceDetected, fileName))); } try { IDocumentPersistenceService documentPersistenceService = this.Context.Services.GetService <IDocumentPersistenceService>(); if (documentPersistenceService != null) { this.Load(documentPersistenceService.Load(fileName)); } else { using (StreamReader fileStream = new StreamReader(fileName)) { this.loadedFile = fileName; WorkflowFileItem fileItem = new WorkflowFileItem(); fileItem.LoadedFile = fileName; this.context.Items.SetValue(fileItem); this.Text = fileStream.ReadToEnd(); this.Load(); } } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } else { this.Context.Items.SetValue(new ErrorItem() { Message = e.Message, Details = e.ToString() }); } } if (!this.IsInErrorState()) { this.lastWorkflowSymbol = GetAttachedWorkflowSymbol(); if (this.debuggerService != null) { this.debuggerService.InvalidateSourceLocationMapping(fileName); } } }
} //end //清除Tracking信息 public void clearTrackInfo() { if (trackingDataList == null) { trackingDataList = new System.ComponentModel.BindingList <designerDebugTrackingData>(); } else { trackingDataList.Clear(); } System.Activities.Presentation.WorkflowFileItem fileItem = designer.Context.Items.GetValue(typeof(System.Activities.Presentation.WorkflowFileItem)) as System.Activities.Presentation.WorkflowFileItem; designer.DebugManagerView.CurrentLocation = new SourceLocation(fileItem.LoadedFile, 1, 1, 1, 10); }
public static string getXamlFilePath(WorkflowDesigner designer) { System.Activities.Presentation.WorkflowFileItem fileItem = designer.Context.Items.GetValue(typeof(System.Activities.Presentation.WorkflowFileItem)) as System.Activities.Presentation.WorkflowFileItem; return(fileItem.LoadedFile); }
public void Load(string fileName) { if (string.IsNullOrEmpty(fileName)) { throw FxTrace.Exception.AsError(new ArgumentNullException("fileName")); } DesignerConfigurationService service = this.Context.Services.GetService<DesignerConfigurationService>(); service.SetDefaultOfLoadingFromUntrustedSourceEnabled(); if (!service.LoadingFromUntrustedSourceEnabled && !IsFromUnrestrictedPath(fileName)) { throw FxTrace.Exception.AsError(new SecurityException(string.Format(CultureInfo.CurrentUICulture, SR.UntrustedSourceDetected, fileName))); } try { IDocumentPersistenceService documentPersistenceService = this.Context.Services.GetService<IDocumentPersistenceService>(); if (documentPersistenceService != null) { this.Load(documentPersistenceService.Load(fileName)); } else { using (StreamReader fileStream = new StreamReader(fileName)) { this.loadedFile = fileName; WorkflowFileItem fileItem = new WorkflowFileItem(); fileItem.LoadedFile = fileName; this.context.Items.SetValue(fileItem); this.Text = fileStream.ReadToEnd(); this.Load(); } } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } else { this.Context.Items.SetValue(new ErrorItem() { Message = e.Message, Details = e.ToString() }); } } if (!this.IsInErrorState()) { this.lastWorkflowSymbol = GetAttachedWorkflowSymbol(); if (this.debuggerService != null) { this.debuggerService.InvalidateSourceLocationMapping(fileName); } } }