Exemplo n.º 1
0
            private void RestorePalettes()
            {
                List <ViewElement> list = Enumerable.ToList <ViewElement>(this.AutoHiddenViews);

                if (!Enumerable.Any <ViewElement>((IEnumerable <ViewElement>)list))
                {
                    return;
                }
                PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.TogglePalettes);
                foreach (ViewElement element in list)
                {
                    DockOperations.SnapToBookmark(element);
                }
                foreach (ViewElement viewElement in list)
                {
                    ExpressionView expressionView = viewElement as ExpressionView;
                    if (expressionView != null)
                    {
                        expressionView.IsSelected = expressionView.WasSelectedBeforeAutoHide;
                    }
                }
                if (this.SavedActiveView != null && this.SavedActiveView.WindowProfile == ViewManager.Instance.WindowProfile)
                {
                    ViewManager.Instance.ActiveView = this.SavedActiveView;
                }
                this.SavedActiveView = (Microsoft.VisualStudio.PlatformUI.Shell.View)null;
            }
Exemplo n.º 2
0
 public bool ResetActiveWorkspace()
 {
     if (!this.OnActiveWorkspaceChanging())
     {
         return(false);
     }
     using (PerformanceUtility.PerformanceSequence(PerformanceEvent.ResetWorkspace))
     {
         Workspace workspace = new Workspace(this.activeWorkspace.Name, this.Content);
         WorkspaceService.WorkspaceOperationResult workspaceOperationResult = this.LoadWorkspaceConfiguration((IWorkspace)workspace, true);
         if (!workspaceOperationResult.Success)
         {
             if (this.messageDisplayService != null)
             {
                 int num = (int)this.messageDisplayService.ShowMessage(new MessageBoxArgs()
                 {
                     Message = workspaceOperationResult.Message,
                     Button  = MessageBoxButton.OK,
                     Image   = MessageBoxImage.Hand
                 });
             }
             this.OnActiveWorkspaceChangingCanceled();
             return(false);
         }
         this.ActiveWorkspace = (IWorkspace)workspace;
     }
     return(true);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
            private void HidePalettes()
            {
                List <ViewElement> list = Enumerable.ToList <ViewElement>(this.HideableViews);

                if (!Enumerable.Any <ViewElement>((IEnumerable <ViewElement>)list))
                {
                    return;
                }
                PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.TogglePalettes);
                Microsoft.VisualStudio.PlatformUI.Shell.View activeView = ViewManager.Instance.ActiveView;
                if (list.Contains((ViewElement)activeView))
                {
                    this.SavedActiveView = activeView;
                }
                foreach (ViewElement viewElement in list)
                {
                    ExpressionView expressionView = viewElement as ExpressionView;
                    if (expressionView != null)
                    {
                        expressionView.WasSelectedBeforeAutoHide = expressionView.IsSelected;
                    }
                }
                foreach (ViewElement viewElement in list)
                {
                    DockOperations.AutoHide(viewElement);
                }
            }
Exemplo n.º 5
0
 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;
     }
 }
Exemplo n.º 6
0
 protected override void OnContextMenuOpening(ContextMenuEventArgs e)
 {
     PerformanceUtility.StartPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu);
     base.OnContextMenuOpening(e);
     this.timelineItem.UpdateContextMenu();
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu);
 }
Exemplo n.º 7
0
 private void MakeInitialColor()
 {
     PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.EditColor);
     this.BeginUpdate();
     this.ColorModel.Color = this.InitialColor;
     this.EndUpdate();
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 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));
     }
 }
Exemplo n.º 10
0
 protected virtual void RunApplication()
 {
     ExpressionApplication.StartGlobalPerformanceInstrumentation();
     PerformanceUtility.MarkInterimStep(PerformanceEvent.ApplicationStartup, "Application Created");
     try
     {
         this.Run();
     }
     catch (TargetInvocationException ex)
     {
         if (ex.InnerException != null)
         {
             this.ShowSafeMessageBox(string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.ApplicationTargetInvocationDialogMessage, new object[1]
             {
                 (object)ex.InnerException.ToString()
             }), StringTable.ApplicationTargetInvocationDialogTitle);
         }
         throw;
     }
     catch (SecurityException ex)
     {
         this.ShowSafeMessageBox(ex.ToString(), StringTable.ApplicationSecurityExceptionDialogTitle);
     }
     catch (MissingSatelliteAssemblyException ex)
     {
         this.ShowSafeMessageBox(ex.Message, "Microsoft Expression");
     }
 }
Exemplo n.º 11
0
 private void MakeLastColor()
 {
     PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.EditColor);
     this.BeginUpdate();
     this.ColorModel.CopyFrom(this.LastColorModel);
     this.EndUpdate();
 }
Exemplo n.º 12
0
 private void UpdateAssetsWorker()
 {
     if (this.openCount > 0 && this.NeedsUpdate && this.TargetProject != null)
     {
         bool flag = false;
         foreach (AssetProvider assetProvider in Enumerable.Reverse <AssetProvider>(this.FindAssetProviders <AssetProvider>()))
         {
             if (assetProvider.NeedsUpdate)
             {
                 using (PerformanceUtility.PerformanceSequence(PerformanceEvent.AssetLibraryUpdateAssets))
                 {
                     if (assetProvider.Update())
                     {
                         if (!AssetLibrary.DisableAsyncUpdate)
                         {
                             this.NotifyAssetLibraryChanged(AssetLibraryDamages.Assets);
                             this.InvokeAsync(new Action(this.UpdateAssetsWorker));
                             return;
                         }
                     }
                 }
             }
             flag |= assetProvider.NeedsUpdate;
         }
         this.NeedsUpdate = flag;
     }
     if (this.needsUpdate)
     {
         return;
     }
     AssetLibrary.ResetAssetLoadPerformanceMarker(false);
 }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
 protected override bool OnButtonDown(Point pointerPosition)
 {
     PerformanceUtility.StartPerformanceSequence(PerformanceEvent.SkewElement);
     this.Initialize(pointerPosition);
     this.EnsureEditTransaction();
     return(true);
 }
Exemplo n.º 15
0
 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);
 }
Exemplo n.º 16
0
        public bool Execute()
        {
            this.SetRunning(true);
            Process process = null;

            System.Diagnostics.ProcessStartInfo processStartInfo = this.ProcessStartInfo;
            if (processStartInfo != null)
            {
                try
                {
                    process = Process.Start(processStartInfo);
                }
                catch (Win32Exception win32Exception1)
                {
                    Win32Exception         win32Exception            = win32Exception1;
                    IMessageDisplayService messageDisplayService     = base.Services.MessageDisplayService();
                    CultureInfo            currentCulture            = CultureInfo.CurrentCulture;
                    string   projectBuilderLaunchFailedDialogMessage = StringTable.ProjectBuilderLaunchFailedDialogMessage;
                    object[] fileName = new object[] { processStartInfo.FileName, win32Exception.ToString() };
                    messageDisplayService.ShowError(string.Format(currentCulture, projectBuilderLaunchFailedDialogMessage, fileName));
                }
            }
            if (process == null || process.HasExited)
            {
                this.SetRunning(false);
            }
            else
            {
                process.EnableRaisingEvents = true;
                process.Exited += new EventHandler(this.Process_Exited);
            }
            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ProjectRun);
            return(process != null);
        }
Exemplo n.º 17
0
 private void MakeBlack()
 {
     PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.EditColor);
     this.BeginUpdate();
     this.ColorModel.Color = Colors.Black;
     this.EndUpdate();
 }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        private void OnSplitterResized(object sender, DragDeltaEventArgs args)
        {
            SplitterGrip splitterGrip = args.OriginalSource as SplitterGrip;

            if (splitterGrip == null)
            {
                return;
            }
            PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.ResizePalette);
            args.Handled = true;
            for (int index = 0; index < this.InternalChildren.Count; ++index)
            {
                if (this.InternalChildren[index].IsAncestorOf((DependencyObject)splitterGrip))
                {
                    double pixelAmount = this.Orientation == Orientation.Horizontal ? args.HorizontalChange : args.VerticalChange;
                    switch (splitterGrip.ResizeBehavior)
                    {
                    case GridResizeBehavior.CurrentAndNext:
                        this.ResizeChildren(index, index + 1, pixelAmount);
                        continue;

                    case GridResizeBehavior.PreviousAndCurrent:
                        this.ResizeChildren(index - 1, index, pixelAmount);
                        continue;

                    case GridResizeBehavior.PreviousAndNext:
                        this.ResizeChildren(index - 1, index + 1, pixelAmount);
                        continue;

                    default:
                        throw new InvalidOperationException("BasedOnAlignment is not a valid resize behavior");
                    }
                }
            }
        }
        public void TestRemoveFirstObjectTrait500Rooms()
        {
            StateData        stateData        = default;
            TraitBasedObject traitBasedObject = default;

            Measure.Method(() =>
            {
                stateData.RemoveTraitOnObject <Colored>(ref traitBasedObject);
            }).SetUp(() =>
            {
                stateData = m_StateManager.CopyStateData(m_LargeStateData);
                for (int i = 0; i < stateData.TraitBasedObjects.Length; i++)
                {
                    traitBasedObject = stateData.TraitBasedObjects[i];
                    var coloredIndex = traitBasedObject.ColoredIndex;

                    if (coloredIndex != TraitBasedObject.Unset)
                    {
                        break;
                    }
                }
            }).WarmupCount(1).MeasurementCount(30).IterationsPerMeasurement(1).Run();

            PerformanceUtility.AssertRange(0.05, 0.075);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
 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));
 }
Exemplo n.º 23
0
        private void SetActiveView(IView view)
        {
            PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.SwitchView);
            IDocumentView documentView = view as IDocumentView;

            DocumentService.Item obj = documentView != null ? this.items[documentView.Document] : (DocumentService.Item)null;
            this.SetActiveDocumentAndView(view, obj);
        }
Exemplo n.º 24
0
        public ImageSource GetImageSource(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource);
            ImageSource imageSourceCore = this.GetImageSourceCore(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource);
            return(imageSourceCore);
        }
Exemplo n.º 25
0
        public DataTemplate GetDataTemplate(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetDataTemplateFileResource);
            DataTemplate dataTemplate = (DataTemplate)((ResourceDictionary)this.LoadObject(name))[(object)"root"];

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetDataTemplateFileResource);
            return(dataTemplate);
        }
Exemplo n.º 26
0
        public Style GetStyle(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetStyleFileResource);
            Style style = ((FrameworkElement)this.LoadObject(name)).Tag as Style;

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetStyleFileResource);
            return(style);
        }
Exemplo n.º 27
0
        public FrameworkElement GetElement(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetElementFileResource);
            FrameworkElement frameworkElement = (FrameworkElement)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetElementFileResource);
            return(frameworkElement);
        }
Exemplo n.º 28
0
        public Model3DGroup GetModel3DGroup(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetModel3DFileResource);
            Model3DGroup model3Dgroup = (Model3DGroup)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetModel3DFileResource);
            return(model3Dgroup);
        }
Exemplo n.º 29
0
        public DrawingImage GetDrawingImage(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource);
            DrawingImage drawingImage = (DrawingImage)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource);
            return(drawingImage);
        }
Exemplo n.º 30
0
        public override IDocumentView CreateDefaultView()
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CreateCodeEditor);
            IDocumentView documentView = (IDocumentView) new LimitedDocumentView((IDocument)this, this.editingService);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CreateCodeEditor);
            return(documentView);
        }