Beispiel #1
0
        void Time_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var ctrl   = (FrameworkElement)sender;
            var rowIdx = VisualUtils.IndexOfControlInItemsControl(Rows, ctrl);

            VM.MouseOpenRequested?.Invoke(ctrl, VM.Rows[rowIdx]);
        }
Beispiel #2
0
        void Button_Click(object sender, RoutedEventArgs e)
        {
            int idx = VisualUtils.IndexOfControlInItemsControl(eItems, (Button)sender);

            if (idx >= 0)
            {
                VM?.ActionRequested?.Invoke(VM.Items[idx]);
            }
        }
Beispiel #3
0
        void ChunkTitle_DragLeave(object sender, DragEventArgs e)
        {
            var chunkIdx = VisualUtils.IndexOfControlInItemsControl(ChunkList, (DependencyObject)sender);

            if (chunkIdx >= 0)
            {
                SetDropTarget(null);
            }
        }
        void RemoveEntry_Click(object sender, RoutedEventArgs e)
        {
            int itemIdx = VisualUtils.IndexOfControlInItemsControl(eEntries, (Button)sender);

            if (itemIdx >= 0)
            {
                VM.Entries.RemoveAt(itemIdx);
            }
        }
        void OpenFromLabel(Label ctrl)
        {
            var eResults = VisualUtils.GetByUid(this, "eResults") as ItemsControl;
            int idx      = VisualUtils.IndexOfControlInItemsControl(eResults, ctrl);

            if (idx >= 0)
            {
                VM.OpenRequested(idx);
            }
        }
Beispiel #6
0
        void Title_GotFocus(object sender, RoutedEventArgs e)
        {
            var rowIdx = VisualUtils.IndexOfControlInItemsControl(Rows, (DependencyObject)sender);

            if (rowIdx >= 0)
            {
                VM.ItemGotFocus?.Invoke(rowIdx);
            }
            ((TextBox)sender).SelectAll();
        }
Beispiel #7
0
        void ChunkTitle_GotFocus(object sender, RoutedEventArgs e)
        {
            var tb = (TextBox)sender;

            tb.SelectAll();
            var chunkIdx = VisualUtils.IndexOfControlInItemsControl(ChunkList, tb);

            if (chunkIdx >= 0)
            {
                VM.ChunkGotFocus(chunkIdx);
            }
        }
        void EditEntry_Click(object sender, RoutedEventArgs e)
        {
            int itemIdx = VisualUtils.IndexOfControlInItemsControl(eEntries, (Button)sender);

            if (itemIdx >= 0)
            {
                var entry = RepeatPatternDialog.ShowDialog(VM.Entries[itemIdx].Entry);
                if (entry != null)
                {
                    VM.Entries.RemoveAt(itemIdx);
                    VM.Entries.Insert(itemIdx, new RepeatInfoVM.EntryVM(entry));
                }
            }
        }
Beispiel #9
0
        void ChunkTitle_DragEnter(object sender, DragEventArgs e)
        {
            bool ok       = e.Data.GetDataPresent(nameof(BoxDragInfo));
            var  chunkIdx = VisualUtils.IndexOfControlInItemsControl(ChunkList, (DependencyObject)sender);

            if (chunkIdx == -1)
            {
                ok = false;
            }
            else
            {
                SetDropTarget(VM.Chunks[chunkIdx]);
            }
            e.Effects = ok ? DragDropEffects.Move : DragDropEffects.None;
            e.Handled = true;
        }
Beispiel #10
0
        void ChunkTitle_Drop(object sender, DragEventArgs e)
        {
            bool ok       = e.Data.GetDataPresent(nameof(BoxDragInfo));
            var  chunkIdx = VisualUtils.IndexOfControlInItemsControl(ChunkList, (DependencyObject)sender);

            if (chunkIdx == -1)
            {
                ok = false;
            }
            if (!ok)
            {
                return;
            }
            var di = e.Data.GetData(nameof(BoxDragInfo)) as BoxDragInfo;

            VM.DropOnChunkRequested(di, VM.Chunks[chunkIdx]);
            SetDropTarget(null);
        }