Exemple #1
0
        private void Grid_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                Object item = (object)e.Data.GetData(DataFormats.FileDrop);
                // Perform drag-and-drop, depending upon the effect.
                if (((e.Effects & DragDropEffects.Copy) == DragDropEffects.Copy) ||
                    ((e.Effects & DragDropEffects.Move) == DragDropEffects.Move))
                {
                    // Extract the data from the DataObject-Container into a string list
                    string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);

                    if (DeskLayout.IsVideoFile(fileList[0]))
                    {
                        LoadVideoFileFromDrop(fileList[0]);
                        e.Handled = true;
                    }
                    else
                    {
                        MessageBox.Show("Error occurs, only video files allowed.");
                    }
                }
            }
            else
            {
            }
        }
        private void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl)
            {
                IsCtrlDown = true;
            }

            if (m_IsSelected)
            {
                if (e.Key == Key.Delete)
                {
                    if (MessageBox.Show("Delete slected item?", "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        if (m_SelectedElement is AudioPlaybackControl)
                        {
                            ((AudioPlaybackControl)m_SelectedElement).Stop();
                        }

                        MyDeskLayout.RemoveControl(m_SelectedElement);
                        e.Handled = true;
                    }
                }
            }

            if (IsCtrlDown && e.Key == Key.O)
            {
                MenuItemOpenProject_Click(this, null);
            }

            if (IsCtrlDown && e.Key == Key.D)
            {
                MenuItemDeskWindow_Click(this, null);
            }

            if (IsCtrlDown && e.Key == Key.B)
            {
                MenuItemVideotWindow_Click(this, null);
            }

            if (IsCtrlDown && e.Key == Key.V)
            {
                var files = Clipboard.GetFileDropList();
                if (files.Count == 1 && !string.IsNullOrEmpty(files[0]) && DeskLayout.IsAcceptableFile(files[0]))
                {
                    MyDeskLayout.LoadFileToCanvas(files[0]);
                }
            }
        }
Exemple #3
0
        public void DesksCreatedIsCorrectTest()
        {
            List <Rectangle> result = DeskLayout.Create(surface, 50, 10, 50) as List <Rectangle>;

            Assert.IsTrue(result.Count == 112);
        }
Exemple #4
0
        public void DeskLayoutOutputTypeIsCorrectTest()
        {
            var result = DeskLayout.Create(surface, 50, 10, 50);

            Assert.IsTrue(result is List <Rectangle>);
        }