public override void Initialize() { ModuleSettingDto moduleSetting = _settingsProvider.GetAvailableModules(); if (moduleSetting != null) { InstaPrinterVisible = moduleSetting.AvailableModules.Any(x => x == AppModules.InstaPrinter); SelfyPrinterVisible = moduleSetting.AvailableModules.Any(x => x != AppModules.InstaPrinter); } AppSettingsDto settings = _settingsProvider.GetAppSettings(); if (settings == null) { HashTag = string.Empty; _dateStart = new Hour(TimeSpan.FromHours(DateTime.Now.Hour)); _dateEnd = new Hour(TimeSpan.FromHours(DateTime.Now.Hour).Add(TimeSpan.FromMinutes(5))); RaisePropertyChanged(() => DateStart); RaisePropertyChanged(() => DateEnd); ShowPrinterOnStartup = false; return; } _printerName = settings.PrinterName; _hashTag = settings.HashTag; _maxPrinterCopies = settings.MaxPrinterCopies; _showPrinterOnStartup = settings.ShowPrinterOnStartup; // var dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).Add(_dateStart.GetCurrentTime()); _dateStart = new Hour(TimeSpan.FromHours(settings.DateStart.Hour).Add(TimeSpan.FromMinutes(settings.DateStart.Minute))); _dateEnd = new Hour(TimeSpan.FromHours(settings.DateEnd.Hour).Add(TimeSpan.FromMinutes(settings.DateEnd.Minute))); /*Из-за того что само время меняется в другом классе*/ _dateStart.PropertyChanged += OnTimePropertyChange; _dateEnd.PropertyChanged += OnTimePropertyChange; RaisePropertyChanged(() => DateStart); RaisePropertyChanged(() => DateEnd); RaisePropertyChanged(() => PrinterName); RaisePropertyChanged(() => HashTag); RaisePropertyChanged(() => MaxPrinterCopies); RaisePropertyChanged(() => ShowPrinterOnStartup); }
public TimeSelector() { //var hours = Enumerable.Range(0, 24).Select(x => new Hour(TimeSpan.FromHours(x))).ToList(); //ItemsSource = hours; var hours = Enumerable.Range(0, 24).Select(x => TimeSpan.FromHours(x)).ToList(); ItemsSource = hours; Time = new Hour(hours.First()); }