using System.Configuration; using System.IO; namespace RhSolutions.Services; public class AddInConfiguration : ApplicationSettingsBase, IAddInConfiguration { private Dictionary _priceListParameters; public AddInConfiguration() { _priceListParameters = new Dictionary() { ["Amount"] = AmountHeader, ["OldSku"] = OldSkuHeader, ["Sku"] = SkuHeader, ["Group"] = GroupHeader, ["Name"] = NameHeader }; } [UserScopedSetting] [DefaultSettingValue("Кол-во")] public string AmountHeader { get { return (string)this[nameof(AmountHeader)]; } } [UserScopedSetting] [DefaultSettingValue("Прежний материал")] public string OldSkuHeader { get { return (string)this[nameof(OldSkuHeader)]; } } [UserScopedSetting] [DefaultSettingValue("Актуальный материал")] public string SkuHeader { get { return (string)this[nameof(SkuHeader)]; } } [UserScopedSetting] [DefaultSettingValue("Программа")] public string GroupHeader { get { return (string)this[nameof(GroupHeader)]; } } [UserScopedSetting] [DefaultSettingValue("Наименование")] public string NameHeader { get { return (string)this[nameof(NameHeader)]; } } [UserScopedSetting] public string PriceListPath { get { return (string)this[nameof(PriceListPath)]; } set { this[nameof(PriceListPath)] = value; } } public event SettingChangingEventHandler OnSettingsChange { add { base.SettingChanging += value; } remove { base.SettingChanging -= value; } } public string GetPriceListFileName() => Path.GetFileName(PriceListPath); public string GetPriceListPath() => PriceListPath; public void SetPriceListPath(string value) => PriceListPath = value; public void SaveSettings() => base.Save(); public Dictionary GetPriceListParameters() => _priceListParameters; }