1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Controls;
- using Comal.Classes;
- using InABox.Clients;
- using InABox.Configuration;
- using InABox.Core;
- namespace PRSDesktop
- {
- /// <summary>
- /// Interaction logic for JobDock.xaml
- /// </summary>
- public partial class JobDock : UserControl, IDockPanel
- {
- private JobGrid _jobs;
- public JobDock()
- {
- InitializeComponent();
- }
-
- public void Setup()
- {
- _jobs = new JobGrid();
- _jobs.SetValue(Grid.RowProperty, 1);
- _jobs.Margin = new Thickness(2);
- grid.Children.Add(_jobs);
-
- var statustable = new Client<JobStatus>().Query(
- new Filter<JobStatus>(x => x.Active).IsEqualTo(true),
- new Columns<JobStatus>(
- x => x.ID,
- x => x.Description
- ),
- new SortOrder<JobStatus>(x => x.Description)
- );
- JobStatus.ItemsSource = statustable.IntoDictionary<JobStatus, Guid>(
- new Dictionary<Guid, string> { { Guid.Empty, "All Jobs" } },
- x => x.ID,
- x => x.Description
- );
- var settings = new UserConfiguration<JobScreenSettings>().Load();
- _jobs.StatusID = settings.JobStatus;
- _jobs.Refresh(true, false);
- }
- public void Refresh()
- {
- _jobs.Refresh(false, true);
- }
- private void JobStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (_jobs == null)
- return;
- _jobs.StatusID = (Guid)JobStatus.SelectedValue;
- }
- }
- }
|