Beispiel #1
0
 public void RegisterService(RadService service)
 {
     if (this.serviceProvider == null)
     {
         return;
     }
     this.serviceProvider.RegisterService(service);
 }
        public void RegisterService(RadService service)
        {
            string     name       = service.Name;
            RadService radService = (RadService)null;

            this.services.TryGetValue(name, out radService);
            if (radService != null)
            {
                if (radService == service)
                {
                    return;
                }
                this.services[name] = service;
            }
            else
            {
                this.services.Add(name, service);
            }
        }
        public override bool OnMouseUp(MouseEventArgs e)
        {
            GridCellElement mouseDownCell = this.mouseDownCell;

            this.mouseDownCell = (GridCellElement)null;
            if (this.cellToResize != null)
            {
                int num = (int)this.cellToResize.SetValue(RadElement.IsMouseDownProperty, (object)false);
                this.cellToResize = (GridCellElement)null;
            }
            if (this.columnToResize != null && this.rowLayout != null)
            {
                this.rowLayout.EndColumnResize();
                if (this.GridViewElement.AutoSizeRows && this.columnToResize.WrapText)
                {
                    RadElement radElement = this.GridViewElement.ElementTree.GetElementAtPoint(e.Location);
                    while (radElement != null && !(radElement is GridTableElement))
                    {
                        radElement = radElement.Parent;
                    }
                }
                this.RootGridBehavior.UnlockBehavior((IGridBehavior)this);
                this.mouseIsDown         = false;
                this.GridControl.Capture = false;
                this.columnResizeStarted = false;
                this.rowLayout           = (IGridRowLayout)null;
                this.columnToResize      = (GridViewColumn)null;
                this.ResetCursor();
                return(false);
            }
            if (this.dragDropStarted)
            {
                RadService service = (RadService)this.GridViewElement.GetService <RadDragDropService>();
                this.dragDropStarted = false;
                if (service != null && (service.State == RadServiceState.Working || service.State == RadServiceState.Initial))
                {
                    return(true);
                }
            }
            else
            {
                GridHeaderCellElement cellAtPoint = this.RootGridBehavior.CellAtPoint as GridHeaderCellElement;
                if (cellAtPoint == null || (e.Location.X < cellAtPoint.ControlBoundingRectangle.X + 3 || this.disableSortOrderChange))
                {
                    return(false);
                }
                if (this.MasterTemplate.CurrentRow is GridViewNewRowInfo && this.GridViewElement.ContextMenuManager.ContextMenu == null)
                {
                    this.MasterTemplate.CurrentRow = (GridViewRowInfo)null;
                }
                if (e.Button == MouseButtons.Left)
                {
                    if (cellAtPoint != null && cellAtPoint == mouseDownCell)
                    {
                        RadSortOrder sortOrder;
                        switch (cellAtPoint.SortOrder)
                        {
                        case RadSortOrder.Ascending:
                            sortOrder = RadSortOrder.Descending;
                            break;

                        case RadSortOrder.None:
                            sortOrder = RadSortOrder.Ascending;
                            break;

                        default:
                            GridViewDataColumn columnInfo = cellAtPoint.ColumnInfo as GridViewDataColumn;
                            sortOrder = columnInfo == null || columnInfo.AllowNaturalSort ? RadSortOrder.None : RadSortOrder.Ascending;
                            break;
                        }
                        cellAtPoint.Sort(sortOrder);
                    }
                    return(false);
                }
            }
            return(base.OnMouseUp(e));
        }