Exemplo n.º 1
0
        private void OrderListBox_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            var listBox = (ListBox)sender;

            if (e.LeftButton != MouseButtonState.Pressed)
            {
                oldIndex = -1;
            }

            if (oldIndex < 0)
            {
                return;
            }

            if (e.GetPosition(listBox).ExceedsMinimumDragDistance(startPoint))
            {
                listBox.SelectedIndex = oldIndex;
                SongPartReference selectedItem = (SongPartReference)listBox.SelectedItem;

                if (selectedItem == null)
                {
                    return;
                }

                // this will create the drag "rectangle"
                DragDropEffects allowedEffects = DragDropEffects.Move | DragDropEffects.Copy;
                if (DragDrop.DoDragDrop(this, selectedItem, allowedEffects) != DragDropEffects.None)
                {
                    // The item was dropped into a new location,
                    // so make it the new selected item.
                    //listBox.SelectedItem = selectedItem;
                }
            }
        }
Exemplo n.º 2
0
        public void PartReferenceNotify()
        {
            var  partRef  = new SongPartReference(part);
            bool notified = false;

            partRef.Part.PropertyChanged += (sender, args) =>
            {
                notified = true;
            };

            Assert.False(notified);
            part.Name = "NewPartName";
            Assert.Equal(new SongPartReference(song, "NewPartName").Part, partRef.Part);
            Assert.True(notified);
            notified = false;
            Assert.Equal(1, UndoStackSize);
            Undo();
            Assert.True(notified);
            notified = false;
            Redo();
            Assert.True(notified);
            Assert.Equal(new SongPartReference(song, "NewPartName").Part, partRef.Part);
        }
Exemplo n.º 3
0
        private Tuple <SongSlide, SongPartReference, int> FindSlideByIndex(int index)
        {
            int i = 1;
            SongPartReference pref  = null;
            SongSlide         slide = null;

            foreach (var partRef in song.Order)
            {
                pref = partRef;
                SongPart part    = partRef.Part;
                int      iInPart = 0;
                foreach (var s in part.Slides)
                {
                    if (i++ == index)
                    {
                        slide = s;
                        return(new Tuple <SongSlide, SongPartReference, int>(slide, pref, iInPart));
                    }
                    iInPart++;
                }
            }

            return(null);
        }
 public void GotoSlide(SongPartReference part, int slide)
 {
     control.ExecuteJavascript("presentation.gotoSlide(" + part.OrderIndex + ", " + slide + ")");
 }