/// <summary>
        /// Sorts the records in the specified <see cref="GridView"/>.
        /// </summary>
        /// <param name="action">The 'Sorting' <see cref="GridAction"/> to perform.</param>
        /// <param name="view">The <see cref="GridView"/> to sort.</param>
        /// <param name="p">The parameters used for sorting.</param>
        public void HandleService(GridAction action, GridView view, params object[] p)
        {
            if (view == null) return;
            if (!view.AllowSorting) return;
            if (action != GridAction.Sorting) return;

            // Handle sorting
            GridViewSortEventArgs args = p[0] as GridViewSortEventArgs;
            if (args == null) return;

            if (args.SortExpression == LastExpression)
            {
                SortAscending = !SortAscending;
            }
            else
            {
                SortAscending = true;
                LastExpression = args.SortExpression;
            }

            args.SortDirection = SortDirection;

            if (view.DataSource is IDomainCollection)
            {
                IDomainCollection col = (IDomainCollection)view.DataSource;

                col.Sort(args.SortExpression, (args.SortDirection == SortDirection.Ascending) ? SortOrder.Ascending : SortOrder.Descending);

                view.DataSource = col;
            }

            view.DataBind();
        }
Beispiel #2
0
 public TileGridAction(MouseButton button, MouseModifier mod, GridAction action, TileGridEventHandler callback = null)
 {
     this.button   = button;
     this.mod      = mod;
     this.action   = action;
     this.callback = callback;
 }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            int        Track  = GetTrack(e.Y);
            int        Beat   = GetBeat(e.X);
            GridAction Action = GridAction.Click;

            //MessageBox.Show(String.Format("Click {0},{1}", Track, Note));
            if (Beat < 0)
            {
                return;
            }
            if (Track == -2)
            {
                Action = GridAction.AddRow;
            }
            if (Track == -3)
            {
                Action = GridAction.DeleteRow;
            }

            if (Track == -1)
            {
                return;
            }
            if (GridClick != null)
            {
                GridClick(this, new GridEventArgs(Track, Beat, Action));
            }
        }
Beispiel #4
0
 /// <summary>
 /// 构造函数-质控查看
 /// </summary>
 /// <param name="patient">病人实体类</param>
 public UcLis(InPatientInfo patient, bool flag, bool e)
 {
     InitializeComponent();
     txtPid.Text       = patient.PId;
     lisoutres         = new List <LisOutPutResult>();
     btnSure.Enabled   = false;
     btnCancel.Enabled = false;
     GridAction.SetGridStyle(flgview_Patient);
     GridAction.SetGridStyle(flgView_Yb);
 }
        /// <summary>
        /// Sets the new page as the current page of the specified <see cref="GridView"/>.
        /// </summary>
        /// <param name="action">The 'Paging' <see cref="GridAction"/> to perform.</param>
        /// <param name="view">The <see cref="GridView"/>, the current page of 
        /// which is to set.</param>
        /// <param name="p">The parameters used to set the current page.</param>
        public void HandleService(GridAction action, GridView view, params object[] p)
        {
            if (view == null) return;
            if (!view.AllowPaging) return;
            if (action != GridAction.Paging) return;

            GridViewPageEventArgs args = p[0] as GridViewPageEventArgs;
            if (args == null) return;

            view.PageIndex = args.NewPageIndex;
            view.SelectedIndex = -1;
            view.DataBind();
        }
 public void EnqueueInsertAction(GridAction action)
 {
     if (!ContainsMirror(removeActions, action))
     {
         if (!insertActions.Contains(action))
         {
             insertActions.Enqueue(action);
         }
     }
     else
     {
         removeActions = ExcludeMirrors(removeActions, action);
     }
 }
    public GridAction Dequeue()
    {
        GridAction action = null;

        if (removeActions.Count > 0)
        {
            action = removeActions.Dequeue();
        }
        else if (insertActions.Count > 0)
        {
            action = insertActions.Dequeue();
        }

        return(action);
    }
    private Queue <GridAction> ExcludeMirrors(Queue <GridAction> original, GridAction action)
    {
        Queue <GridAction> temp          = new Queue <GridAction>(original);
        Queue <GridAction> excludedQueue = new Queue <GridAction>();

        while (temp.Count > 0)
        {
            GridAction _temp = temp.Dequeue();
            if (!_temp.Mirror(action))
            {
                excludedQueue.Enqueue(_temp);
            }
        }

        return(new Queue <GridAction>(excludedQueue));
    }
    private bool ContainsMirror(Queue <GridAction> testable, GridAction action)
    {
        Queue <GridAction> temp = new Queue <GridAction>(testable);
        bool result             = false;

        while (temp.Count > 0)
        {
            GridAction _temp = temp.Dequeue();
            if (_temp.Mirror(action))
            {
                result = true;
                break;
            }
        }

        return(result);
    }
Beispiel #10
0
        public void AddMouseAction(MouseButton button, MouseModifier mod, GridAction action, TileGridEventHandler callback = null)
        {
            TileGridAction act;

            if (action == GridAction.Callback)
            {
                if (callback == null)
                {
                    throw new Exception("Need to specify a callback.");
                }
                act = new TileGridAction(button, mod, action, callback);
            }
            else
            {
                if (callback != null)
                {
                    throw new Exception("This action doesn't take a callback.");
                }
                act = new TileGridAction(button, mod, action);
            }

            actionList.Add(act);
        }
Beispiel #11
0
 public GridEventArgs(int track, int note, GridAction action)
 {
     Track  = track;
     Note   = note;
     Action = action;
 }
Beispiel #12
0
        public override void Process(TagHelperContext tagContext, TagHelperOutput output)
        {
            var model = new NccActionModel
            {
                TargetIds = GridActionTarget.Split(',')
            };

            model.Parameters.Add($"{DefaultParameters.ActionType.ToString().NccAddPrefix()}", "GridAction");
            model.Parameters.Add($"{DefaultParameters.EventName.ToString().NccAddPrefix()}", GridAction.ToString());
            model.Parameters.Add($"{NccGridParametersEnum.RowNumber.ToString().NccAddPrefix()}", GridRowPos.ToString());

            if (output.TagName.ToLower() == "select")
            {
                var onchange = "";
                if (output.Attributes.ContainsName("onchange"))
                {
                    onchange = output.Attributes["onchange"].Value.ToString();
                }

                output.Attributes.SetAttribute("onchange", $"{onchange} nccAction(event, $(this), '{JsonConvert.SerializeObject(model)}', '{NccConstants.AttributePrefix}');");
            }
            else
            {
                var onclick = "";
                if (output.Attributes.ContainsName("onclick"))
                {
                    onclick = output.Attributes["onclick"].Value.ToString();
                }

                output.Attributes.SetAttribute("onclick", $"{onclick} nccAction(event, $(this), '{JsonConvert.SerializeObject(model)}', '{NccConstants.AttributePrefix}');");
            }
        }
Beispiel #13
0
        private void HighlightAction(GridAction action)
        {
            RectTransform mask = _masks[0];

            Highlight(ref mask, action.GetComponent <RectTransform>());
        }