12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for JobDesigns.xaml
- /// </summary>
- public partial class JobDesignList : UserControl, IPanel<Setout>, IJobControl
- {
- public JobDesignList()
- {
- InitializeComponent();
- Designs.OnSelectItem += Designs_OnSelectItem;
- }
- public Guid JobID { get; set; }
- public bool IsReady { get; set; }
- public event DataModelUpdateEvent OnUpdateDataModel;
- public void CreateToolbarButtons(IPanelHost host)
- {
- }
- public string SectionName => "Job Designs";
- public DataModel DataModel(Selection selection)
- {
- var ids = Designs.ExtractValues(c => c.ID, selection).ToArray();
- return new BaseDataModel<Setout>(new Filter<Setout>(x => x.ID).InList(ids));
- }
- public void Refresh()
- {
- Designs.JobID = JobID;
- Designs.Refresh(false, true);
- }
- public Dictionary<string, object[]> Selected()
- {
- return new Dictionary<string, object[]>();
- }
- public void Setup()
- {
- Designs.Refresh(true, false);
- Documents.Refresh(true, false);
- Packets.Refresh(true, false);
- }
- public void Shutdown()
- {
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- private void Designs_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
- {
- var row = e.Rows?.FirstOrDefault();
- var id = row != null ? row.Get<Setout, Guid>(x => x.ID) : CoreUtils.FullGuid;
- Documents.SetoutID = id;
- Documents.Refresh(true, true);
- Packets.JobID = JobID;
- Packets.SetoutID = id;
- Packets.Refresh(true, true);
- }
- }
- }
|