public void VibrateOnItemSelected() { vibrate.Start(TimeSpan.FromMilliseconds(200)); System.Threading.Thread.Sleep(500); vibrate.Start(TimeSpan.FromMilliseconds(200)); System.Threading.Thread.Sleep(500); }
public void startBuzz() { SoundEffectInstance alarmSound = PlaySound(@"Alarms/" + alarmSoundString); vibrate.Start(new TimeSpan(0, 0, 0, 0, vibrationLength)); alarmTimer.Start(); alarmBox = MessageBoxResult alarmBox = MessageBox.Show("Press OK to stop alarm", "Timer Finished", MessageBoxButton.OK); }
// Konstruktor public MainPage() { InitializeComponent(); // Datenkontext des Steuerelements LongListSelector auf die Beispieldaten festlegen DataContext = App.ViewModel; remoteControlClient.GetPersonAndDangerLocationCompleted += remoteControlClient_GetPersonAndDangerLocationCompleted; pollTimer = new System.Windows.Threading.DispatcherTimer(); pollTimer.Tick += new EventHandler(dispatcherTimer_Tick); pollTimer.Interval = new TimeSpan(0, 0, 1); pollTimer.Start(); vibrateController.Start(TimeSpan.FromMilliseconds(500)); }
public void PlaySound() { if (_strongBeat > PickerBeat.SelectedIndex) { _strongBeat = 0; } using (Stream stream = TitleContainer.OpenStream("Res/Sound/rhythm.wav")) { SoundEffect effect = SoundEffect.FromStream(stream); SoundEffectInstance sei = effect.CreateInstance(); if (_strongBeat == 0) { sei.Volume = (float)(SliderVolume.Value * 1); } else { sei.Volume = (float)(SliderVolume.Value * 0.6); } FrameworkDispatcher.Update(); sei.Play(); } _strongBeat++; if (CheckBoxVibrate.IsChecked.Value) { VibrateController vibController = VibrateController.Default; TimeSpan ts = TimeSpan.FromMilliseconds(50); vibController.Start(ts); } }
private void ProcessScan(Result successfulScan, TimeSpan scanTime, CodeType scanType) { bool flag = true; if (this._resultCache == null) { flag = true; } else { if (this._resultCache.Text.Length == successfulScan.Text.Length && this._resultCache.Text.Substring(1, 10) == successfulScan.Text.Substring(1, 10)) { flag = false; } } if (flag) { this._resultCache = successfulScan; if (scanType == CodeType.QRCode) { ParsedResult scanObject = ResultParser.parseResult(successfulScan); this.RaiseOnScanSuccessful(scanType, successfulScan.Text, scanObject, scanTime); } else { this.RaiseOnScanSuccessful(scanType, successfulScan.Text, successfulScan.Text, scanTime); } if (this.VibrateOnSuccess) { VibrateController @default = VibrateController.Default; @default.Start(this.VibrationTime); } } }
void vibrateTimer_Tick(object sender, EventArgs e) { VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(5000)); vibrateTimer.Stop(); }
private void calc_age(object sender, System.Windows.Input.MouseEventArgs e) { // TODO: Add event handler implementation here. try { // TODO: Add event handler implementation here. char[] param = { '/' }; string a = age.Text + "/"; string[] words = a.Split(param); double day = Convert.ToDouble(words[0]) - Convert.ToInt32(DateTime.Today.Day.ToString()); int mts = Convert.ToInt32(words[1]) - Convert.ToInt32(DateTime.Today.Month.ToString()); int yrs = Convert.ToInt32(words[2]) - Convert.ToInt32(DateTime.Today.Year.ToString()); totage = Convert.ToDouble(-1 * ((yrs * 12) + (mts) + (day / 30))); if (totage <= 12.0) { vc.Start(TimeSpan.FromMilliseconds(100)); MessageBox.Show("The Child is below 1 yrs of age. \nJust Confirming."); } else if (totage > 12.0 && totage <= 60.0) { vc.Start(TimeSpan.FromMilliseconds(100)); MessageBox.Show("The Child is above 1 yrs of age. \nJust Confirming."); } else { vc.Start(TimeSpan.FromMilliseconds(100)); MessageBox.Show("The Child is above 5 yrs of age. IMCI guidelines does not apply.\nProceed Anyways"); } } catch (System.FormatException) { vc.Start(TimeSpan.FromMilliseconds(100)); MessageBox.Show("Incorrect Format"); } }
private void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (bandDeteniendo == false) { //if (sonido != null) sonido.Play(); vibrar.Start(TimeSpan.FromSeconds(3)); } }
private void handleError(string error) { GameState.getInstance().resetTurn(); VibrateController vibrate = VibrateController.Default; //vibrate the phone for 2 seconds vibrate.Start(TimeSpan.FromMilliseconds(2000)); MessageBox.Show(error, "Error", MessageBoxButton.OK); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { Braile.setBraileState(braileData.braileLetter1, '#'); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } base.Update(gameTime); foreach (TouchLocation location in TouchPanel.GetState()) { // Letter control for (int i = 0; i < Braile.cBraileDotsNum; i++) { if (braileData.braileLetter1[i].rect.Contains((int)location.Position.X, (int)location.Position.Y)) { if (i == 1) { //vibrate.Start(TimeSpan.FromMilliseconds(20)); vibrate.Start(TimeSpan.FromMilliseconds(5)); System.Threading.Thread.Sleep(20); vibrate.Start(TimeSpan.FromMilliseconds(10)); System.Threading.Thread.Sleep(10); vibrate.Start(TimeSpan.FromMilliseconds(5)); } if (i == 3) { //vibrate.Start(TimeSpan.FromMilliseconds(1)); vibrate.Start(TimeSpan.FromMilliseconds(20)); System.Threading.Thread.Sleep(40); vibrate.Start(TimeSpan.FromMilliseconds(20)); System.Threading.Thread.Sleep(20); vibrate.Start(TimeSpan.FromMilliseconds(10)); } if (i == 5) { vibrate.Start(TimeSpan.FromMilliseconds(100)); } if (i == 7) { vibrate.Start(TimeSpan.FromMilliseconds(50)); //vibrate.Start(TimeSpan.FromMilliseconds(70)); //System.Threading.Thread.Sleep(120); //vibrate.Start(TimeSpan.FromMilliseconds(70)); } } } } }
private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { GlobalValues.counting = GlobalValues.counting + 1; countBlock.Text = GlobalValues.counting.ToString(); if (GlobalValues.alertCount > 0 && GlobalValues.counting == GlobalValues.alertCount) { testVibrateController.Start(TimeSpan.FromSeconds(2)); MessageBox.Show("Alerted!"); } }
private void MyIP_TouchDown(object sender, MouseEventArgs e) { MyIP.CaptureMouse(); StylusPointCollection MyStylusPointCollection = new StylusPointCollection(); MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(MyIP)); stroke = new Stroke(MyStylusPointCollection); stroke.DrawingAttributes.Color = color; MyIP.Strokes.Add(stroke); vibrate.Start(TimeSpan.FromMilliseconds(50)); }
public static void vibrate(double sek) { if (varina) { VibrateController testVibrateController = VibrateController.Default; if (sek > 0) { testVibrateController.Start(TimeSpan.FromSeconds(sek)); } } }
public void Vibrate(VibrateType type) { if (!IsVibrate) { return; } switch (type) { case VibrateType.ShortVibrate: vc.Start(TimeSpan.FromMilliseconds(100)); break; case VibrateType.LongVibrate: vc.Start(TimeSpan.FromMilliseconds(300)); break; default: break; } }
private void LeftArrow(object sender, MouseEventArgs e) { BorderLeftArrow.Background = _setImage("SelectedArrow.png"); BorderMiddleArrow.Background = _setImage("Arrow.png"); BorderRightArrow.Background = _setImage("Arrow.png"); //far left arrow _selectedArrow = 3; //causes the phone to vibrate when the 3rd arrow is selected VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(50)); }
/// <summary> /// Invokes the Tapped event and allows subclasses to perform actions when tapped. /// </summary> protected virtual void OnTapped() { if (vibrate) { VibrateController vc = VibrateController.Default; vc.Start(TimeSpan.FromMilliseconds(50)); } if (Tapped != null) { Tapped(this, EventArgs.Empty); } }
void timer_Tick(object sender) { //keep track of how long it has been running //stop if it has gone too long //otheriwse restart alramDuration = alramDuration.Add(TimeSpan.FromMilliseconds(timerInterval)); if (alramDuration.TotalMinutes > 1) { StopAll(); } else { vibrate.Start(vibrateDuration); } }
// Detect collion of player car with enemy cars private void hitTest(int index) { if (playerRect.Intersects(enemyRect[index])) { playerCar = playerCarDestroy; vibration.Start(TimeSpan.FromMilliseconds(500)); resetGame(3000); } //if (enemyCarsVect[index].X <= (playerPosition.X + carWidth)) // if ((enemyCarsVect[index].X + carWidth) >= playerPosition.X) // if (enemyCarsVect[index].Y <= (playerPosition.Y + carHeight)) // if ((enemyCarsVect[index].Y + carHeight) >= playerPosition.Y) // { // vibration.Start(TimeSpan.FromMilliseconds(500)); // resetGame(3000); // } }
private void timer_Tick(Object sender) { AutoResetEvent autoEvent = (AutoResetEvent)sender; currentTime++; counter.Dispatcher.BeginInvoke(delegate() { counter.Text = Convert.ToString(time - currentTime); double gain = rect.Height / time; fillRect.Height += gain; }); if (currentTime >= time) { stopTick(); isComplete = true; counter.Dispatcher.BeginInvoke(delegate() { onReady(EventArgs.Empty); vibrator.Start(TimeSpan.FromSeconds(0.5)); counter.Text = text + " Ready!"; }); } }
public override void HandleInput(InputState input) { foreach (GestureSample gesture in input.Gestures) { if (gesture.GestureType == GestureType.Tap) { if (gesture.Position.X >= position_suivant.X && gesture.Position.X <= font_titre.MeasureString(suivant).X + position_suivant.X && gesture.Position.Y >= position_suivant.Y && gesture.Position.Y <= font_titre.MeasureString(suivant).Y + position_suivant.Y) { if (page < 3) { if (vibrate) { VibrateController vc = VibrateController.Default; vc.Start(TimeSpan.FromMilliseconds(50)); } page++; } else { if (vibrate) { VibrateController vc = VibrateController.Default; vc.Start(TimeSpan.FromMilliseconds(50)); } this.ExitScreen(); ScreenManager.AddScreen(new OptionScreen()); } } } } base.HandleInput(input); }
public void Error() { vibrateCont = VibrateController.Default; vibrateCont.Start(new TimeSpan(0, 0, 0, 0, 500)); }
/// <summary> /// Provide haptic feedback to the user by vibrating the phone. Specify the length of /// the vibration in milliseconds. /// </summary> /// <param name="duration">Duration of haptic feedback in milliseconds.</param> public void hapticFeedback(int duration) { haptic.Start(TimeSpan.FromMilliseconds(duration)); }
private void Report(SyncCompleteInfo result) { string msg = null; var details = _db.Details; var settings = AppSettings.Instance; switch (result.Result) { case SyncResults.NoChange: // Toast wenn Sync erfolgreich if (settings.SyncToast) { Deployment.Current.Dispatcher.BeginInvoke(() => { VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(100)); new ToastPrompt { Title = Strings.Sync_Title, Message = Strings.Sync_MessNoChange, TextOrientation = Orientation.Vertical, }.Show(); }); } break; case SyncResults.Downloaded: using (var buffer = new MemoryStream(result.Database)) _db.SetDatabase(buffer, details); details.HasLocalChanges = false; details.Modified = result.Modified; _db.SaveDetails(); // Toast wenn Sync erfolgreich if (settings.SyncToast) { Deployment.Current.Dispatcher.BeginInvoke(() => { VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(100)); new ToastPrompt { Title = Strings.Sync_Title, Message = Strings.Sync_MessDownSucc, TextOrientation = Orientation.Vertical, }.Show(); }); } break; case SyncResults.Uploaded: details.HasLocalChanges = false; details.Modified = result.Modified; _db.SaveDetails(); // Toast wenn Sync erfolgreich if (settings.SyncToast) { Deployment.Current.Dispatcher.BeginInvoke(() => { VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(100)); new ToastPrompt { Title = Strings.Sync_Title, Message = Strings.Sync_MessUpSucc, TextOrientation = Orientation.Vertical, }.Show(); }); } break; case SyncResults.Conflict: details.Url = result.Path; details.HasLocalChanges = false; details.Modified = result.Modified; _db.SaveDetails(); msg = string.Format( Properties.Resources.Conflict, result.ConflictPath); break; case SyncResults.Failed: msg = Properties.Resources .DownloadError; break; } _reporter(_db, result.Result, msg); }
public void Vibrate(int seconds) { VibrateController vibrateController = VibrateController.Default; vibrateController.Start(TimeSpan.FromSeconds(seconds)); }
public void Thiefdetected() { Rung.Start(TimeSpan.FromSeconds(5)); Warningup.Play(); }
void displayRatingStar() { iVibrateController.Start(TimeSpan.FromMilliseconds(100)); if (rating >= 1) { star1.Opacity = 1; star1.Height = maxHeight; star1.Width = maxWidth; star1.Stretch = Stretch.UniformToFill; star1.Margin = new Thickness(0, 0, 20, 0); initialScale = ((CompositeTransform)star1.RenderTransform).ScaleX; var transform = (CompositeTransform)star1.RenderTransform; transform.ScaleX = finalScale; transform.ScaleY = transform.ScaleX; } else { star1.Opacity = 0.4; star1.Height = minHeight; star1.Width = minWidth; star1.Stretch = Stretch.UniformToFill; star1.Margin = new Thickness(0, 0, 40, 0); initialScale = ((CompositeTransform)star1.RenderTransform).ScaleX; var transform = (CompositeTransform)star1.RenderTransform; transform.ScaleX = initialScale; transform.ScaleY = transform.ScaleX; } if (rating >= 2) { star2.Opacity = 1; star2.Height = maxHeight; star2.Width = maxWidth; star2.Stretch = Stretch.UniformToFill; star2.Margin = new Thickness(0, 0, 20, 0); initialScale = ((CompositeTransform)star2.RenderTransform).ScaleX; var transform = (CompositeTransform)star2.RenderTransform; transform.ScaleX = finalScale; transform.ScaleY = transform.ScaleX; } else { star2.Opacity = 0.4; star2.Height = minHeight; star2.Width = minWidth; star2.Stretch = Stretch.UniformToFill; star2.Margin = new Thickness(0, 0, 40, 0); initialScale = ((CompositeTransform)star2.RenderTransform).ScaleX; var transform = (CompositeTransform)star2.RenderTransform; transform.ScaleX = initialScale; transform.ScaleY = transform.ScaleX; } if (rating >= 3) { star3.Opacity = 1; star3.Height = maxHeight; star3.Width = maxWidth; star3.Stretch = Stretch.UniformToFill; star3.Margin = new Thickness(0, 0, 20, 0); initialScale = ((CompositeTransform)star3.RenderTransform).ScaleX; var transform = (CompositeTransform)star3.RenderTransform; transform.ScaleX = finalScale; transform.ScaleY = transform.ScaleX; } else { star3.Opacity = 0.4; star3.Height = minHeight; star3.Width = minWidth; star3.Stretch = Stretch.UniformToFill; star3.Margin = new Thickness(0, 0, 40, 0); initialScale = ((CompositeTransform)star3.RenderTransform).ScaleX; var transform = (CompositeTransform)star3.RenderTransform; transform.ScaleX = initialScale; transform.ScaleY = transform.ScaleX; } if (rating >= 4) { star4.Opacity = 1; star4.Height = maxHeight; star4.Width = maxWidth; star4.Stretch = Stretch.UniformToFill; star4.Margin = new Thickness(0, 0, 20, 0); initialScale = ((CompositeTransform)star4.RenderTransform).ScaleX; var transform = (CompositeTransform)star4.RenderTransform; transform.ScaleX = finalScale; transform.ScaleY = transform.ScaleX; } else { star4.Opacity = 0.4; star4.Height = minHeight; star4.Width = minWidth; star4.Stretch = Stretch.UniformToFill; star4.Margin = new Thickness(0, 0, 40, 0); initialScale = ((CompositeTransform)star4.RenderTransform).ScaleX; var transform = (CompositeTransform)star4.RenderTransform; transform.ScaleX = initialScale; transform.ScaleY = transform.ScaleX; } if (rating >= 5) { star5.Opacity = 1; star5.Height = maxHeight; star5.Width = maxWidth; star5.Stretch = Stretch.UniformToFill; star5.Margin = new Thickness(0, 0, 20, 0); initialScale = ((CompositeTransform)star5.RenderTransform).ScaleX; var transform = (CompositeTransform)star5.RenderTransform; transform.ScaleX = finalScale; transform.ScaleY = transform.ScaleX; } else { star5.Opacity = 0.4; star5.Height = minHeight; star5.Width = minWidth; star5.Stretch = Stretch.UniformToFill; star5.Margin = new Thickness(0, 0, 40, 0); initialScale = ((CompositeTransform)star5.RenderTransform).ScaleX; var transform = (CompositeTransform)star5.RenderTransform; transform.ScaleX = initialScale; transform.ScaleY = transform.ScaleX; } }
void RandomVibrateButton_Tap(object sender, System.Windows.Input.GestureEventArgs e) { Random gen = new Random(); // user interaction /* TrillVibrateButton.Margin = new Thickness(20,0,0,0); System.Threading.Thread.Sleep(200); TrillVibrateButton.Margin = new Thickness(15, 0, 0, 0); */ // Present one pattern loop MainVibrateController.Start(TimeSpan.FromSeconds(gen.NextDouble() * 0.3)); System.Threading.Thread.Sleep(300); MainVibrateController.Start(TimeSpan.FromSeconds(gen.NextDouble() * 0.3)); System.Threading.Thread.Sleep(300); MainVibrateController.Start(TimeSpan.FromSeconds(gen.NextDouble() * 0.3)); System.Threading.Thread.Sleep(300); MainVibrateController.Start(TimeSpan.FromSeconds(gen.NextDouble() * 0.3)); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } proceedText(); base.Update(gameTime); bool nextLetter = true; foreach (TouchLocation location in TouchPanel.GetState()) { // Letter control for (int i = 0; i < Braile.cBraileDotsNum; i++) { if (braileData.braileLetter1[i].rect.Contains((int)location.Position.X, (int)location.Position.Y)) { if (braileData.braileLetter1[i].state) { // start vibe Debug.WriteLine("Yes vibe! {0}", i); vibrate.Start(TimeSpan.FromMilliseconds(200)); } else { // stop vibe Debug.WriteLine("No vibe! {0}", i); vibrate.Stop(); } braileData.braileLetter1[i].touched = true; nextLetter = false; } } // Controls if (controls.letterControl.Contains((int)location.Position.X, (int)location.Position.Y)) { //Debug.WriteLine("Start controling letter"); while (TouchPanel.IsGestureAvailable) { GestureSample gs = TouchPanel.ReadGesture(); switch (gs.GestureType) { case GestureType.HorizontalDrag: controls.letterControlDeltaX += gs.Delta.X; Debug.WriteLine("VerticalDrag {0}", gs.Delta.X); break; case GestureType.DragComplete: if (controls.letterControlDeltaX > 10.0) { if (wordPos + 1 < braileText.Length) { wordPos++; letterPos = 0; } else { Debug.WriteLine("End of text"); } Debug.WriteLine("Next word!"); } else if (controls.letterControlDeltaX < -10.0) { if (letterPos == 0 && wordPos != 0) { wordPos--; Debug.WriteLine("Previous word"); } letterPos = 0; Debug.WriteLine("Begining of the word"); } Debug.WriteLine("{0}", controls.letterControlDeltaX); controls.letterControlDeltaX = 0; break; } } } } if (braileData.braileLetter1.All(x => x.touched) && nextLetter) { Debug.WriteLine("Next letter!"); if (letterPos + 1 < braileText[wordPos].Length) { letterPos++; } else { letterPos = 0; if (wordPos + 1 < braileText.Length) { vibrate.Start(TimeSpan.FromMilliseconds(100)); System.Threading.Thread.Sleep(200); vibrate.Start(TimeSpan.FromMilliseconds(100)); wordPos++; } else { Debug.WriteLine("End of text!"); } } for (int i = 0; i < braileData.braileLetter1.Length; i++) { braileData.braileLetter1[i].touched = false; } } }
private void SuccessVibrate() { g_VibrateController.Start(TimeSpan.FromMilliseconds(150)); }
public static void Vibrate() { VibrateController vibrate = VibrateController.Default; vibrate.Start(TimeSpan.FromMilliseconds(1000)); }