public GeneralSettingsViewModel()
 {
     Settings = SettingsService.Current;
     (Settings as INotifyPropertyChanged).PropertyChanged += OnPropertyChanged;
     if (DesignMode.DesignMode2Enabled == false && App.Current is PrismUnityApplication)
     {
         _toastNotificationsService = App.Current.Container.Resolve <ToastNotificationsService>();
     }
 }
Пример #2
0
        public GeneralSettingsViewModel()
        {
            Settings = SettingsService.Current;
            (Settings as INotifyPropertyChanged).PropertyChanged += OnPropertyChanged;
            if (DesignMode.DesignMode2Enabled == false)
            {
                _toastNotificationsService = App.Current.Services.GetService <ToastNotificationsService>();
            }

            Audios = AudioDefinitions.Definitions;
        }
        /// <summary>
        /// Static constructor for AppManager class.
        /// </summary>
        static AppManager()
        {
            //            ServerHostURL = @"https://slotcarsgo.timtyler.co.uk";
            ServerHostURL              = @"http://localhost:55371";
            AppManager.localSettings   = ApplicationData.Current.LocalSettings;
            AppManager.localFolder     = ApplicationData.Current.LocalFolder;
            AppManager.TemporaryFolder = ApplicationData.Current.TemporaryFolder;
            AppManager.toastService    = new ToastNotificationsService();
            AppManager.Track           = new Track()
            {
                Name   = (string)localSettings.Values["TrackName"],
                Id     = (string)localSettings.Values["TrackId"],
                Secret = (string)localSettings.Values["Secret"]
                         //                Length = (float)trackCompositeValue["Length"],
                         //                MacAddress = (string)trackCompositeValue["MacAddress"],
            };

            ThemeSelectorService.Theme = Windows.UI.Xaml.ElementTheme.Dark;

            Mapper.Initialize(cfg => {
                cfg.CreateMap <RaceSession, RaceSessionDTO>()
                .ForMember(dest => dest.RaceLimitValue, opt => opt.MapFrom(src => src.RaceType.RaceLimitValue))
                .ForMember(dest => dest.RaceTypeId, opt => opt.MapFrom(src => src.RaceType.Name))
                .ForMember(dest => dest.RaceLength, opt => opt.MapFrom(src => src.RaceType.RaceLength))
                .ForMember(dest => dest.LapsNotDuration, opt => opt.MapFrom(src => src.RaceType.LapsNotDuration))
                .ForMember(dest => dest.CrashPenalty, opt => opt.MapFrom(src => src.RaceType.CrashPenalty));
                cfg.CreateMap <DriverResult, DriverResultDTO>()
                .ForMember(dest => dest.DriverId, opt => opt.MapFrom(src => src.Driver.UserId))
                .ForMember(dest => dest.CarId, opt => opt.MapFrom(src => src.Car.Id))
                .ForMember(dest => dest.Laps, opt => opt.MapFrom(src => src.LapTimes.Count))
                .ForMember(dest => dest.ControllerNumber, opt => opt.MapFrom(src => src.ControllerId));
                cfg.CreateMap <TrackDTO, Track>();
                cfg.CreateMap <CarDTO, Car>();
                cfg.CreateMap <DriverDTO, Driver>()
                .ForMember(dest => dest.SelectedCar, opt => opt.MapFrom(src => src.SelectedCar))
                .ReverseMap()
                .ForMember(src => src.SelectedCar, opt => opt.MapFrom(dest => dest.SelectedCar));
                cfg.CreateMap <RaceTypeDTO, RaceType>();
            });
        }
Пример #4
0
 private NotificationManager()
 {
     IsEnabled = true;
     _toastNotificationsService = new ToastNotificationsService();
     _notifications             = new List <ScheduledToastNotification>();
 }