private void InspectionAddEditXtraForm_Load(object sender, EventArgs e)
        {
            status.Properties.Items.Clear();
            EnumWrapper <PipeTestResultStatus> .LoadItems(status.Properties.Items, skip0 : true);

            BindToViewModel();
            if (listOfInspectors != null)
            {
                var insp = (List <Inspector>)listOfInspectors.Where(_ => _.Key == viewModel.Code).FirstOrDefault().Value;
                if (insp != null)
                {
                    viewModel.TestResult.Inspectors = insp;
                }
                else
                {
                    viewModel.TestResult.Inspectors = new List <Inspector>();
                }
                inspectors.SelectInspectors(viewModel.SelectInspectors());
            }

            inspectors.InspectionDate = viewModel.Date;
            factBool_CheckedChanged(null, null);

            date.SetLimits();
        }
Пример #2
0
        private void BindToViewModel()
        {
            bindingSource.DataSource           = viewModel;
            inspectorsBindingSource.DataSource = viewModel.Inspectors;

            inspectors.DataSource = inspectorsBindingSource;
            inspectors.SelectInspectors(viewModel.SelectInspectors());

            factString.Properties.DataSource = viewModel.CannedMessages;

            code.DataBindings.Add("EditValue", bindingSource, "Code");
            category.DataBindings.Add("EditValue", bindingSource, "Category");
            name.DataBindings.Add("EditValue", bindingSource, "Name");
            expected.DataBindings.Add("EditValue", bindingSource, "Expected");

            status.DataBindings.Add("SelectedIndex", bindingSource, "StatusIndex");
            date.DataBindings.Add("EditValue", bindingSource, "Date");

            factBool.DataBindings.Add("Checked", bindingSource, "FactBool");
            factString.DataBindings.Add("EditValue", bindingSource, "FactString");
            factLimit.DataBindings.Add("EditValue", bindingSource, "FactLimit");
        }