示例#1
0
        public void Discard(CompositionDiagramElement element, bool isComposition)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var path     = isComposition ? _compositionsPath : _strategiesPath;
            var file     = Path.Combine(path, element.GetFileName());
            var settings = CultureInfo.InvariantCulture.DoInCulture(() => _serializer.Deserialize(file));

            _compositionRegistry.Load(element, settings);
        }
示例#2
0
        private void LoadElements()
        {
            foreach (var element in ConfigurationExtensions.GetDiagramElements())
            {
                _compositionRegistry.DiagramElements.Add(element);
            }

            if (!Directory.Exists(_compositionsPath))
            {
                Directory.CreateDirectory(_compositionsPath);
            }

            var files = Directory.GetFiles(_compositionsPath, "*.xml");

            foreach (var file in files)
            {
                try
                {
                    _compositionRegistry.Load(_serializer.Deserialize(file));
                }
                catch (Exception excp)
                {
                    this.AddErrorLog("Load {0} composition element error: {1}", file, excp);
                }
            }

            _compositions.Clear();
            _compositions.AddRange(DiagramElements.OfType <CompositionDiagramElement>());
        }
示例#3
0
        private void LoadElements()
        {
            foreach (var element in ConfigurationExtensions.GetDiagramElements())
            {
                _compositionRegistry.DiagramElements.Add(element);
            }

            if (!Directory.Exists(_compositionsPath))
            {
                Directory.CreateDirectory(_compositionsPath);
            }

            var files = Directory.GetFiles(_compositionsPath, "*.xml");

            foreach (var file in files)
            {
                try
                {
                    _compositionRegistry.Load(_serializer.Deserialize(file));
                }
                catch (Exception excp)
                {
                    this.AddErrorLog(LocalizedStrings.Str3046Params, file, excp);
                }
            }
        }
示例#4
0
        private void InitializeCompositions()
        {
            var compositionSerializer = new CompositionRegistry();

            ConfigManager.RegisterService(compositionSerializer);

            compositionSerializer.DiagramElements.AddRange(AppConfig.Instance.DiagramElements.Select(t => t.CreateInstance <DiagramElement>()));
            Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true));
        }
示例#5
0
		private void InitializeCompositions()
		{
			var compositionSerializer = new CompositionRegistry();

			ConfigManager.RegisterService(compositionSerializer);

			compositionSerializer.DiagramElements.AddRange(AppConfig.Instance.DiagramElements.Select(t => t.CreateInstance<DiagramElement>()));
			Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true));
		}
示例#6
0
        private void InitializeCompositions()
        {
            var compositionSerializer = new CompositionRegistry();

            ConfigManager.RegisterService(compositionSerializer);

            compositionSerializer.DiagramElements.AddRange(Configuration.Extensions.GetDiagramElements());
            Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true));
        }
示例#7
0
		private void InitializeCompositions()
		{
			var compositionSerializer = new CompositionRegistry();

			ConfigManager.RegisterService(compositionSerializer);

			compositionSerializer.DiagramElements.AddRange(Configuration.Extensions.GetDiagramElements());
			Directory.GetFiles("Compositions", "*.xml").Select(File.ReadAllText).ForEach(s => compositionSerializer.Load(s.LoadSettingsStorage(), true));
		}