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
{
///
/// Interaction logic for JobDock.xaml
///
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().Query(
new Filter(x => x.Active).IsEqualTo(true),
new Columns(
x => x.ID,
x => x.Description
),
new SortOrder(x => x.Description)
);
JobStatus.ItemsSource = statustable.IntoDictionary(
new Dictionary { { Guid.Empty, "All Jobs" } },
x => x.ID,
x => x.Description
);
var settings = new UserConfiguration().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;
}
}
}