Ejemplo n.º 1
0
        public MainViewModel([NotNull] ResourceManager resourceManager, [NotNull] Configuration configuration, [NotNull] ResourceViewModel resourceViewModel, [NotNull] ITracer tracer, [NotNull] SourceFilesProvider sourceFilesProvider)
        {
            ResourceManager     = resourceManager;
            _configuration      = configuration;
            _resourceViewModel  = resourceViewModel;
            _tracer             = tracer;
            SourceFilesProvider = sourceFilesProvider;

            resourceManager.BeginEditing += ResourceManager_BeginEditing;
            resourceManager.Reloading    += ResourceManager_Reloading;

            try
            {
                var folder = Settings.Default.StartupFolder;

                if (string.IsNullOrEmpty(folder))
                {
                    return;
                }

                SourceFilesProvider.Folder = folder;

                if (Directory.Exists(folder))
                {
                    Load();
                }
            }
            catch (Exception ex)
            {
                _tracer.TraceError(ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public MainViewModel(ResourceManager resourceManager, Configuration configuration, ITracer tracer, SourceFilesProvider sourceFilesProvider)
        {
            Contract.Requires(resourceManager != null);
            Contract.Requires(configuration != null);
            Contract.Requires(tracer != null);
            Contract.Requires(sourceFilesProvider != null);

            _resourceManager     = resourceManager;
            _configuration       = configuration;
            _tracer              = tracer;
            _sourceFilesProvider = sourceFilesProvider;

            resourceManager.BeginEditing += ResourceManager_BeginEditing;

            try
            {
                var folder = Settings.Default.StartupFolder;

                if (string.IsNullOrEmpty(folder))
                {
                    return;
                }

                SourceFilesProvider.Folder = folder;

                if (Directory.Exists(folder))
                {
                    Load();
                }
            }
            catch (Exception ex)
            {
                _tracer.TraceError(ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }