Esempio n. 1
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);
 }
Esempio n. 2
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;
     }
 }
Esempio 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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
 protected override void OnContextMenuOpening(ContextMenuEventArgs e)
 {
     PerformanceUtility.StartPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu);
     base.OnContextMenuOpening(e);
     this.timelineItem.UpdateContextMenu();
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.InvokeTimelineItemContextMenu);
 }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        public Model3DGroup GetModel3DGroup(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetModel3DFileResource);
            Model3DGroup model3Dgroup = (Model3DGroup)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetModel3DFileResource);
            return(model3Dgroup);
        }
Esempio n. 10
0
        public override IDocumentView CreateDefaultView()
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.CreateCodeEditor);
            IDocumentView documentView = (IDocumentView) new LimitedDocumentView((IDocument)this, this.editingService);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.CreateCodeEditor);
            return(documentView);
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        public FrameworkElement GetElement(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetElementFileResource);
            FrameworkElement frameworkElement = (FrameworkElement)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetElementFileResource);
            return(frameworkElement);
        }
Esempio n. 13
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);
        }
Esempio n. 14
0
        public ImageSource GetImageSource(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource);
            ImageSource imageSourceCore = this.GetImageSourceCore(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource);
            return(imageSourceCore);
        }
Esempio n. 15
0
        public DrawingImage GetDrawingImage(string name)
        {
            PerformanceUtility.StartPerformanceSequence(PerformanceEvent.GetImageFileResource);
            DrawingImage drawingImage = (DrawingImage)this.LoadObject(name);

            PerformanceUtility.EndPerformanceSequence(PerformanceEvent.GetImageFileResource);
            return(drawingImage);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
 protected virtual void AllDone()
 {
     if (this.UseSnappingEngine)
     {
         this.ToolBehaviorContext.SnappingEngine.Stop();
     }
     this.layoutRoundingOverride.Restore(false);
     this.CommitEditTransaction();
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ResizeElement);
 }
Esempio n. 18
0
 private void OnLastIdle()
 {
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.StartupCacheWarmUp);
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ApplicationStartup);
     if (!this.TestingStartup)
     {
         return;
     }
     this.Shutdown();
 }
Esempio n. 19
0
        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();
            }
        }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
 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);
 }
Esempio n. 22
0
 protected void CloseWelcomeSplashScreen()
 {
     if (this.WelcomeSplashScreen == null)
     {
         return;
     }
     this.WelcomeSplashScreen.CanClose = true;
     this.WelcomeSplashScreen.Close();
     this.WelcomeSplashScreen = (WelcomeSplashScreen)null;
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ShowSplashScreen);
 }
Esempio n. 23
0
 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);
     }
 }
Esempio n. 24
0
        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));
        }
Esempio n. 25
0
        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);
        }
Esempio n. 26
0
 public override void SetProperty(string propertyName, object propertyValue)
 {
     if (propertyName == "IsChecked")
     {
         PerformanceUtility.StartPerformanceSequence(PerformanceEvent.ExpandPopup);
         using (SceneEditTransaction editTransaction = this.SceneViewModel.CreateEditTransaction(this.UndoString, false))
         {
             this.IsExpanded = (bool)propertyValue;
             editTransaction.Commit();
         }
         PerformanceUtility.EndPerformanceSequence(PerformanceEvent.ExpandPopup);
     }
     base.SetProperty(propertyName, propertyValue);
 }
Esempio n. 27
0
 protected override bool OnDragEnd(Point dragStartPosition, Point dragEndPosition)
 {
     if (this.enableAreaZoom)
     {
         this.ClearFeedback();
         this.ActiveView.ZoomToFitRectangle(new Rect(dragStartPosition, dragEndPosition));
     }
     else
     {
         this.ActiveView.Artboard.ZoomAroundFixedPoint(!this.IsAltDown, dragEndPosition);
     }
     PerformanceUtility.EndPerformanceSequence(PerformanceEvent.AdjustZoom);
     return(true);
 }
Esempio n. 28
0
 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);
 }
Esempio n. 29
0
        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);
        }
Esempio n. 30
0
        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);
        }