using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; using Comal.Classes; using System.ComponentModel; using InABox.Core; using InABox.Wpf; namespace PRSDesktop; public partial class JobAssignmentPanel : UserControl, IBasePanel, IMasterDetailControl, IDataModelSource { public JobAssignmentPanel() { InitializeComponent(); } #region IJobPanel public Job? Master { get => Activities.Master; set { Activities.Master = value; Assignments.Master = value; } } #endregion #region IDataModelSource public event DataModelUpdateEvent? OnUpdateDataModel; public string SectionName => "Job Assignments"; public DataModel DataModel(Selection selection) { var ids = Assignments.ExtractValues(x => x.ID, selection).ToArray(); return new AssignmentDataModel(new Filter(x => x.ID).InList(ids)); } #endregion #region IBasePanel public void Setup() { Activities.Refresh(true, false); Assignments.Refresh(true, false); } public void Shutdown(CancelEventArgs? cancel) { } public void Refresh() { Activities.Refresh(false, true); Assignments.Refresh(false, true); } public bool IsReady { get; set; } public void CreateToolbarButtons(IPanelHost host) { } public Dictionary Selected() { return new Dictionary { { typeof(Assignment).EntityName(), Assignments.SelectedRows } }; } public void Heartbeat(TimeSpan time) { } #endregion }