Exemple #1
0
 private void TDataGridView_DoubleClick(object sender, EventArgs e)
 {
     if (e is MouseEventArgs me)
     {
         var hit = this.HitTest(me.X, me.Y);
         if (hit.RowIndex > -1)
         {
             if (this.type != null)
             {
                 var property = type.Property(Columns[hit.ColumnIndex].Name);
                 if (property?.IButton(out _) == true)
                 {
                     return;
                 }
             }
             RowDoubleClick?.Invoke(this, hit.RowIndex);
         }
     }
 }
Exemple #2
0
        private void ListView_DoubleTapped(object sender, Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs e)
        {
            //var aa = VenturaVisualTreeHelper.FindParent<HyperGridPanel>(e.OriginalSource as DependencyObject);

            ListViewItem pressed_row = VenturaVisualTreeHelper.FindParent <ListViewItem>(e.OriginalSource as DependencyObject);

            if (pressed_row == null)
            {
                return;
            }

            //var event_args = new RowDoubleClickedEventArgs
            //{
            //    ItemIndex = -1, // pressed_row.GetIndex();
            //    Item = pressed_row.Content // pressed_row.DataContext;
            //};

            //RowDoubleClicked?.Invoke(this, event_args);
            RowDoubleClick?.Invoke(this, new RoutedEventArgs());
        }
Exemple #3
0
        private void doubleClickTimer_Tick(object sender, EventArgs e)
        {
            milliseconds += 100;

            //The timer has reached the double click time limit.
            if (milliseconds >= SystemInformation.DoubleClickTime)
            {
                doubleClickTimer.Stop();

                Row       clickedRow       = null;
                Row       relatedRow       = null;
                TimeBlock clickedTimeBlock = null;
                foreach (Row row in Rows.Where(p => p.IsVisible))
                {
                    if (row.Rect.Contains(doubleClickLocation))
                    {
                        clickedRow = row;
                        break;
                    }
                    else if (row.TimeBlocks.Find(p => p.Rect.Contains(doubleClickLocation)) != null)
                    {
                        relatedRow       = row;
                        clickedTimeBlock = row.TimeBlocks.Find(p => p.Rect.Contains(doubleClickLocation));
                        break;
                    }
                }

                Point eventGlobalLocation = new Point(doubleClickLocation.X + this.Left,
                                                      doubleClickLocation.Y + this.Top);

                if (isDoubleClick)
                {
                    if (clickedRow != null)
                    {
                        if (clickedRow.IconRect.Contains(doubleClickLocation))
                        {
                            RowIconDoubleClick?.Invoke(new RowClickedEventArgs()
                            {
                                ClickedRow = clickedRow, CursorLocation = eventGlobalLocation
                            });
                        }
                        else
                        {
                            RowDoubleClick?.Invoke(new RowClickedEventArgs()
                            {
                                ClickedRow = clickedRow, CursorLocation = eventGlobalLocation
                            });
                        }
                    }
                    else if (clickedTimeBlock != null && clickedTimeBlock.Clickable)
                    {
                        TimeBlockDoubleClick?.Invoke(new TimeBlockClickedEventArgs()
                        {
                            ClickedTimeBlock = clickedTimeBlock, RelatedRow = relatedRow, CursorLocation = eventGlobalLocation
                        });
                    }
                    else if (renderer.MainCanvas.Contains(doubleClickLocation))
                    {
                        Row horizontalRow = Rows.FirstOrDefault(p => p.Rect.Contains(1, doubleClickLocation.Y));

                        DateTime?clickedTime = null;
                        for (int i = 0; i < renderer.TimeXLocations.Count - 1; i++) //Loop to 1 less than the end so we don't get index exceptions
                        {
                            Tuple <DateTime, int, StringFormat> time = renderer.TimeXLocations[i];
                            Rectangle rowRect = horizontalRow.Rect;
                            rowRect.X     = time.Item2;
                            rowRect.Width = renderer.TimeXLocations[i + 1].Item2 - rowRect.X;

                            if (rowRect.Contains(doubleClickLocation))
                            {
                                clickedTime = time.Item1;
                                break;
                            }
                        }

                        MainCanvasDoubleClick?.Invoke(new CanvasClickedEventArgs()
                        {
                            RelatedRow = horizontalRow, ClickedLocation = clickedTime, CursorLocation = eventGlobalLocation
                        });
                    }
                }
                else
                {
                    if (clickedRow != null)
                    {
                        if (clickedRow.IconRect.Contains(doubleClickLocation))
                        {
                            RowIconSingleClick?.Invoke(new RowClickedEventArgs()
                            {
                                ClickedRow = clickedRow, CursorLocation = eventGlobalLocation
                            });
                        }
                        else
                        {
                            RowSingleClick?.Invoke(new RowClickedEventArgs()
                            {
                                ClickedRow = clickedRow, CursorLocation = eventGlobalLocation
                            });
                        }
                    }
                    else if (clickedTimeBlock != null && clickedTimeBlock.Clickable)
                    {
                        TimeBlockSingleClick?.Invoke(new TimeBlockClickedEventArgs()
                        {
                            ClickedTimeBlock = clickedTimeBlock, RelatedRow = relatedRow, CursorLocation = eventGlobalLocation
                        });
                    }
                    else if (renderer.MainCanvas.Contains(doubleClickLocation))
                    {
                        Row horizontalRow = Rows.FirstOrDefault(p => p.Rect.Contains(1, doubleClickLocation.Y));

                        DateTime?clickedTime = null;
                        for (int i = 0; i < renderer.TimeXLocations.Count - 1; i++) //Loop to 1 less than the end so we don't get index exceptions
                        {
                            Tuple <DateTime, int, StringFormat> time = renderer.TimeXLocations[i];
                            Rectangle rowRect = horizontalRow.Rect;
                            rowRect.X     = time.Item2;
                            rowRect.Width = renderer.TimeXLocations[i + 1].Item2 - rowRect.X;

                            if (rowRect.Contains(doubleClickLocation))
                            {
                                clickedTime = time.Item1;
                                break;
                            }
                        }

                        MainCanvasSingleClick?.Invoke(new CanvasClickedEventArgs()
                        {
                            RelatedRow = horizontalRow, ClickedLocation = clickedTime, CursorLocation = eventGlobalLocation
                        });
                    }
                }

                //Allow the MouseDown event handler to process clicks again.
                isFirstClick  = true;
                isDoubleClick = false;
                milliseconds  = 0;
            }
        }
Exemple #4
0
        private void TableRow_DoubleClick(object sender, EventArgs e)
        {
            int row_num = ColumnRows.GetRow((TableLayoutPanel)sender);

            RowDoubleClick?.Invoke(row_num, rows[row_num]);
        }