コード例 #1
0
        public MainView([NotNull] ExportProvider exportProvider)
        {
            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #2
0
        public CodeGeneratorView([NotNull] ExportProvider exportProvider)
        {
            Contract.Requires(exportProvider != null);

            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #3
0
        public LanguageConfigurationView(ExportProvider exportProvider)
        {
            Contract.Requires(exportProvider != null);

            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #4
0
        public CodeReferencesToolTip(ExportProvider exportProvider)
        {
            Contract.Requires(exportProvider != null);

            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #5
0
        public MoveToResourceView(ExportProvider exportProvider)
        {
            Contract.Requires(exportProvider != null);

            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #6
0
        public static void TraceXamlLoaderError([NotNull] this ExportProvider exportProvider, [CanBeNull] Exception ex)
        {
            var exception = ex?.Message;

            if (exception != null)
            {
                exportProvider.TraceError(exception);
            }

            var path = Path.GetDirectoryName(typeof(ITracer).Assembly.Location);

            Contract.Assume(!string.IsNullOrEmpty(path));

            var assemblyFileNames = Directory.EnumerateFiles(path, @"*.dll")
                                    .ToArray();

            var assemblyNames = new HashSet <string>(assemblyFileNames.Select(Path.GetFileNameWithoutExtension));

            var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();

            var assemblies = loadedAssemblies
                             .Where(a => assemblyNames.Contains(a.GetName().Name))
                             .ToArray();

            var messages = assemblies
                           .Select(assembly => string.Format(CultureInfo.CurrentCulture, "Assembly '{0}' loaded from {1}", assembly.FullName, assembly.CodeBase))
                           .OrderBy(text => text, StringComparer.OrdinalIgnoreCase)
                           .ToArray();

            foreach (var message in messages)
            {
                exportProvider.WriteLine(message);
            }

            var assembliesByName = assemblies
                                   .GroupBy(a => a.FullName)
                                   .Where(g => g.Count() > 1)
                                   .Select(g => g.Key)
                                   .ToArray();

            if (assembliesByName.Any())
            {
                exportProvider.WriteLine("Duplicate assemblies found: " + string.Join(", ", assembliesByName));
            }

            exportProvider.WriteLine("Please read https://github.com/tom-englert/ResXResourceManager/wiki/Fixing-errors before creating an issue.");
        }
コード例 #7
0
        public VsixShellView(ExportProvider exportProvider, ThemeManager themeManager)
        {
            Contract.Requires(exportProvider != null);
            Contract.Requires(themeManager != null);

            try
            {
                this.SetExportProvider(exportProvider);
                _themeManager = themeManager;

                InitializeComponent();
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }
コード例 #8
0
        public VsixShellView([NotNull] ExportProvider exportProvider, [NotNull] ThemeManager themeManager, VsixShellViewModel viewModel)
        {
            Contract.Requires(exportProvider != null);
            Contract.Requires(themeManager != null);

            _themeManager = themeManager;

            try
            {
                this.SetExportProvider(exportProvider);

                InitializeComponent();

                DataContext = viewModel;
                Resources.MergedDictionaries.Add(DataTemplateManager.CreateDynamicDataTemplates(exportProvider));
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());

                var path = Path.GetDirectoryName(GetType().Assembly.Location);
                Contract.Assume(!string.IsNullOrEmpty(path));

                var assemblyFileNames = Directory.EnumerateFiles(path, @"*.dll")
                                        .Where(file => !"DocumentFormat.OpenXml.dll".Equals(Path.GetFileName(file), StringComparison.OrdinalIgnoreCase))
                                        .ToArray();

                var assemblyNames = new HashSet <string>(assemblyFileNames.Select(Path.GetFileNameWithoutExtension));

                var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();

                var messages = loadedAssemblies
                               .Where(a => assemblyNames.Contains(a.GetName().Name))
                               .Select(assembly => string.Format(CultureInfo.CurrentCulture, "Assembly '{0}' loaded from {1}", assembly.FullName, assembly.CodeBase))
                               .OrderBy(text => text, StringComparer.OrdinalIgnoreCase)
                               .ToArray();

                foreach (var message in messages)
                {
                    exportProvider.WriteLine(message);
                }
            }
        }
コード例 #9
0
        public ResourceView(ExportProvider exportProvider, ResourceManager resourceManager)
        {
            Contract.Requires(exportProvider != null);
            Contract.Requires(resourceManager != null);

            try
            {
                this.SetExportProvider(exportProvider);

                _resourceManager         = resourceManager;
                _resourceManager.Loaded += ResourceManager_Loaded;

                InitializeComponent();

                DataGrid.SetupColumns(_resourceManager);
            }
            catch (Exception ex)
            {
                exportProvider.TraceError(ex.ToString());
            }
        }