| 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;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for QuoteTakeoffs.xaml
- /// </summary>
- public partial class QuoteDesigns : UserControl, IQuotePage, IPanel<Quote>
- {
- public QuoteDesigns()
- {
- InitializeComponent();
- Designs.OnSelectItem += Designs_OnSelectItem;
- }
- public bool IsReady { get; set; }
- public event DataModelUpdateEvent OnUpdateDataModel;
- public void CreateToolbarButtons(IPanelHost host)
- {
- }
- public string SectionName => "Quote Designs";
- public DataModel DataModel(Selection selected)
- {
- var designs = Designs.ExtractValues(x => x.ID, selected).ToArray();
- return new BaseDataModel<QuoteDesign>(new Filter<QuoteDesign>(x => x.ID).InList(designs));
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- public void Refresh()
- {
- Designs.Refresh(false, true);
- Items.Refresh(false, true);
- }
- public Dictionary<string, object[]> Selected()
- {
- return new Dictionary<string, object[]>();
- }
- public void Setup()
- {
- Designs.Refresh(true, false);
- Items.Refresh(true, false);
- }
- public void Shutdown(CancelEventArgs? cancel)
- {
- }
- public Quote Quote
- {
- get => Designs.Quote;
- set => Designs.Quote = value;
- }
- public Dictionary<Type, CoreTable> DataEnvironment()
- {
- return new Dictionary<Type, CoreTable>();
- }
- private void Designs_OnSelectItem(object sender, DynamicGridSelectionEventArgs e)
- {
- var row = e.Rows?.FirstOrDefault();
- Items.Design = row?.ToObject<QuoteDesign>() ?? new QuoteDesign();
- Items.Refresh(false, true);
- }
- }
- }
|