public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.commands_list_item, parent, false); CommandsListItemViewHolder commandListItemViewHolder = new CommandsListItemViewHolder(itemView, OnClick, OnMoveOrderingCommand); return(commandListItemViewHolder); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { CommandsListItemViewHolder commandListItemViewHolder = holder as CommandsListItemViewHolder; lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { CommandModel command = db.Commands.Where(x => x.ScriptId == ScriptId).OrderBy(x => x.Ordering).Skip(position).FirstOrDefault(); commandListItemViewHolder.CommandId = command.Id; // commandListItemViewHolder.Name.Text = command.Name; commandListItemViewHolder.Info.Text = $"{command.TypeCommand}"; commandListItemViewHolder.Info2.Text = $"{(command.Hidden ? "[hide] " : "")}"; commandListItemViewHolder.Info3.Text = $"{(command.PauseBeforeExecution > 0 ? $"[p:{command.PauseBeforeExecution}s] " : "")}"; commandListItemViewHolder.Info4.Text = $"{(command.PortExecutionConditionId > 0 ? $"[req] " : "")}"; } } }