예제 #1
0
        public void Save(IExplicitConnectionCache explicitConnectionCache, IGeneralSettings generalSettings)
        {
            lock (_gate)
            {
                var layoutStructure = LayoutAnalayzer.GetLayoutStructure();
                var data            = Serializer.Stringify(explicitConnectionCache, generalSettings, layoutStructure);

                new Persistance().TrySaveRaw(data);
            }
        }
        public async Task AddLayout()
        {
            string name          = string.IsNullOrWhiteSpace(NewLayoutName) ? GetNewLayoutName() : NewLayoutName;
            var    currentLayout = LayoutAnalayzer.GetLayoutStructure(name);

            _configurationService.ActiveConfiguration.Layouts.Add(LayoutManager.SerializeStructure(currentLayout));
            _configurationService.Save();
            NewLayoutName = string.Empty;

            await _eventAggregator.PublishOnUIThreadAsync(new LayoutsChanged());
        }
        public async Task OverrideLayout(LayoutStructure layoutStructure)
        {
            var currentLayout              = LayoutAnalayzer.GetLayoutStructure(layoutStructure.Name);
            var oldSerializedStructure     = LayoutManager.SerializeStructure(layoutStructure);
            var currentSerializedStructure = LayoutManager.SerializeStructure(currentLayout);

            if (_configurationService.ActiveConfiguration.Layouts.Contains(oldSerializedStructure))
            {
                var index = _configurationService.ActiveConfiguration.Layouts.IndexOf(oldSerializedStructure);
                _configurationService.ActiveConfiguration.Layouts.Remove(oldSerializedStructure);
                _configurationService.ActiveConfiguration.Layouts.Insert(index, currentSerializedStructure);
                _configurationService.Save();
            }

            await _eventAggregator.PublishOnUIThreadAsync(new LayoutsChanged());
        }