コード例 #1
0
        /// <summary>
        /// Changed selection in RadioButtons and reloads project
        /// </summary>
        /// <param name="e"></param>
        private void _ChangeSelectedProject(RoutedEventArgs e)
        {
            if (XceedGrid.SelectedIndex != -1)
            {
                Row row = XceedVisualTreeHelper.GetRowByEventArgs(e);

                Debug.Assert(row != null);

                // NOTE : when user clicks so fast on radio buttons sometimes row's content can't be updated in time.
                // In that case we should do nothing
                if (row.Cells[NAME_COLUMN_CAPTION].Content == null)
                {
                    return;
                }

                string checkedProjectName = row.Cells[NAME_COLUMN_CAPTION].Content.ToString();

                _LoadProject(checkedProjectName);
                try
                {
                    XceedGrid.EndEdit();
                }
                catch
                {
                    XceedGrid.CancelEdit();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Registers that drag and drop can potentially start.
        /// </summary>
        /// <param name="sender">Data grid.</param>
        /// <param name="e">Event args.</param>
        private void _DataGridControlPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // Check that user clicked on a row.
            Row row = XceedVisualTreeHelper.GetRowByEventArgs(e);

            if (row != null && row is DataRow && !(row is InsertionRow)) // Don't start drag of insertion row.
            {
                // We must start dragging on mouse move.
                _mustStartDraggingOnMouseMove = true;
            }
        }
コード例 #3
0
        /// <summary>
        /// Changes cursor during user drags over DataGridControl.
        /// </summary>
        /// <param name="sender">DataGridControl.</param>
        /// <param name="e">Event args.</param>
        private void _DragOverGrid(object sender, DragEventArgs e)
        {
            Row draggedOverRow = XceedVisualTreeHelper.GetRowByEventArgs(e);

            if (draggedOverRow is InsertionRow || draggedOverRow is ColumnManagerRow ||
                (!(e.OriginalSource is TableViewScrollViewer) && draggedOverRow == null))
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
            }
            else
            {
                e.Effects = DragDropEffects.Move;
            }
        }
コード例 #4
0
 /// <summary>
 /// React on mouse up. Try to geocode order.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Ignored.</param>
 private void _DataGridControlPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     // Do not start geocoding in case of shift or control used or selected more than one order.
     if (_schedulePage.SelectedItems.Count == 1 && (Keyboard.Modifiers & ModifierKeys.Shift) == 0 &&
         (Keyboard.Modifiers & ModifierKeys.Control) == 0)
     {
         Order order = _schedulePage.SelectedItems[0] as Order;
         Row   row   = XceedVisualTreeHelper.GetRowByEventArgs(e);
         if (order != null && !order.IsGeocoded && !_schedulePage.GeocodablePage.IsGeocodingInProcess &&
             !_schedulePage.IsEditingInProgress && row != null)
         {
             // Geocode order.
             _schedulePage.GeocodablePage.StartGeocoding(order);
         }
     }
 }
コード例 #5
0
        /// <summary>
        /// Drops orders to grid.
        /// </summary>
        /// <param name="sender">DataGridControl.</param>
        /// <param name="e">Event args.</param>
        private void _OrdersGridDrop(object sender, DragEventArgs e)
        {
            // Get row where object was dropped.
            Row parentRow = XceedVisualTreeHelper.GetRowByEventArgs(e);

            object targetData = OrdersGrid;

            if (parentRow != null)
            {
                targetData = _GetTargetData(parentRow); // Get data from dropped object.
            }
            // Do necessary actions (move or reassign routes etc.).
            DragAndDropHelper dragAndDropHelper = new DragAndDropHelper();

            dragAndDropHelper.Drop(targetData, e.Data);
        }
コード例 #6
0
        /// <summary>
        /// React on click.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        private void _PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            // Get order which will be selected later by parent row.
            Row row = XceedVisualTreeHelper.GetRowByEventArgs(e);

            if (row != null)
            {
                Order order = row.DataContext as Order;

                if (order != null && order.PlannedDate.HasValue)
                {
                    List <Order> orderList = new List <Order>();
                    orderList.Add(order);
                    _optimizeAndEditPage.Select(orderList); // exception
                }

                // We must start dragging on mouse move.
                _mustStartDraggingOnMouseMove = true;
            }
        }