private void Window_Loaded(object sender, RoutedEventArgs e) { channel1 = new ChannelControl(); channel1.Margin = new Thickness(0, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel1); channel2 = new ChannelControl(); channel2.Margin = new Thickness(SLIDER_WIDTH + SLIDER_PADDING, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel2); channel3 = new ChannelControl(); channel3.Margin = new Thickness(SLIDER_WIDTH * 2 + SLIDER_PADDING * 2, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel3); channel4 = new ChannelControl(); channel4.Margin = new Thickness(SLIDER_WIDTH * 3 + SLIDER_PADDING * 3, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel4); channel5 = new ChannelControl(); channel5.Margin = new Thickness(SLIDER_WIDTH * 4 + SLIDER_PADDING * 4, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel5); channel6 = new ChannelControl(); channel6.Margin = new Thickness(SLIDER_WIDTH * 5 + SLIDER_PADDING * 5, SLIDER_MARGIN_TOP, 0, 0); _canvas.Children.Add(channel6); deck1 = new DeckControl(); deck1.Margin = new Thickness(0, DECK_MARGIN_TOP, 0, 0); deck1.LoadSample("../../media/In For The Kill.mp3"); _canvas.Children.Add(deck1); deck2 = new DeckControl(); deck2.Margin = new Thickness(DECK_MARGIN_LEFT, DECK_MARGIN_TOP, 0, 0); deck2.LoadSample("../../media/Bad Romance.mp3"); _canvas.Children.Add(deck2); fader = new CrossfaderControl(ref deck1, ref deck2); fader.Margin = new Thickness(DECK_WIDTH, DECK_MARGIN_TOP, 0, 0); _canvas.Children.Add(fader); directory = new DirectoryList(385, 600); directory.Margin = new Thickness(DECK_MARGIN_LEFT + DECK_WIDTH, 0, 0, 0); directory.TouchDown += new EventHandler<TouchEventArgs>(DirectoryTouchDown); //directory.TouchUp += new EventHandler<TouchEventArgs>(DirectoryTouchUp); directory.TouchMove += new EventHandler<TouchEventArgs>(DirectoryTouchMove); _canvas.Children.Add(directory); selected = new DirectoryListItem(385, 100, new songInfo()); //selected.TouchMove += new EventHandler<TouchEventArgs>(SelectedTouchMove); //selected.TouchUp += new EventHandler<TouchEventArgs>(SelectedTouchUp); translate = new TranslateTransform(0, 0); trnsGrp = new TransformGroup(); trnsGrp.Children.Add(translate); selectedItemExists = false; dragDropInit = false; }
public CrossfaderControl(ref DeckControl d1, ref DeckControl d2) { _mixerBackground = new Image(); _mixerBackground.Height = 489; _mixerBackground.Width = 97; BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri("png/crossfadeBackground.png", UriKind.Relative); bmp.EndInit(); _mixerBackground.Source = bmp; this.Children.Add(_mixerBackground); _mixerKnob = new SliderButton(MIXERKNOB_WIDTH, MIXERKNOB_HEIGHT); _mixerKnob.Margin = new Thickness(MIXERKNOB_X, SLIDERTOP, 0, 0); _mixerKnob.SetBackgroundImage("png/crossfadeSlider.png"); _mixerKnob.SetPressedImage("png/crossfadeSlider.png"); _mixerKnob.Width = MIXERKNOB_WIDTH; _mixerKnob.Height = MIXERKNOB_HEIGHT; _mixerKnob.TouchDown += new EventHandler<TouchEventArgs>(TouchDown); _mixerKnob.TouchUp += new EventHandler<TouchEventArgs>(TouchUp); _mixerKnob.TouchMove += new EventHandler<TouchEventArgs>(TouchMove); this.Children.Add(_mixerKnob); translate = new TranslateTransform(0, SLIDERHEIGHT / 2 + MIXERKNOB_HEIGHT / 2); transform = new TransformGroup(); transform.Children.Add(translate); _mixerKnob.RenderTransform = transform; deck1 = d1; deck2 = d2; }