123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Configuration;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- namespace PRSDesktop;
- public class TaskGrid : BaseKanbanGrid, ITaskControl
- {
- protected override TaskPanelProperties Properties => Host.Properties;
- protected override void Reload(
- Filters<Kanban> criteria, Columns<Kanban> columns, ref SortOrder<Kanban>? sort,
- CancellationToken token, Action<CoreTable?, Exception?> action)
- {
- if (Host.Master != null)
- criteria.Add(new Filter<Kanban>(x => x.JobLink.ID).IsEqualTo(Host.Master.ID));
-
- base.Reload(criteria, columns, ref sort, token, action);
- }
- #region ITaskControl Support
- public KanbanViewType KanbanViewType => KanbanViewType.List;
- public ITaskHost Host { get; set; }
- public bool IsReady { get; set; }
- public string SectionName => "Task List";
- public DataModel DataModel(Selection selection)
- {
- var ids = ExtractValues<Guid>(x => x.ID, selection);
- if (!ids.Any())
- ids = [Guid.Empty];
- return new AutoDataModel<Kanban>(new Filter<Kanban>(x => x.ID).InList(ids.ToArray()));
- }
- public void Refresh()
- {
- Refresh(false, true);
- }
- public void Refresh(bool resetselection)
- {
- Refresh(false, true);
- // reset selected rows here
- }
- public void Setup()
- {
- FilterComponent.SetSettings(Host.KanbanSettings.Filters, false);
- Refresh(true, false);
- }
- public IEnumerable<TaskModel> SelectedModels(TaskModel? sender = null)
- {
- MessageBox.Show("TaskListControl.SelectedModels() is not Implemented!");
- return Array.Empty<TaskModel>();
- }
- protected override bool CanCreateItems()
- {
- return base.CanCreateItems() && (Host.Master?.ID ?? Guid.Empty) != Guid.Empty;
- }
- public override Kanban CreateItem()
- {
- var result = base.CreateItem();
- result.JobLink.ID = Host.Master?.ID ?? Guid.Empty;
- result.JobLink.Synchronise(Host.Master ?? new Job());
- return result;
- }
- #endregion
- }
|