void OnNewContact(object sender, NewContactEventArgs e) { if (ClickMode != ClickMode.Hover) { e.Handled = true; if (e.Contact.Capture(this)) { IsPressed = true; if (ClickMode == ClickMode.Press && MultitouchScreen.GetContactsCaptured(this).Count() == 1) { bool failed = true; try { StartTimer(); failed = false; } finally { if (failed) { IsPressed = false; e.Contact.ReleaseCapture(); } } } } } }
private void clearButton_NewContact(object sender, NewContactEventArgs e) { Console.WriteLine("Clear Button Pressed"); Button b = (Button)sender; b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; BeatMaker.clearEverything(); }
/// <summary> /// Called on new contact. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Multitouch.Framework.WPF.Input.NewContactEventArgs"/> instance containing the event data.</param> protected virtual void OnNewContact(object sender, NewContactEventArgs e) { StylusPointCollection pointCollection = new StylusPointCollection(); points.Add(e.Contact.Id, pointCollection); Point position = e.GetPosition(this); pointCollection.Add(new StylusPoint(position.X, position.Y)); }
void InvokeHandler(NewContactEventHandler handler, NewContactEventArgs e) { if (handler != null) { handler(this, e); if (executeOnNextContact != null) { Action<Contact> action = executeOnNextContact; executeOnNextContact = null; action(e.Contact); } } }
private void SelectButton_NewContact(object sender, NewContactEventArgs e) { Console.WriteLine("PRESSED SELECT BUTTON"); if (numClips != 4) return; for(int i = 0; i < 10; i++) { if (clipSelected[i]) clipIndices.Add(i); } if (clipIndices.Count != 4) { clipIndices.Clear(); return; } Switcher.mainWindow.beatMaker.ChangeNotes(clipIndices); Switcher.Switch(Switcher.mainWindow.beatMaker); Switcher.mainWindow.beatMaker.soundClipsSelectButton.Background = Brushes.White; Switcher.mainWindow.beatMaker.soundClipsSelectButton.Foreground = Brushes.DarkTurquoise; }
void PromoteRawToPreview(ProcessInputEventArgs e, RawMultitouchReport report) { ContactContext context = report.Context; RoutedEvent routedEvent = GetPreviewEventFromRawMultitouchState(context.Contact.State); if (report.Context.OverElement != null && routedEvent != null) { Contact contact = ContactsManager.ExistingContacts[report.Context.Contact.Id]; ContactEventArgs args; if (routedEvent == MultitouchScreen.PreviewNewContactEvent) { args = new NewContactEventArgs(contact, report.Timestamp); } else { args = new ContactEventArgs(contact, report.Timestamp); } args.RoutedEvent = routedEvent; args.Source = report.Context.OverElement; e.PushInput(args, e.StagingItem); } }
static void PromotePreviewToMain(ProcessInputEventArgs e, InputEventArgs input) { ContactEventArgs previewArgs = (ContactEventArgs)input; RoutedEvent mainEvent = GetMainEventFromPreviewEvent(input.RoutedEvent); if (mainEvent != null) { ContactEventArgs mainArgs; if (mainEvent == MultitouchScreen.NewContactEvent || mainEvent == MultitouchScreen.PreviewNewContactEvent) { NewContactEventArgs newContactEventArgs = (NewContactEventArgs)previewArgs; mainArgs = new NewContactEventArgs(newContactEventArgs.Contact, previewArgs.Timestamp); } else { mainArgs = new ContactEventArgs(previewArgs.Contact, previewArgs.Timestamp); } mainArgs.RoutedEvent = mainEvent; mainArgs.Source = previewArgs.Source; e.PushInput(mainArgs, e.StagingItem); } }
private void soundClipsSelectButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; Console.WriteLine("Pressed the button" + b.Name.ToString()); int index = Convert.ToInt32(b.Tag); if (!clipSelected[index]) { if (numClips == 4) return; clipSelected[index] = true; numClips++; b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; } else { if (numClips == 0) return; clipSelected[index] = false; numClips--; b.Background = Brushes.White; b.Foreground = Brushes.DarkTurquoise; } }
private void soundClipsSelectButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; Switcher.Switch(Switcher.mainWindow.clipSelector); }
private void playClipButton_NewContact(object sender, NewContactEventArgs e) { Console.WriteLine("play clip"); Button b = (Button)sender; b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; int x = int.Parse(b.Tag.ToString()); pattern[x+10, 0] = 127; PatternSequencer.playClip = true; }
private void openButton_NewContact(object sender, NewContactEventArgs e) { Console.WriteLine("Open Button Pressed"); Button b = (Button)sender; if (isSynced && !ioLock && saved) { if (BeatMaker.play) BeatMaker.Stop(); ioLock = true; loadFromFile(save1Location); BeatMaker.selectedKit = 0; BeatMaker.updateBeatButtons(); BeatMaker.updateSoundClipButtons(); BeatMaker.tempoController.updateTempo(); b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; saved = false; ioLock = false; BeatMaker.Play(); } }
private void saveButton_NewContact(object sender, NewContactEventArgs e) { Console.WriteLine("Save Button Pressed"); Button b = (Button)sender; if (isSynced && !ioLock) { ioLock = true; if (BeatMaker.play) BeatMaker.Stop(); saveToFile(save1Location); b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; saved = true; ioLock = false; BeatMaker.Play(); } }
void OnNewContact(object sender, NewContactEventArgs e) { InvokeHandler(NewContact, e); }
private void button_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; b.Background = Brushes.OrangeRed; b.Content = "Touching"; }
private void instrumentSelectButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; //change prev selected back to whtie instrumentButtonArr[chosenButton].Background = Brushes.White; instrumentButtonArr[chosenButton].Foreground = Brushes.DarkTurquoise; chosenButton = int.Parse( b.Name[16].ToString() ) ; selectedKit = int.Parse(b.Tag.ToString()); //reload pitch this.pitchController.reloadState(); updateSoundClipButtons(); //reset beat buttons updateBeatButtons(); }
private void ListBox_NewContact(object sender, NewContactEventArgs e) { IInputElement element = listInkEditingModes.InputHitTest(e.GetPosition(listInkEditingModes)); ListBoxItem container = ItemsControl.ContainerFromElement(listInkEditingModes, (DependencyObject) element) as ListBoxItem; if (container != null) container.IsSelected = true; }
void OnNewContact(object sender, NewContactEventArgs e) { if (!firstContactId.HasValue) { firstContactId = e.Contact.Id; startPoint = e.GetPosition(this); startOffset.X = HorizontalOffset; startOffset.Y = VerticalOffset; Vector2D contactPoint = startPoint.ToVector2D(); scrollJoint = new FixedHingeJoint(Body, contactPoint, new Lifespan()); engine.AddJoint(scrollJoint); } }
private void stopButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; stop = !stop; if (stop) { b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; Console.WriteLine("Stop"); Stop(); playButton.Background = Brushes.White; playButton.Foreground = Brushes.DarkTurquoise; play = false; } else b.Background = Brushes.White; }
protected virtual void OnNewContact(object sender, NewContactEventArgs e) { switch (EditingMode) { case InkCanvasEditingMode.EraseByStroke: EraseStroke(e.Contact); break; case InkCanvasEditingMode.EraseByPoint: ErasePoint(e.Contact); break; case InkCanvasEditingMode.Ink: StartStroke(e.Contact); break; default: break; } e.Contact.Capture(this); e.Handled = true; }
static void PromotePreviewToMain(ProcessInputEventArgs e, InputEventArgs input) { ContactEventArgs previewArgs = (ContactEventArgs)input; RoutedEvent mainEvent = GetMainEventFromPreviewEvent(input.RoutedEvent); if (mainEvent != null) { ContactEventArgs mainArgs; if (mainEvent == MultitouchScreen.NewContactEvent || mainEvent == MultitouchScreen.PreviewNewContactEvent) { NewContactEventArgs newContactEventArgs = (NewContactEventArgs)previewArgs; mainArgs = new NewContactEventArgs(newContactEventArgs.Contact, previewArgs.Timestamp); } else mainArgs = new ContactEventArgs(previewArgs.Contact, previewArgs.Timestamp); mainArgs.RoutedEvent = mainEvent; mainArgs.Source = previewArgs.Source; e.PushInput(mainArgs, e.StagingItem); } }
void PromoteRawToPreview(ProcessInputEventArgs e, RawMultitouchReport report) { ContactContext context = report.Context; RoutedEvent routedEvent = GetPreviewEventFromRawMultitouchState(context.Contact.State); if (report.Context.OverElement != null && routedEvent != null) { Contact contact = ContactsManager.ExistingContacts[report.Context.Contact.Id]; ContactEventArgs args; if (routedEvent == MultitouchScreen.PreviewNewContactEvent) args = new NewContactEventArgs(contact, report.Timestamp); else args = new ContactEventArgs(contact, report.Timestamp); args.RoutedEvent = routedEvent; args.Source = report.Context.OverElement; e.PushInput(args, e.StagingItem); } }
static void OnNewContact(object sender, NewContactEventArgs e) { if(e.Contact.Captured != e.Source) e.Contact.Capture((IInputElement)e.Source); }
void OnNewContact(object sender, NewContactEventArgs e) { Point position = e.GetPosition(this); HitTestResult hitTestResult = VisualTreeHelper.HitTest(this, position); if (hitTestResult != null) { FrameworkElement element = hitTestResult.VisualHit as FrameworkElement; if (element != null) { FrameworkElement parent = element.Parent as FrameworkElement; while (parent != null && !parent.Equals(sender)) { element = parent; parent = element.Parent as FrameworkElement; } if (eltOffset.ContainsKey(element)) { contactElements[e.Contact.Id] = element; eltOffset[element] = e.GetPosition(element); } else { if (contactElements.ContainsKey(e.Contact.Id)) contactElements[e.Contact.Id] = element; else contactElements.Add(e.Contact.Id, element); eltOffset.Add(element, e.GetPosition(element)); } } } }
private void playButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; play = !play; if (play) { b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; Console.WriteLine("Playing"); Play(); //stopButton.Background = Brushes.White; stop = false; } else { b.Background = Brushes.White; b.Foreground = Brushes.DarkTurquoise; Stop(); } }
void OnNewContact(object sender, NewContactEventArgs e) { e.Handled = true; e.Contact.Capture(this); }
void OnPreviewNewContact(object sender, NewContactEventArgs e) { InvokeHandler(PreviewNewContact, e); }
private void pitch_NewContact78(object sender, NewContactEventArgs e) { PitchController.pitchSequence.Click(7, 8, ref state); this.setPitch(BeatMaker.chosenButton, 7, 8); }
private void tempoButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; if (tempo > 0 && tempo < MAX_TEMPO) { incDec = int.Parse(b.Tag.ToString()); b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; if (incDec == 0) { tempo--; } else if (incDec == 1) { tempo++; } updateTempo(); } }
private void beatButton_NewContact(object sender, NewContactEventArgs e) { Button b = (Button)sender; int index = int.Parse(b.Tag.ToString()); Console.WriteLine(b.Tag.ToString()); Boolean[] currInstrument = drumBeats[selectedKit]; currInstrument[index] = !currInstrument[index]; if (currInstrument[index]) { pattern[selectedKit, index] = 127; b.Background = Brushes.DarkTurquoise; b.Foreground = Brushes.White; Console.WriteLine("button " + index); } else { pattern[selectedKit, index] = 0; b.Background = Brushes.White; } }