コード例 #1
0
        private void DirectoryTouchMove(object sender, TouchEventArgs e)
        {
            if (directory.IsDragging() && !selectedItemExists)
            {
                //clear the last song info
                selectedItem = new songInfo();
                //get the song in the array that was selected
                selectedItem = directory.GetSelectedSong();

                selected = new DirectoryListItem(385, 100, selectedItem);
                selected.Margin = new Thickness((int)e.TouchDevice.GetTouchPoint(this).Position.X - (385 / 2), (int)e.TouchDevice.GetTouchPoint(this).Position.Y - (100 / 2), 0, 0);
                selected.SetBackgroundImage(@"png/inforthekill.png");
                selected.Width = 385;
                selected.Height = 100;
                if (!selectedItemExists)
                {
                    //_canvas.Children.Add(selected);
                    if (!dragDropInit)
                    {
                        // Initialize the drag & drop operation
                        DataObject dragData = new DataObject("songInfo", selectedItem);
                        DragDrop.DoDragDrop(selected, dragData, DragDropEffects.Move);
                    }
                    directory.ResetSelection();
                }
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        public DirectoryList(int width, int height)
        {
            this.Width = width;
            this.Height = height;
            _currentPosition = 0;
            _touchPoints = 0;

            _dir = new DirectoryClass("C:\\Users\\Administrator\\Documents\\Visual Studio 2010\\Projects\\WpfApplication1\\WpfApplication1\\media");
            _numItems = _dir.GetFileCount();
            _dirList = new DirectoryListItem[_numItems];
            _dir.sortTitle();
            for (int i = 0; i < _numItems; i++)
            {
                _dirList[i] = new DirectoryListItem(DIRECTORY_WIDTH, ITEM_HEIGHT, _dir.getSongInfo(i));
                _dirList[i].Margin = new Thickness(0, ITEM_HEIGHT * i, 0, 0);
                _dirList[i].SetBackgroundImage(@"png/inforthekill.png");
                _dirList[i].Width = 385;
                _dirList[i].Height = 100;
                this.Children.Add(_dirList[i]);
            }
            _translate = new TranslateTransform(0, 0);
            _transform = new TransformGroup();
            _transform.Children.Add(_translate);
            this.ClipToBounds = true;

            _touchTimer = new System.Timers.Timer(200);
            _touchTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            _touchTimer.Interval = 500;
        }