當前位置: 首頁>>代碼示例>>C#>>正文


C# Accelerometer.Start方法代碼示例

本文整理匯總了C#中Accelerometer.Start方法的典型用法代碼示例。如果您正苦於以下問題:C# Accelerometer.Start方法的具體用法?C# Accelerometer.Start怎麽用?C# Accelerometer.Start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Accelerometer的用法示例。


在下文中一共展示了Accelerometer.Start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Accelerometro

        public Accelerometro()
        {
            InitializeComponent();

            accelerometer = new Accelerometer();
            accelerometer.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100);
            accelerometer.Start();

            myFile = IsolatedStorageFile.GetUserStoreForApplication();

            if (!myFile.FileExists("Impo.txt"))
            {
                IsolatedStorageFileStream dataFile = myFile.CreateFile("Impo.txt");
                dataFile.Close();
            }

            Wb = new WebBrowser();
            Connesso = false;
            Carica();

            System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
            dt.Interval = new TimeSpan(0, 0, 0, 0, 250); // 500 Milliseconds
            dt.Tick += new EventHandler(dt_Tick);
            dt.Start();
        }
開發者ID:AndreaBruno,項目名稱:Macchinino,代碼行數:25,代碼來源:Accelerometro.xaml.cs

示例2: MainPage

        // Constructor
        public MainPage()
        {
            InitializeComponent();

            statusLocked.Visibility = System.Windows.Visibility.Collapsed;
            statusUnlocked.Visibility = System.Windows.Visibility.Collapsed;
            accelstatus.Visibility = System.Windows.Visibility.Collapsed;

            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 0, 0, 25);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();

            if (Accelerometer.IsSupported)
            {
                Accelerometer sens = new Accelerometer();
                sens.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(sens_CurrentValueChanged);
                sens.Start();

            }
            else
            {   //It's disabled
                accelstatus.IsChecked = true;
                statusLocked.Visibility = System.Windows.Visibility.Visible;
                statusUnlocked.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
開發者ID:jessenic,項目名稱:wph-orientationlock,代碼行數:28,代碼來源:MainPage.xaml.cs

示例3: Ship

        public Ship(Game game, Vector2 PosicaoInicial, Texture2D texture, SoundEffect SoundShip)
            : base(game, PosicaoInicial, texture)
        {
            _game = game;
            ShipSound = SoundShip;
            ShipSound.Play();

            SpriteX = 0;
            SpriteY = 0;
            PosicaoX = (int)PosicaoInicial.X;
            PosicaoY = (int)PosicaoInicial.Y;

            Vida = 100;

            accelReading = new Vector3();
            accelSensor = new Accelerometer();
            accelSensor.ReadingChanged +=
                new EventHandler<AccelerometerReadingEventArgs>(AccelerometerReadingChanged);
            try
            {
                accelSensor.Start();
                accelActive = true;
            }
            catch (AccelerometerFailedException e)
            {
                accelActive = false;

            }
            catch (UnauthorizedAccessException e)
            {
                accelActive = false;
            }
        }
開發者ID:danielhba,項目名稱:Invasion,代碼行數:33,代碼來源:Ship.cs

示例4: Accelerometer_Click

//get accelerometer values
        private void Accelerometer_Click(object sender, RoutedEventArgs e)
        {
            accelerometer = new Accelerometer();
            accelerometer.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
            accelerometer.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(accelerometer_valuechanged);
            accelerometer.Start();
        }
開發者ID:tarunsharma1,項目名稱:phoneaswiiremote,代碼行數:8,代碼來源:MainPage.xaml.cs

示例5: StartMonitoring

        static partial void StartMonitoring()
        {
            accelerometer = new Accelerometer { TimeBetweenUpdates = TimeSpan.FromMilliseconds((long)Interval) };

            accelerometer.CurrentValueChanged += AccelerometerOnCurrentValueChanged;
            accelerometer.Start();
        }
開發者ID:paul33868,項目名稱:SimplyMobile,代碼行數:7,代碼來源:Accelometer.cs

示例6: WP7Input

            public WP7Input()
            {
                #region Accelerometer support
                mAccValues = new Vector3();
                mAccMeter = new Accelerometer();
                mAccMeter.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(AccMeterChange);
                // event services when accelerometer settings change
                // This function is defined in Game1_Accelerometer.
                try
                {
                    mAccMeter.Start();  // Starts the acceleromter sampling
                }
                catch (AccelerometerFailedException ex)
                {
                    System.Diagnostics.Debug.WriteLine("Accelerometer Starting failed!: " + ex.ToString());
                }
                #endregion

                #region Gesture support
                //mPinchHasBegin = false;
                //TouchPanel.EnabledGestures = GestureType.Tap |
                //                             GestureType.DoubleTap |
                //                             GestureType.Hold |
                //                             GestureType.Flick |
                //                             GestureType.Pinch |
                //                             GestureType.FreeDrag |
                //                             GestureType.PinchComplete;
                #endregion
            }
開發者ID:AntMartz,項目名稱:fat-cats-final,代碼行數:29,代碼來源:InputSupport_WP7.cs

示例7: ShapePage

        public ShapePage()
        {
            InitializeComponent();
            if (accelerometer == null)
            {
                accelerometer = new Accelerometer();
                accelerometer.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
                accelerometer.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(accelerometer_CurrentValueChanged);
                accelerometer.Start();
            }
            BitmapImage bi = new BitmapImage();
            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                /*var filestream = store.OpenFile("image.jpg", System.IO.FileMode.Open, System.IO.FileAccess.Read);
                var imageAsBitmap = Microsoft.Phone.PictureDecoder.DecodeJpeg(filestream);
                image2.Source = imageAsBitmap;*/
                if (store.FileExists("tempJPEG2"))
                {
                    using (IsolatedStorageFileStream fileStream = store.OpenFile("tempJPEG2", System.IO.FileMode.Open, System.IO.FileAccess.Read))
                    {
                        bi.SetSource(fileStream);
                        image2.Source = bi;
                    }
                }
                else
                {
                    var filestream = store.OpenFile("image.jpg", System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    var imageAsBitmap = Microsoft.Phone.PictureDecoder.DecodeJpeg(filestream);
                    image2.Source = imageAsBitmap;
                }

            }
            
            stickerNum = 0;
        }
開發者ID:aabrohi,項目名稱:kinect-kollage,代碼行數:35,代碼來源:ShapePage.xaml.cs

示例8: Ball

        /// <summary>
        /// Creates a new ball at position 0,0
        /// </summary>
        /// <param name="graphicsDevice">Graphics device to load the </param>
        public Ball(GraphicsDevice graphicsDevice)
        {
            X = 0;
            Y = 0;

            speedX = 0.5f;
            speedY = 0.5f;

            accelerationSpeed = 1.0f;

            speedCap = 5f;
            resistance = 0.3f;

            if (accelerometer == null)
            {
                accelerometer = new Accelerometer();

                accelerometer.Start();

            }
            using (var stream = TitleContainer.OpenStream("Content/balle.png"))
            {
                sprite = Texture2D.FromStream(graphicsDevice, stream);
            }
        }
開發者ID:AntonyGarand,項目名稱:Labyrinth,代碼行數:29,代碼來源:Ball.cs

示例9: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            accel = new Accelerometer();
            accel.Start();

            SetupObservable();
        }
開發者ID:jwooley,項目名稱:RxSamples,代碼行數:7,代碼來源:MainPage.xaml.cs

示例10: AccelerometerSensor

 static AccelerometerSensor()
 {
     MaxValue = 0.6f;
     MinValue = -MaxValue;
     accelerometer = new Accelerometer();
     accelerometer.ReadingChanged += accelerometer_ReadingChanged;
     accelerometer.Start();
 }
開發者ID:dreasgrech,項目名稱:FPE3Sandbox,代碼行數:8,代碼來源:AccelerometerSensor.cs

示例11: Player

        public Player()
        {
            this.InTrap = false;
            this.Color = Color.White;
            this.Position = new Vector2(480 / 2 - w / 2, 750); //yay magic numbers
            accelerometer = new Accelerometer();
            accelerometer.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(accelerometer_CurrentValueChanged);

            accelerometer.Start();
        }
開發者ID:kulhajs,項目名稱:LudumDare27,代碼行數:10,代碼來源:Player.cs

示例12: UserControl_Loaded

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                accelerometer = new Accelerometer();

                accelerometer.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(acc_CurrentValueChanged);
                accelerometer.Start();
            }
        }
開發者ID:gyurisc,項目名稱:AcceleratedKnob,代碼行數:10,代碼來源:AcceleratedKnob.xaml.cs

示例13: Sensors

        public Sensors()
        {
            InitializeComponent();

            if (Accelerometer.IsSupported)
            {
                var acc = new Accelerometer();
                acc.Start();
                acc.CurrentValueChanged += acc_CurrentValueChanged;
            }
        }
開發者ID:natsirt20,項目名稱:School,代碼行數:11,代碼來源:Sensors.xaml.cs

示例14: PlayerModel

        public PlayerModel(Model m)
            : base(m)
        {
            accelerometer = new Accelerometer();

            // Create an accelerometer event handler
            accelerometer.ReadingChanged +=
                new EventHandler<AccelerometerReadingEventArgs>(AccelerometerDataChanged);

            // Start the accelerometer
            accelerometer.Start();
        }
開發者ID:mattgmg1990,項目名稱:Computer-Graphics-Final-Project,代碼行數:12,代碼來源:PlayerModel.cs

示例15: OnNavigatedTo

 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     dt.Tick += dt_Tick;
     OrientationChanged += CardPage_OrientationChanged;
     CurrentGameType = Int32.Parse(NavigationContext.QueryString["game"]);
     CountdownTimer.Completed += CountdownTimer_Completed;
     CorrectShow.Completed += CorrectShow_Completed;
     accel = new Accelerometer();
     accel.CurrentValueChanged += accel_CurrentValueChanged;
     accel.Start();
 }
開發者ID:jeffblankenburg,項目名稱:Guess,代碼行數:12,代碼來源:CardPage.xaml.cs


注:本文中的Accelerometer.Start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。