123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Media.Imaging;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- namespace PRSDesktop.Configuration
- {
- public abstract class QAFormLayoutGrid<T> : DynamicOneToManyGrid<DigitalForm, DigitalFormLayout> where T : Entity, IRemotable, IPersistent, new()
- {
- private readonly BitmapImage design = PRSDesktop.Resources.design.AsBitmapImage();
- public QAFormLayoutGrid()
- {
- Options.AddRange(DynamicGridOption.RecordCount);
- ActionColumns.Add(new DynamicActionColumn(DesignImage, DesignClick));
- //AddButton("Design", PRSDesktop.Resources.design.AsBitmapImage(), DesignClick);
- HiddenColumns.Add(x => x.Layout);
- }
- private BitmapImage DesignImage(CoreRow row)
- {
- return row != null ? design : null;
- }
- private bool DesignClick(CoreRow row)
- {
- if (row == null)
- return false;
- var layout = LoadItem(row);
- var vPage =
- EditorGrid.Pages.FirstOrDefault(x => x is DynamicOneToManyGrid<DigitalForm, DigitalFormVariable>) as
- DynamicOneToManyGrid<DigitalForm, DigitalFormVariable>;
- var variables = vPage != null ? vPage.Items.ToArray() : Array.Empty<DigitalFormVariable>();
- var vprops = new Dictionary<string, string>();
- var form = new DynamicFormDesignWindow
- {
- Type = layout.Type
- };
- form.LoadLayout(layout, variables);
- form.Initialize();
- if (form.ShowDialog() == true)
- {
- layout.Layout = form.SaveLayout();
- SaveItem(layout);
- }
- return false;
- }
- //protected override void SaveItem(DigitalFormLayout item)
- //{
- // bool bActive = item.Active;
- // foreach (var other in Items.Where(x=>(x != item) && (x.Type == item.Type)))
- // {
- // if (item.Active)
- // {
- // if (other.Active)
- // other.Active = false;
- // }
- // else
- // bActive = bActive || other.Active;
- // }
- // if (!bActive)
- // item.Active = true;
- // base.SaveItem(item);
- //}
- protected override void DoDoubleClick(object sender)
- {
- DesignClick(SelectedRows.FirstOrDefault());
- }
- }
- public class QAFormLayoutGrid : QAFormLayoutGrid<DigitalForm>
- {
- }
- public class KanbanQALayoutGrid : QAFormLayoutGrid<Kanban>
- {
- }
- public class ITPQALayoutGrid : QAFormLayoutGrid<JobITP>
- {
- }
- public class AssignmentQALayoutGrid : QAFormLayoutGrid<Assignment>
- {
- }
- public class ManufacturingSectionQALayoutGrid : QAFormLayoutGrid<ManufacturingSection>
- {
- }
- public class ManufacturingPacketStageQALayoutGrid : QAFormLayoutGrid<ManufacturingPacketStage>
- {
- }
- }
|