예제 #1
0
        public MainPage()
        {
            Settings = AppSettings.Current;

            MovementSource = new MovementSource();
            MovementSource.GeoStatusChanged += MovementSource_GeoStatusChanged;
            MovementSource.PropertyChanged  += MovementSource_PropertyChanged;

            DataContext = this;

            SwitchMapStatusCommand = new RelayCommand(ExecuteSwitchMapStatusCommand, CanExecuteSwitchMapStatusCommand);
            SwitchMapStatusCommand.BindToPropertyChange(this, "MapStatus");
            SwitchWindscreenModeCommand = new RelayCommand(ExecuteSwitchWindscreenModeCommand);
            SwitchSpeedAlertCommand     = new RelayCommand(ExecuteSwitchSpeedAlertCommand);
            SwitchUnitsCommand          = new RelayCommand(ExecuteSwitchUnitsCommand);
            SwitchLocationAccessCommand = new RelayCommand(ExecuteSwitchLocationAccessCommand);
            AboutCommand = new RelayCommand(ExecuteAboutCommand);

            SpeedAlert = new SpeedAlert(MovementSource, SpeedAlert.SoundProvider);

            InitializeComponent();
            ShowWarnings();

            // no idling here
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            UpdateLocationAccess();
        }
예제 #2
0
        public AlertPage()
        {
            // HACK: simplest way to pass parameters
            alert    = (SpeedAlert)PhoneApplicationService.Current.State["SpeedAlert"];
            UseSound = alert.NotificationProvider == SpeedAlert.SoundProvider;
            Limit    = AppSettings.Current.SpeedLimit;

            TensSource  = new IntLoopingDataSource(0, 24, 1);
            UnitsSource = new IntLoopingDataSource(0, 5, 5)
            {
                Loop = false
            };
            CloseCommand = new RelayCommand(ExecuteCloseCommand, CanExecuteCloseCommand);
            CloseCommand.BindToPropertyChange(this, "Limit");

            DataContext = this;
            InitializeComponent();
        }