public void Undo() { this.isUndoing = true; try { if (this.openStackDepth != 0) { throw new InvalidOperationException(ExceptionStringTable.CannotUndoFromWithinAnOpenUndoContainer); } this.UndoHiddenContainersOnOpenStack(); if (this.undoStack.Count <= 0) { throw new InvalidOperationException(ExceptionStringTable.UndoStackIsEmpty); } PerformanceUtility.StartPerformanceSequence(PerformanceEvent.Undo); IUndoUnitContainer undoUnitContainer; do { undoUnitContainer = this.undoStack.Pop(); this.OnUndoStackChanged(new UndoStackChangedEventArgs(UndoStackChangeType.NodeRemoved)); undoUnitContainer.Undo(); this.redoStack.Push(undoUnitContainer); this.OnRedoStackChanged(new UndoStackChangedEventArgs(UndoStackChangeType.NodeAdded)); }while (undoUnitContainer.IsHidden && this.undoStack.Count > 0); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.Undo); } finally { this.isUndoing = false; } }
protected override void EnsureValidContentBounds() { if (this.ValidContentBounds) { return; } PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetArtboardContentBounds); if (this.EditableContentObject != null) { try { this.ContentBounds = this.platformView.GetDescendantBounds(this.EditableContentObject); if (!double.IsInfinity(this.ContentBounds.Left) && !double.IsInfinity(this.ContentBounds.Top) && !double.IsInfinity(this.ContentBounds.Width)) { if (!double.IsInfinity(this.ContentBounds.Height)) { goto label_7; } } this.ContentBounds = new Rect(((IViewVisual)this.EditableContentObject).RenderSize); } catch (Exception ex) { this.viewExceptionCallback(ex); } } label_7: PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetArtboardContentBounds); }
protected override void OnContextMenuOpening(ContextMenuEventArgs e) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu); base.OnContextMenuOpening(e); this.timelineItem.UpdateContextMenu(); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu); }
public override void Execute() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ProjectRun); if (this.IsEnabled) { Microsoft.Expression.Framework.UserInterface.IWindowService service = (Microsoft.Expression.Framework.UserInterface.IWindowService)base.Services.GetService(typeof(Microsoft.Expression.Framework.UserInterface.IWindowService)); if (service != null) { service.ReturnFocus(); } ISolution solution = this.Solution(); IProjectBuildContext projectBuildContext = solution.ProjectBuildContext; IExecutable startupProject = solution.StartupProject; string str = (projectBuildContext != null ? projectBuildContext.DisplayName : solution.DocumentReference.DisplayName); if (startupProject == null || !startupProject.IsExecuting) { this.HandleBasicExceptions(() => this.BuildAndRun(projectBuildContext, startupProject)); return; } CultureInfo currentCulture = CultureInfo.CurrentCulture; string runCommandUnableToRunDialogMessage = StringTable.RunCommandUnableToRunDialogMessage; object[] objArray = new object[] { str }; this.DisplayCommandFailedMessage(string.Format(currentCulture, runCommandUnableToRunDialogMessage, objArray)); } }
public override void Load() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ConfigurationServiceLoad); this.Configurations.Clear(); try { if (Microsoft.Expression.Framework.Documents.PathHelper.FileExists(this.ConfigurationFileName)) { using (FileStream fileStream = File.OpenRead(this.ConfigurationFileName)) { XmlReader reader = (XmlReader)null; try { reader = XmlReader.Create((Stream)fileStream); } catch (SecurityException ex) { } this.LoadInternal(reader); } } } catch (IOException ex) { } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ConfigurationServiceLoad); }
private void UpdateLate() { this.scheduleCount = 0; PerformanceUtility.StartPerformanceSequence(PerformanceEvent.SceneViewUpdateScheduleTaskUpdateLate); SceneUpdatePhaseEventArgs args1 = (SceneUpdatePhaseEventArgs)null; SceneUpdatePhaseEventArgs[] updatePhaseEventArgsArray = Enumerable.ToArray <SceneUpdatePhaseEventArgs>((IEnumerable <SceneUpdatePhaseEventArgs>) this.workItems.Values); this.workItems.Clear(); foreach (SceneUpdatePhaseEventArgs args2 in updatePhaseEventArgsArray) { if (args2.ViewModel.IsActiveSceneViewModel) { args1 = args2; } args2.ViewModel.FireLateSceneUpdatePhase(args2); } if (args1 != null) { args1.ViewModel.DesignerContext.SelectionManager.FireLateActiveSceneUpdatePhase(args1); } foreach (SceneUpdatePhaseEventArgs updatePhaseEventArgs in updatePhaseEventArgsArray) { updatePhaseEventArgs.ViewModel.OnPipelineLatePhaseEnd(); } if (args1 != null) { args1.ViewModel.DesignerContext.SelectionManager.FirePostSceneUpdatePhase(); } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.SceneViewUpdateScheduleTaskUpdateLate); }
protected override bool OnButtonDown(Point pointerPosition) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.RotateElement); this.inverseCoordinateSpace = 1.0; SceneView activeView = this.ActiveView; CanonicalTransform canonicalTransform = new CanonicalTransform((Transform)this.EditingElement.GetComputedValueAsWpf(Base2DElement.RenderTransformProperty)); this.rootCenter = this.EditingElementSet.RenderTransformOriginInElementCoordinates * this.EditingElementSet.GetTransformMatrix((IViewObject)this.ActiveView.HitTestRoot); Matrix matrix = Matrix.Identity; if (this.EditingElement != this.RootNode) { SceneNode parent = this.EditingElement.Parent; BaseFrameworkElement frameworkElement = (BaseFrameworkElement)null; while (parent != null && (frameworkElement = parent as BaseFrameworkElement) == null) { parent = parent.Parent; } if (frameworkElement != null && frameworkElement.Visual != null) { matrix = activeView.GetComputedTransformToRoot((SceneElement)frameworkElement); } } this.inverseCoordinateSpace = (double)Math.Sign(matrix.Determinant); this.lastPointerAngle = this.GetAngle(pointerPosition); this.unsnappedAngle = canonicalTransform.RotationAngle; this.EnsureEditTransaction(); this.snapping = false; this.snapping = this.IsShiftDown; this.Initialize(); return(true); }
public IProjectType GetProjectTypeForProject(IProjectStore projectStore) { IProjectType item; PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetProjectTypeForProject); try { int count = this.projectTypes.Count - 1; while (count >= 0) { if (!this.projectTypes[count].IsValidTypeForProject(projectStore)) { count--; } else { item = this.projectTypes[count]; return(item); } } return(this.unknownProjectType); } finally { PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetProjectTypeForProject); } return(item); }
protected override bool OnButtonDown(Point pointerPosition) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.SkewElement); this.Initialize(pointerPosition); this.EnsureEditTransaction(); return(true); }
private void InitializeMefHostingService(ICommandLineService commandLineService) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.MefInitialization); IExpressionMefHostingService service = this.Services.GetService <IExpressionMefHostingService>(); string[] arguments = commandLineService.GetArguments("extension"); if (arguments != null) { foreach (string assembly in arguments) { service.AddAssembly(assembly); } } string folder = Path.Combine(Path.GetDirectoryName(this.GetType().Module.FullyQualifiedName), "extensions"); service.AddFolder(folder); try { service.Compose(); } catch (Exception ex) { this.mefExceptionToShow = ex; } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.MefInitialization); }
public Model3DGroup GetModel3DGroup(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetModel3DFileResource); Model3DGroup model3Dgroup = (Model3DGroup)this.LoadObject(name); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetModel3DFileResource); return(model3Dgroup); }
private void OnStartupIdleProcessing() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.PostingFirstIdleandCallingApplicationRun); UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(this.OnFirstIdle)); PropertyCacheHelper.PopulateStartupReflectionCache(); UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(FontEmbedder.CreateSystemFontFamiliesCache)); UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(this.OnLastIdle)); }
public ImageSource GetImageSource(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource); ImageSource imageSourceCore = this.GetImageSourceCore(name); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource); return(imageSourceCore); }
public DrawingImage GetDrawingImage(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource); DrawingImage drawingImage = (DrawingImage)this.LoadObject(name); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource); return(drawingImage); }
public FrameworkElement GetElement(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetElementFileResource); FrameworkElement frameworkElement = (FrameworkElement)this.LoadObject(name); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetElementFileResource); return(frameworkElement); }
public Style GetStyle(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetStyleFileResource); Style style = ((FrameworkElement)this.LoadObject(name)).Tag as Style; PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetStyleFileResource); return(style); }
public override IDocumentView CreateDefaultView() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CreateCodeEditor); IDocumentView documentView = (IDocumentView) new LimitedDocumentView((IDocument)this, this.editingService); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CreateCodeEditor); return(documentView); }
public DataTemplate GetDataTemplate(string name) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetDataTemplateFileResource); DataTemplate dataTemplate = (DataTemplate)((ResourceDictionary)this.LoadObject(name))[(object)"root"]; PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetDataTemplateFileResource); return(dataTemplate); }
public override IDocumentView CreateDefaultView() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CreateCodeEditor); CodeProject.EnsureResolverCachePruned(this.codeProject.ProjectResolver); IDocumentView documentView = (IDocumentView) new CodeView((IDocument)this, this.codeProject, this.codeProjectService.MessageDisplayService, this.viewService, this.codeOptionsModel, this.windowService); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CreateCodeEditor); return(documentView); }
protected override void OnContextMenuOpening(ContextMenuEventArgs e) { if (this.isLeftButtonDown || !this.IsSelected) { return; } PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ContextMenuRender, "Keyframe Context Menu"); base.OnContextMenuOpening(e); }
protected override void OnStartup(StartupEventArgs e) { this.Logger().Info("1: First enter startup method"); //ShowSplash(); App.Current.Exit += new ExitEventHandler(Current_Exit); this.Logger().Info("2: Prepare for performance log"); #if DEBUG //PerformanceUtility.LoggingEnabled = true; PerformanceUtility.LoggingEnabled = false; #endif PerformanceUtility.StartPerformanceSequence(PerformanceEvent.LoadConfigFile); #region Load Config Info this.Logger().Info("3: First enter startup method"); string configFilePath = MyGlobal.ConfigFilePath; if (!File.Exists(configFilePath)) { ConfigInfo cInfo = new ConfigInfo(); XLCS.Serialize.SerializedFile.SaveXml(configFilePath, cInfo); } App.MyConfigInfo = XLCS.Serialize.SerializedFile.OpenXml(configFilePath, typeof(ConfigInfo)) as ConfigInfo; #endregion PerformanceUtility.EndPerformanceSequence(PerformanceEvent.LoadConfigFile); this.Logger().Info("4: Set application shutdown mode"); App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; this.Logger().Info("5: Read .config file to get the entry point"); MainEntry = new NewPortal(); this.Logger().Info("5-1 : Load NewPortal"); MainEntry.BringIntoView(); this.Logger().Info("5-3 : Active Window"); MainEntry.Activate(); try { MainEntry.ShowDialog(); this.Logger().Info("6 : Call base starup method"); base.OnStartup(e); } catch (InvalidOperationException ee) { ee.Message.Show(); App.Current.Shutdown(); } }
internal SceneDocument(DocumentReference documentReference, SceneXamlDocument xamlDocument, bool isReadOnly, DesignerContext designerContext) : base(documentReference, xamlDocument.UndoService, isReadOnly) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.SceneDocumentConstructor); this.designerContext = designerContext; this.xamlDocument = xamlDocument; this.xamlDocument.TypesChanged += new EventHandler(this.XamlDocument_TypesChanged); this.xamlDocument.RootNodeChanged += new EventHandler(this.XamlDocument_RootNodeChanged); this.xamlDocument.HasTextEditsChanged += new EventHandler(this.XamlDocument_HasTextEditsChanged); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.SceneDocumentConstructor); }
protected override bool Initialize() { bool startupItem; PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ProjectPopulate, "InitializeExistingProject"); string path = base.DocumentReference.Path; if (Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories).CountIsMoreThan <string>(1000)) { MessageBoxArgs messageBoxArg = new MessageBoxArgs() { Message = StringTable.FolderOpenTooManyFilesWarning, Button = MessageBoxButton.YesNo, Image = MessageBoxImage.Exclamation }; if (base.Services.ShowSuppressibleWarning(messageBoxArg, "WebsiteTooLargeWarning", MessageBoxResult.Yes) == MessageBoxResult.No) { return(false); } } this.LoadDirectory(path, null); if (this.StartupItem == null) { bool flag = false; VSWebsitesHelper vSWebsitesHelper = new VSWebsitesHelper(); if (vSWebsitesHelper != null) { VSWebsitesWebsite vSWebsitesWebsite = vSWebsitesHelper.FindWebsite(path); if (vSWebsitesWebsite != null) { if (vSWebsitesWebsite.StartPage == null) { startupItem = true; } else { this.StartupItem = base.FindItem(Microsoft.Expression.Framework.Documents.DocumentReference.Create(vSWebsitesWebsite.StartPageFullPath)); startupItem = this.StartupItem != null; } if (startupItem && vSWebsitesWebsite.VwdPort != 0) { this.cachedVswdPort = new int?(vSWebsitesWebsite.VwdPort); } flag = true; } } if (!flag) { this.StartupItem = base.FindItem(Microsoft.Expression.Framework.Documents.DocumentReference.Create(Microsoft.Expression.Framework.Documents.PathHelper.ResolveCombinedPath(path, "default.html"))); } } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ProjectPopulate, "InitializeExistingProject"); return(true); }
private void BuildCore(BuildManager.BuildRequest request, bool blockUntilComplete) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ProjectBuild); if (!blockUntilComplete) { BuildManager.asyncBuildRequestQueue.Enqueue(request); this.ProcessAsyncBuildRequest(); return; } this.StartBuildCore(request); (new BuildManager.ProjectBuilder(this, request, null, false, true)).Build(); }
public override void Execute() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.Make3D); try { using (this.SceneViewModel.DisableUpdateChildrenOnAddAndRemove()) { BaseFrameworkElement frameworkElement = (BaseFrameworkElement)this.SceneViewModel.ElementSelectionSet.PrimarySelection; using (SceneEditTransaction editTransaction = this.SceneViewModel.CreateEditTransaction(this.UndoUnitName, false)) { ILayoutDesigner designerForChild = this.SceneViewModel.GetLayoutDesignerForChild((SceneElement)frameworkElement, true); Rect childRect = designerForChild.GetChildRect(frameworkElement); DocumentNode newValue = this.CreateValue(frameworkElement); if (newValue == null) { editTransaction.Cancel(); } else if (this.CreateResource && this.ProcessAsResource(frameworkElement, newValue) == null) { editTransaction.Cancel(); } else { if (this.ShouldReplaceOriginal) { this.SceneViewModel.AnimationEditor.DeleteAllAnimationsInSubtree((SceneElement)frameworkElement); Dictionary <IPropertyId, SceneNode> properties = SceneElementHelper.StoreProperties((SceneNode)frameworkElement, true); this.SceneViewModel.ElementSelectionSet.Clear(); BaseFrameworkElement element = this.CreateElement(frameworkElement); using (this.SceneViewModel.ForceBaseValue()) { element.Name = frameworkElement.Name; ISceneNodeCollection <SceneNode> collectionForChild = frameworkElement.ParentElement.GetCollectionForChild((SceneNode)frameworkElement); int index = collectionForChild.IndexOf((SceneNode)frameworkElement); frameworkElement.Remove(); this.Postprocess(frameworkElement, element, properties, childRect); collectionForChild.Insert(index, (SceneNode)element); SceneElementHelper.ApplyProperties((SceneNode)element, properties); editTransaction.Update(); designerForChild.SetChildRect(element, childRect); } this.SceneViewModel.ElementSelectionSet.SetSelection((SceneElement)element); } editTransaction.Commit(); } } } } finally { PerformanceUtility.EndPerformanceSequence(PerformanceEvent.Make3D); } }
public ReadOnlyCollection <ICompletion> GetCompletions(ICompletionSession session) { this.EnsureCodeAidEngine(); PerformanceUtility.StartPerformanceSequence(PerformanceEvent.XamlIntellisenseGetCompletions); List <ICompletion> list1 = new List <ICompletion>(); this.xamlCodeAidEngine.GetCompletions(this, session, (IList)list1); Func <ICompletion, string> func = (Func <ICompletion, string>)(completion => completion.DisplayText); IList <ICompletion> list2 = (IList <ICompletion>)Enumerable.ToList <ICompletion>(EnumerableExtensions.DistinctOnOrdered <ICompletion>((IEnumerable <ICompletion>)Enumerable.OrderBy <ICompletion, string>((IEnumerable <ICompletion>)list1, func), (IComparer <ICompletion>) new KeyComparer <ICompletion, string>(func))); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.XamlIntellisenseGetCompletions); return(new ReadOnlyCollection <ICompletion>(list2)); }
public Cursor GetCursor(string name) { name = name.ToLower(CultureInfo.InvariantCulture); name = name.Replace("\\", "/"); PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetCursorFileResource); Stream cursorStream = (Stream)this.resourceManager.GetObject(name, Thread.CurrentThread.CurrentUICulture); PerformanceUtility.MarkInterimStep(PerformanceEvent.GetCursorFileResource, "Loaded " + name); Cursor cursor = new Cursor(cursorStream); PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetCursorFileResource); return(cursor); }
private static void ResetAssetLoadPerformanceMarker(bool shouldStart) { if (AssetLibrary.performanceMarkerStarted) { PerformanceUtility.EndPerformanceSequence(PerformanceEvent.AssetLibraryUpdateEntireLibrary); AssetLibrary.performanceMarkerStarted = false; } if (!shouldStart) { return; } AssetLibrary.performanceMarkerStarted = true; PerformanceUtility.StartPerformanceSequence(PerformanceEvent.AssetLibraryUpdateEntireLibrary); }
private void FinishElement() { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ShapeCreateBehaviorOnDragEnd); this.layoutRoundingOverride.Restore(!(this is TextCreateBehavior)); Point pointBegin; Point pointEnd; this.GetCurrentElementPosition(out pointBegin, out pointEnd); this.DoFinishElement(pointBegin, pointEnd); this.CommitEditTransaction(); this.Tool.RebuildAdornerSets(); this.EditingElement = (BaseFrameworkElement)null; PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ShapeCreateBehaviorOnDragEnd); }
private string GetFirstAvailableIndexedName(DocumentNode node, string namePrefix) { PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetFirstAvailableElementIDIndex); int num = 1; string str = namePrefix + num.ToString((IFormatProvider)CultureInfo.InvariantCulture); for (DocumentNode node1 = this.FindNode(str); node1 != null && node1 != node || string.Compare(str, this.className, StringComparison.Ordinal) == 0; node1 = this.FindNode(str)) { ++num; str = namePrefix + num.ToString((IFormatProvider)CultureInfo.InvariantCulture); } PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetFirstAvailableElementIDIndex); return(str); }