| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.Wpf;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for GPSTrackers.xaml
- /// </summary>
- public partial class GPSTrackers : UserControl, IPanel<GPSTracker>
- {
- private readonly GPSTrackerGrid Trackers;
- public GPSTrackers()
- {
- InitializeComponent();
- Trackers = new GPSTrackerGrid
- {
- HorizontalAlignment = HorizontalAlignment.Stretch,
- VerticalAlignment = VerticalAlignment.Stretch,
- Margin = new Thickness(0)
- };
- Trackers.Reconfigure(options =>
- {
- options.RecordCount = true;
- options.FilterRows = true;
- options.MultiSelect = true;
- options.SelectColumns = true;
- });
- AddChild(Trackers);
- }
- public bool IsReady { get; set; }
- public event DataModelUpdateEvent? OnUpdateDataModel;
- public Dictionary<string, object[]> Selected()
- {
- return new Dictionary<string, object[]> { { typeof(GPSTracker).EntityName(), Trackers.SelectedRows } };
- }
- public void Setup()
- {
- }
- public void Shutdown(CancelEventArgs? cancel)
- {
- }
- public void CreateToolbarButtons(IPanelHost host)
- {
- EquipmentSetupActions.TrackerTypes(host);
- }
- public void Refresh()
- {
- Trackers.Refresh(true, true);
- }
- public string SectionName => "GPS Trackers";
- public DataModel DataModel(Selection selection)
- {
- var ids = Trackers.ExtractValues(x => x.ID, selection).ToArray();
- return new BaseDataModel<GPSTracker>(Filter<GPSTracker>.Where(x => x.ID).InList(ids));
- }
- public void Heartbeat(TimeSpan time)
- {
- }
- public Type DataType()
- {
- return typeof(GPSTracker);
- }
- }
- }
|