public void Load() // Загрузить - считать из config.ini [MAIN] { var defaultSettings = new MainSettings(); VolumeWmpMusic = ReadValue("Main", "VolumeMusic", s => Convert.ToInt32(s), defaultSettings.VolumeWmpMusic); VolumeWmpDop = ReadValue("Main", "VolumeDop", s => Convert.ToInt32(s), defaultSettings.VolumeWmpDop); MuzYmni = ReadValue("Main", "MuzYmni", s => Convert.ToBoolean(s), defaultSettings.MuzYmni); MuzRandom = ReadValue("Main", "MuzRandom", s => Convert.ToBoolean(s), defaultSettings.MuzRandom); PlayMuzNaPeremenax = ReadValue("Main", "PlayMuzNaPeremenax", s => Convert.ToBoolean(s), defaultSettings.PlayMuzNaPeremenax); PlayDops = ReadValue("Main", "PlayDops", s => Convert.ToBoolean(s), defaultSettings.PlayDops); AutoRun = ReadValue("Main", "AutoRun", s => Convert.ToBoolean(s), defaultSettings.AutoRun); RunMinimized = ReadValue("Main", "RunMinimized", s => Convert.ToBoolean(s), defaultSettings.RunMinimized); MelodyStart = ReadValue("Main", "MelodyStart", s => s, defaultSettings.MelodyStart); MelodyEnd = ReadValue("Main", "MelodyEnd", s => s, defaultSettings.MelodyEnd); FolderMusic = ReadValue("Main", "FolderMusic", s => s, defaultSettings.FolderMusic); ActiveOtherPlayer = ReadValue("Main", "ActiveOtherPlayer", s => Convert.ToBoolean(s), defaultSettings.ActiveOtherPlayer); OtherPlayer = ReadValue("Main", "OtherPlayer", s => s, defaultSettings.OtherPlayer); PoslednixPesen = ReadValue("Main", "PoslednixPesen", s => Convert.ToInt32(s), defaultSettings.PoslednixPesen); ModePlayMusic = ReadValue("Main", "ModePlayMusic", s => Convert.ToInt32(s), defaultSettings.ModePlayMusic); YsilNoControl = ReadValue("Main", "YsilNoControl", s => Convert.ToBoolean(s), defaultSettings.YsilNoControl); YsilAuto = ReadValue("Main", "YsilAuto", s => Convert.ToBoolean(s), defaultSettings.YsilAuto); YsilHands = ReadValue("Main", "YsilHands", s => Convert.ToBoolean(s), defaultSettings.YsilHands); YsilTime = ReadValue("Main", "YsilTime", s => Convert.ToBoolean(s), defaultSettings.YsilTime); YsilTimeOn = ReadValue("Main", "YsilTimeOn", s => TimeSpan.Parse(s), defaultSettings.YsilTimeOn); YsilTimeOff = ReadValue("Main", "YsilTimeOff", s => TimeSpan.Parse(s), defaultSettings.YsilTimeOff); ComPort = ReadValue("Main", "ComPort", s => s, defaultSettings.ComPort); DateTime emptyDate = new DateTime(); for (int i = 0; INI.KeyExistsINI("KanukulStart" + i, "Main"); i++) { var newKanuk = new Kanukyli(ReadValue("Main", "KanukulStart" + i, s => Convert.ToDateTime(s), emptyDate), ReadValue("Main", "KanukulEnd" + i, s => Convert.ToDateTime(s), emptyDate)); // если обе даты не стандартные т.е. считались норм if (newKanuk.DateStart != emptyDate && newKanuk.DateEnd != emptyDate) { Kanikuls.Add(newKanuk); } } for (int i = 0; INI.KeyExistsINI("Holiday" + i, "Main"); i++) { var newHolid = new Holiday(ReadValue("Main", "Holiday" + i, s => Convert.ToDateTime(s), emptyDate)); // если дата не стандартная т.е. считалась норм if (newHolid.Date != emptyDate) { Holidays.Add(newHolid); } } }
public AllSettings(ObservableCollection <RaspZvonkov> Rasps, MainSettings MainSett) { _rasps = Rasps; _mainSett = MainSett; }