コード例 #1
0
 public static Type GetCategoryEditorType(EditorAttribute attribute, IMessageLoggingService exceptionLogger)
 {
     try
     {
         Type type = Type.GetType(attribute.EditorTypeName);
         if (type != (Type)null)
         {
             if (typeof(CategoryEditor).IsAssignableFrom(type))
             {
                 return(type);
             }
         }
     }
     catch (Exception ex)
     {
         if (exceptionLogger != null)
         {
             exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.CategoryEditorTypeLoadFailed, new object[1]
             {
                 (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex)
             }));
         }
     }
     return((Type)null);
 }
コード例 #2
0
 public CreatePropertyCommandHandler(AppDataBaseContext context, IMessagePublisher messagePublisher, IMessageLoggingService loggingService, IMediator mediator)
 {
     _context          = context;
     _messagePublisher = messagePublisher;
     _loggingService   = loggingService;
     _mediator         = mediator;
 }
コード例 #3
0
        private void ProcessAsyncBuildRequest()
        {
            if (BuildManager.asyncBuildRequestQueue.CountIsLessThan <BuildManager.BuildRequest>(1) || BuildManager.building)
            {
                return;
            }
            BuildManager.BuildRequest buildRequest = BuildManager.asyncBuildRequestQueue.Peek();
            this.StartBuildCore(buildRequest);
            HostLogger hostLogger = null;

            if (buildRequest.DisplayOutput)
            {
                this.serviceProvider.MessageLoggingService().Clear();
                IMessageLoggingService messageLoggingService = this.serviceProvider.MessageLoggingService();
                CultureInfo            currentCulture        = CultureInfo.CurrentCulture;
                string   projectBuildStartedMessage          = StringTable.ProjectBuildStartedMessage;
                object[] displayName = new object[] { buildRequest.BuildContext.DisplayName, string.Join("; ", buildRequest.Targets) };
                messageLoggingService.WriteLine(string.Format(currentCulture, projectBuildStartedMessage, displayName));
                hostLogger = new HostLogger(buildRequest.BuildContext, this.serviceProvider)
                {
                    Verbosity = (Keyboard.IsKeyDown(Key.RightCtrl) ? LoggerVerbosity.Diagnostic : LoggerVerbosity.Minimal)
                };
            }
            BuildManager.ProjectBuilder projectBuilder = new BuildManager.ProjectBuilder(this, buildRequest, hostLogger, buildRequest.DisplayOutput, false);
            Thread thread = new Thread(new ThreadStart(projectBuilder.Build));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            BuildManager.currentBuildThread = thread;
            projectBuilder.PollBuildThread(thread);
        }
コード例 #4
0
ファイル: HostLogger.cs プロジェクト: radtek/Shopdrawing
 public HostLogger(IProjectBuildContext buildTarget, IServiceProvider serviceProvider)
 {
     this.buildTarget     = buildTarget;
     this.messageLogger   = (IMessageLoggingService)serviceProvider.GetService(typeof(IMessageLoggingService));
     this.serviceProvider = serviceProvider;
     this.consoleLogger   = new HostLogger.AlterableConsoleLogger(LoggerVerbosity.Normal);
     this.consoleLogger.SetWriter(new WriteHandler(this.Writer));
 }
コード例 #5
0
ファイル: TemplateManager.cs プロジェクト: radtek/Shopdrawing
        internal void LogTemplateLoadError(string vsTemplatePath, string message)
        {
            IMessageLoggingService messageLoggingService = this.Services.MessageLoggingService();
            CultureInfo            currentCulture        = CultureInfo.CurrentCulture;
            string errorLoadingTemplate = StringTable.ErrorLoadingTemplate;

            object[] objArray = new object[] { vsTemplatePath, message };
            messageLoggingService.WriteLine(string.Format(currentCulture, errorLoadingTemplate, objArray));
        }
コード例 #6
0
        public void LogMessage(string message)
        {
            IMessageLoggingService loggingService = this.LoggingService;

            if (loggingService == null)
            {
                return;
            }
            UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Normal, (Action)(() => loggingService.WriteLine(message.TrimStart('\r', '\n'))));
        }
コード例 #7
0
ファイル: BrushCategory.cs プロジェクト: radtek/Shopdrawing
        public BrushCategory(string localizedName, IMessageLoggingService messageLogger)
            : base(CategoryLocalizationHelper.CategoryName.Brushes, localizedName, messageLogger)
        {
            ObservableCollection <PropertyEntry> basicProperties = this.BasicProperties;

            this.brushCollectionView                 = new ListCollectionView((IList)basicProperties);
            this.brushCollectionView.CustomSort      = (IComparer) new BrushCategory.PropertyComparer();
            this.brushCollectionView.CurrentChanged += new EventHandler(this.OnBrushCurrentChanged);
            basicProperties.CollectionChanged       += new NotifyCollectionChangedEventHandler(this.OnBasicPropertiesChanged);
        }
コード例 #8
0
 public SceneNodeCategory(CategoryLocalizationHelper.CategoryName canonicalName, string localizedName, IMessageLoggingService messageLogger)
     : base(localizedName)
 {
     this.canonicalName = canonicalName;
     this.messageLogger = messageLogger;
     this.CategoryEditors.CollectionChanged += new NotifyCollectionChangedEventHandler(this.CategoryEditors_CollectionChanged);
     this.basicProperties    = new ObservableCollectionWorkaround <PropertyEntry>();
     this.advancedProperties = new ObservableCollectionWorkaround <PropertyEntry>();
     this.order = new SceneNodeCategory.CategoryOrder(this);
     this.InitializeIcons();
 }
コード例 #9
0
 public bool LogMessage(string message)
 {
     if (this.sceneViewModel != null)
     {
         IMessageLoggingService messageLoggingService = this.sceneViewModel.DesignerContext.MessageLoggingService;
         if (messageLoggingService != null)
         {
             messageLoggingService.WriteLine(message);
             return(true);
         }
     }
     return(false);
 }
コード例 #10
0
 public BehaviorCommandCategory(string localizedName, IMessageLoggingService messageLogger)
     : base(CategoryLocalizationHelper.CategoryName.BehaviorCommand, localizedName, messageLogger)
 {
     this.TriggerNodes    = new ObservableCollection <PropertyEntry>();
     this.TriggerNodeView = CollectionViewSource.GetDefaultView((object)this.TriggerNodes);
     this.TriggerNodeView.CurrentChanged          += new EventHandler(this.OnCurrentTriggerChanged);
     this.triggerBasicPropertiesViewSource         = new CollectionViewSource();
     this.triggerBasicPropertiesViewSource.Filter += new FilterEventHandler(this.TriggerBasicPropertiesFilter);
     this.triggerBasicPropertiesViewSource.SortDescriptions.Add(new SortDescription("PropertyOrder", ListSortDirection.Ascending));
     this.triggerBasicPropertiesViewSource.SortDescriptions.Add(new SortDescription("PropertyName", ListSortDirection.Ascending));
     this.triggerAdvancedPropertiesViewSource         = new CollectionViewSource();
     this.triggerAdvancedPropertiesViewSource.Filter += new FilterEventHandler(this.TriggerAdvancedPropertiesFilter);
     this.triggerAdvancedPropertiesViewSource.SortDescriptions.Add(new SortDescription("PropertyOrder", ListSortDirection.Ascending));
     this.triggerAdvancedPropertiesViewSource.SortDescriptions.Add(new SortDescription("PropertyName", ListSortDirection.Ascending));
 }
コード例 #11
0
        private void ShowMefComposeError()
        {
            IConfigurationService        service1 = this.Services.GetService <IConfigurationService>();
            IMessageDisplayService       service2 = this.Services.GetService <IMessageDisplayService>();
            IMessageLoggingService       service3 = this.Services.GetService <IMessageLoggingService>();
            IExpressionMefHostingService service4 = this.Services.GetService <IExpressionMefHostingService>();

            if (this.mefExceptionToShow == null && Enumerable.Count <Exception>(service4.CompositionExceptions) <= 0)
            {
                return;
            }
            bool doNotAskAgain = service1 != null && (bool)service1["MEFHosting"].GetProperty("DoNotWarnAboutMefCompositionException", (object)false);

            if (!doNotAskAgain && service3 != null && (service4 != null && Enumerable.Count <Exception>(service4.CompositionExceptions) > 0))
            {
                foreach (Exception exception in service4.CompositionExceptions)
                {
                    service3.WriteLine(exception.Message);
                }
            }
            service4.ClearCompositionExceptions();
            if (!doNotAskAgain && service3 != null && (this.mefExceptionToShow != null && !string.IsNullOrEmpty(this.mefExceptionToShow.Message)))
            {
                service3.WriteLine(this.mefExceptionToShow.Message);
            }
            this.mefExceptionToShow = (Exception)null;
            if (doNotAskAgain || service2 == null)
            {
                return;
            }
            string         str  = Path.Combine(Path.GetDirectoryName(this.GetType().Module.FullyQualifiedName), "extensions");
            MessageBoxArgs args = new MessageBoxArgs()
            {
                Message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.MefCompositionException, new object[1]
                {
                    (object)str
                }),
                Button = MessageBoxButton.OK,
                Image  = MessageBoxImage.Exclamation
            };
            int num = (int)service2.ShowMessage(args, out doNotAskAgain);

            if (!doNotAskAgain || service1 == null)
            {
                return;
            }
            service1["MEFHosting"].SetProperty("DoNotWarnAboutMefCompositionException", (object)true);
        }
コード例 #12
0
        public static PropertyValueEditor GetValueEditor(IEnumerable attributes, IMessageLoggingService exceptionLogger)
        {
            PropertyValueEditor propertyValueEditor = (PropertyValueEditor)null;

            if (attributes != null)
            {
                foreach (Attribute attribute in attributes)
                {
                    EditorAttribute editorAttribute = attribute as EditorAttribute;
                    if (editorAttribute != null)
                    {
                        try
                        {
                            Type type = Type.GetType(editorAttribute.EditorTypeName);
                            if (type != (Type)null)
                            {
                                if (typeof(PropertyValueEditor).IsAssignableFrom(type))
                                {
                                    propertyValueEditor = (PropertyValueEditor)Activator.CreateInstance(type);
                                    break;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            if (exceptionLogger != null)
                            {
                                exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.ValueEditorLoadFailed, new object[1]
                                {
                                    (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex)
                                }));
                            }
                        }
                    }
                }
            }
            return(propertyValueEditor);
        }
コード例 #13
0
        public static IDictionary <Type, IList <NewItemFactory> > GetNewItemFactoriesFromAttributes(IList <NewItemTypesAttribute> attributes, IMessageLoggingService exceptionLogger)
        {
            Dictionary <Type, IList <NewItemFactory> > dictionary = new Dictionary <Type, IList <NewItemFactory> >();

            foreach (NewItemTypesAttribute itemTypesAttribute in (IEnumerable <NewItemTypesAttribute>)attributes)
            {
                try
                {
                    NewItemFactory newItemFactory = (NewItemFactory)Activator.CreateInstance(itemTypesAttribute.FactoryType);
                    if (newItemFactory != null)
                    {
                        foreach (Type key in itemTypesAttribute.Types)
                        {
                            IList <NewItemFactory> list;
                            if (!dictionary.TryGetValue(key, out list))
                            {
                                list = (IList <NewItemFactory>) new List <NewItemFactory>();
                                dictionary.Add(key, list);
                            }
                            list.Add(newItemFactory);
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (exceptionLogger != null)
                    {
                        exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.CollectionItemFactoryInstantiateFailed, new object[1]
                        {
                            (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex)
                        }));
                    }
                }
            }
            return((IDictionary <Type, IList <NewItemFactory> >)dictionary);
        }
コード例 #14
0
 public ConditionalExpressionBehaviorCategory(string localizedName, IMessageLoggingService messageLogger)
     : base(CategoryLocalizationHelper.CategoryName.BehaviorCommand, localizedName, messageLogger)
 {
     this.ConditionNodes     = new ObservableCollection <PropertyEntry>();
     this.ConditionsNodeView = CollectionViewSource.GetDefaultView((object)this.ConditionNodes);
 }
コード例 #15
0
 public NewItemFactoryTypeModel(Type type, NewItemFactory factory, IMessageLoggingService exceptionLogger)
     : this(type, factory)
 {
     this.exceptionLogger = exceptionLogger;
 }
コード例 #16
0
 public EasingCategoryCollection(string localizedName, IMessageLoggingService messageLogger)
     : base(CategoryLocalizationHelper.CategoryName.Easing, localizedName, messageLogger)
 {
 }
コード例 #17
0
 public LayoutPositionCategory(string localizedName, IMessageLoggingService messageLogger)
     : base(CategoryLocalizationHelper.CategoryName.Layout, localizedName, messageLogger)
 {
 }
コード例 #18
0
ファイル: CategoryFactory.cs プロジェクト: radtek/Shopdrawing
 public override SceneNodeCategory CreateSceneNodeCategory(CategoryLocalizationHelper.CategoryName canonicalName, string localizedName, IMessageLoggingService messageLogger)
 {
     return((SceneNodeCategory) new TextCategory(localizedName, messageLogger));
 }
コード例 #19
0
 public void SetImplementation(IMessageLoggingService logger)
 {
     this.logger = logger;
 }
コード例 #20
0
 public TriggerCategory(string localizedName, IMessageLoggingService messageLogger)
     : base(CategoryLocalizationHelper.CategoryName.Triggers, localizedName, messageLogger)
 {
 }
コード例 #21
0
 public virtual SceneNodeCategory CreateSceneNodeCategory(CategoryLocalizationHelper.CategoryName canonicalName, string localizedName, IMessageLoggingService messageLogger)
 {
     return(new SceneNodeCategory(canonicalName, localizedName, messageLogger));
 }