void SortGrid(ListSortDirection dir)
        {
            // get parameters
            var flex = Filter.Column.Grid as C1FlexGridBook;
            var sdc  = new List <UnboundSortDescription>();

            sdc.Add(new UnboundSortDescription(Filter.Column, dir));

            // apply sort
            var sa = new SortAction(flex);

            UnboundSort.SortUnboundGrid(flex, sdc);
            sa.SaveNewState();
            flex.UndoStack.AddAction(sa);
        }
        // check and apply sort criteria
        bool ApplySortCriteria()
        {
            // check sort descriptors
            foreach (var sortDesc in _sdc)
            {
                if (sortDesc.Column == null)
                {
                    // MessageBox appears behind the popup, so close the popup before showing it
                    this.Close(true);

                    // empty sort criteria
                    var msg = "All sort criteria must have a column specified.\r\nCheck the selected sort criteria and try again.";
                    MessageBox.Show(Application.Current.MainWindow, msg, "Sort", MessageBoxButton.OK);
                    return(false);
                }
                else
                {
                    foreach (var sortDesc2 in _sdc)
                    {
                        if (sortDesc2 != sortDesc && sortDesc2.Column == sortDesc.Column)
                        {
                            // MessageBox appears behind the popup, so close the popup before showing it
                            this.Close(true);

                            // duplicate sort criteria
                            var msg = "Column '{0}' is being sorted more than once.\r\nDelete the duplicate sort criteria and try again.";
                            msg = string.Format(msg, sortDesc.Column);
                            MessageBox.Show(Application.Current.MainWindow, msg, "Sort", MessageBoxButton.OK);
                            return(false);
                        }
                    }
                }
            }

            // apply undoable sort based on our sort descriptor collection
            var sa = new SortAction(_owner);

            UnboundSort.SortUnboundGrid(_owner, _sdc);
            sa.SaveNewState();
            _owner.UndoStack.AddAction(sa);

            // done
            return(true);
        }
Пример #3
0
        // check and apply sort criteria
        bool ApplySortCriteria()
        {
            // check sort descriptors
            foreach (var sortDesc in _sdc)
            {
                if (sortDesc.Column == null)
                {
                    // MessageBox appears behind the popup, so close the popup before showing it
                    this.Close(true);

                    // empty sort criteria
                    var msg = "All sort criteria must have a column specified.\r\nCheck the selected sort criteria and try again.";
                    MessageBox.Show(Application.Current.MainWindow, msg, "Sort", MessageBoxButton.OK);
                    return false;
                }
                else
                {
                    foreach (var sortDesc2 in _sdc)
                    {
                        if (sortDesc2 != sortDesc && sortDesc2.Column == sortDesc.Column)
                        {
                            // MessageBox appears behind the popup, so close the popup before showing it
                            this.Close(true);

                            // duplicate sort criteria
                            var msg = "Column '{0}' is being sorted more than once.\r\nDelete the duplicate sort criteria and try again.";
                            msg = string.Format(msg, sortDesc.Column);
                            MessageBox.Show(Application.Current.MainWindow, msg, "Sort", MessageBoxButton.OK);
                            return false;
                        }
                    }
                }
            }

            // apply undoable sort based on our sort descriptor collection
            var sa = new SortAction(_owner);
            UnboundSort.SortUnboundGrid(_owner, _sdc);
            sa.SaveNewState();
            _owner.UndoStack.AddAction(sa);

            // done
            return true;
        }
Пример #4
0
        void SortGrid(ListSortDirection dir)
        {
            // get parameters
            var flex = Filter.Column.Grid as C1FlexGridBook;
            var sdc = new List<UnboundSortDescription>();
            sdc.Add(new UnboundSortDescription(Filter.Column, dir));

            // apply sort
            var sa = new SortAction(flex);
            UnboundSort.SortUnboundGrid(flex, sdc);
            sa.SaveNewState();
            flex.UndoStack.AddAction(sa);
        }