1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.IO;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using Comal.Classes;
- using InABox.Configuration;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- using Microsoft.Win32;
- using Syncfusion.Windows.Shared;
- namespace PRSDesktop
- {
- public class JobPlannerEmployee : BaseObject
- {
- public Guid ID { get; set; }
-
- [TextBoxEditor(Visible = Visible.Default)]
- [EditorSequence(1)]
- public String Name { get; set; }
-
- [DurationEditor(Visible=Visible.Default, Format = "hh:mm", Width=50)]
- [EditorSequence(2)]
- public TimeSpan Time { get; set; }
- }
- public enum JobPlannerEmployeeAction
- {
- Assign,
- Remove
- }
- public delegate void JobPlannerEmployeeGridAction(object sender, JobPlannerEmployee[] employee);
-
- public class JobPlannerEmployeeGrid : DynamicItemsListGrid<JobPlannerEmployee>
- {
- public static readonly DependencyProperty ActionProperty = DependencyProperty.Register(
- nameof (Action),
- typeof (JobPlannerEmployeeAction),
- typeof (JobPlannerEmployeeGrid),
- new PropertyMetadata(JobPlannerEmployeeAction.Assign)
- );
-
- public JobPlannerEmployeeAction Action
- {
- get => (JobPlannerEmployeeAction)GetValue(ActionProperty);
- set => SetValue(ActionProperty, value);
- }
- public event JobPlannerEmployeeGridAction OnAction;
-
- private BitmapImage _assign = PRSDesktop.Resources.small_add.AsBitmapImage();
- private BitmapImage _remove = PRSDesktop.Resources.small_delete.AsBitmapImage();
-
- public JobPlannerEmployeeGrid()
- {
- ActionColumns.Add(new DynamicImageColumn(EmployeeImage, EmployeeAction) { Position = DynamicActionColumnPosition.Start});
- }
- private bool EmployeeAction(CoreRow? arg)
- {
- if (arg == null)
- OnAction?.Invoke(this, Items.ToArray());
- else
- OnAction?.Invoke(this, new JobPlannerEmployee[] { arg.ToObject<JobPlannerEmployee>() });
- return true;
- }
- private BitmapImage? EmployeeImage(CoreRow? arg)
- {
- return Action == JobPlannerEmployeeAction.Assign
- ? _assign
- : _remove;
- }
- }
- }
|