public static void ApplyEnvironmentBackground(BackgroundImageSettings settings)
        {
            string imageFileName = settings.EnvironmentImagePathAndName;
            ResourceDictionary resources = Application.Current.Resources;

            SetEnvironmentImageBrush(resources, imageFileName, false);
        }
        public BackgroundTextViewWorker(IWpfTextView textView)
        {
            if (textView == null)
                throw new ArgumentException("textView is null");
            _backgroundView = textView;

            EventHandler onSizeChangedEventHandler = (object sender, EventArgs args) => OnSizeChanged();
            try
            {
                _configurationDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                if (_configurationDirectory == null || string.IsNullOrEmpty(_configurationDirectory))
                    throw new ArgumentException("_configurationDirectory is null or empty");

                _configurationDataPath = Path.Combine(_configurationDirectory, CONFIGURATION_FILE_NAME);

                if (_configurationDataPath != null)
                {
                    _settings = new BackgroundImageSettings(new Uri(_configurationDataPath));
                }
                _adornmentLayer = textView.GetAdornmentLayer("BackgroundTextViewWorker");

                IWpfTextView newTextView = _backgroundView;
                newTextView.ViewportWidthChanged += onSizeChangedEventHandler;
                newTextView.ViewportHeightChanged += onSizeChangedEventHandler;

                // Set the environment background
                EnvBackgroundManager.ApplyEnvironmentBackground(_settings);
            }
            catch (Exception e)
            {
                // todo: better logging
            }
        }
        public void CreateInstance_Test()
        {
            var settings = new BackgroundImageSettings(
                new Uri(Path.Combine(Directory.GetCurrentDirectory(), "config.dat")));

            Assert.IsNotNull(settings);
            Assert.IsInstanceOfType(settings, typeof (BackgroundImageSettings));
        }