123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- namespace PRSDesktop.Configuration;
- public abstract class QAFormQuestionGrid<T> : DynamicOneToManyGrid<DigitalForm, QAQuestion> where T : Entity, IRemotable, IPersistent, new()
- {
- protected bool Preview = false;
- public QAFormQuestionGrid()
- {
- AddButton("Fill", PRSDesktop.Resources.quality.AsBitmapImage(), PreviewForm);
- //AddButton("Design", PRSDesktop.Resources.edit.AsBitmapImage(true), DesignForm);
- }
- public virtual string Description()
- {
- return "QA Checks";
- }
- //private bool DesignForm(Button arg1, CoreRow[] arg2)
- //{
- // var form = new DynamicFormWindow();
- // bool result = form.ShowDialog() == true;
- // return false;
- //}
- private bool PreviewForm(Button sender, CoreRow[] rows)
- {
- var window = new Window { Title = "Quality Assurance Form", Width = 700 };
- window.Background = new SolidColorBrush(Colors.WhiteSmoke);
- var layout = new Grid();
- layout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1.0F, GridUnitType.Star) });
- layout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(100.0F) });
- layout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(100.0F) });
- layout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1.0F, GridUnitType.Star) });
- layout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(50.0F) });
- var qagrid = new QAGrid();
- var values = new Dictionary<Guid, object>();
- qagrid.LoadChecks(Description(), Items, values);
- qagrid.CollapseMargins();
- qagrid.SetValue(Grid.RowProperty, 0);
- qagrid.SetValue(Grid.ColumnProperty, 0);
- qagrid.SetValue(Grid.ColumnSpanProperty, 3);
- layout.Children.Add(qagrid);
- var ok = new Button();
- ok.SetValue(Grid.RowProperty, 1);
- ok.SetValue(Grid.ColumnProperty, 1);
- ok.Content = "OK";
- ok.Margin = new Thickness(0, 0, 10, 10);
- ok.Click += (o, e) =>
- {
- values.Clear();
- window.DialogResult = true;
- window.Close();
- };
- layout.Children.Add(ok);
- var cancel = new Button();
- cancel.SetValue(Grid.RowProperty, 1);
- cancel.SetValue(Grid.ColumnProperty, 2);
- cancel.Content = "Cancel";
- cancel.Margin = new Thickness(0, 0, 10, 10);
- cancel.Click += (o, e) =>
- {
- window.DialogResult = false;
- window.Close();
- };
- layout.Children.Add(cancel);
- window.Content = layout;
- window.ShowDialog();
- return false;
- }
- }
- public class QAFormQuestionGrid : QAFormQuestionGrid<DigitalForm>
- {
- }
- public class KanbanQAQuestionGrid : QAFormQuestionGrid<Kanban>
- {
- }
- public class ITPQAQuestionGrid : QAFormQuestionGrid<JobITP>
- {
- }
- public class AssignmentQAQuestionGrid : QAFormQuestionGrid<Assignment>
- {
- }
- public class ManufacturingSectionQAQuestionGrid : QAFormQuestionGrid<ManufacturingSection>
- {
- }
- public class ManufacturingPacketStageQAQuestionGrid : QAFormQuestionGrid<ManufacturingPacketStage>
- {
- }
|