| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.Wpf;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for JobDesigns.xaml
- /// </summary>
- public partial class JobDesignPanel : UserControl, IPanel<Setout>, IMasterDetailControl<Job>
- {
- public JobDesignPanel()
- {
- InitializeComponent();
- Designs.OnSelectItem += Designs_OnSelectItem;
- }
- public Job? Master
- {
- get => Designs.Master;
- set => Designs.Master = value;
- }
-
- 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.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(CancelEventArgs? cancel)
- {
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- private void Designs_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
- {
- var design = e.Rows?.FirstOrDefault()?.ToObject<Setout>();
- Documents.Design = design;
- Documents.Refresh(true, true);
- Packets.Master = Master;
- Packets.Design = design;
- Packets.Refresh(true, true);
- }
- }
- }
|