Exemple #1
0
 private void FillValue(string key, IntPtr rowNumber, Page9_12_1_Relation relation, Page9_12_1Value value)
 {
     if (ApiSetter.SetComboBoxSelected(base.HWnd, rowNumber, key) == false)
     {
         return;
     }
     ApiSetter.SetComboBoxSelected(base.HWnd, relation.Cert, value.Cert);
     ApiSetter.SetText(relation.CertNo, value.CertNo);
     if (string.IsNullOrEmpty(value.Transform))
     {
         ApiSetter.ClickButton(relation.Transform, base.HWnd, null, null);
     }
     else
     {
         ApiSetter.SetText(relation.TransformText, value.Transform);
     }
     ApiSetter.SetComboBoxSelected(base.HWnd, relation.HeightAdj, value.HeightAdj);
     ApiSetter.SetText(relation.Productor, value.Productor);
     ApiSetter.SetText(relation.SeatBeltType, value.SeatBeltType);
     ApiSetter.SetText(relation.Model, value.Model);
     ApiSetter.SetText(relation.RetractorType, value.RetractorType);
     ApiSetter.SetText(relation.RetractorAngle, value.RetractorAngle);
     ApiSetter.SetText(relation.SeatBeltPosition, value.SeatBeltPosition);
     if (string.IsNullOrEmpty(value.SeatBeltPosAttach) == false)
     {
         ApiSetter.ClickButton(relation.SeatBeltPosAttach, base.HWnd, ListenAttachWindow,
                               new FillValue3C()
         {
             PublicAttachFile = value.SeatBeltPosAttach, Separators = FillParameter3C.DefaultSeparators
         });
     }
     ApiSetter.SetText(relation.LockType, value.LockType);
     ApiSetter.SetText(relation.FixedPosNum, value.FixedPosNum);
     ApiSetter.SetText(relation.CCCSignPos, value.CCCSignPos);
     if (string.IsNullOrEmpty(value.SeatBeltPosAttach) == false)
     {
         ApiSetter.ClickButton(relation.CCCSignPosAttach, base.HWnd, ListenAttachWindow,
                               new FillValue3C()
         {
             PublicAttachFile = value.CCCSignPosAttach, Separators = FillParameter3C.DefaultSeparators
         });
     }
     ApiSetter.SetText(relation.CCCSignFixation, value.CCCSignFixation);
 }
Exemple #2
0
        public override bool FillPage()
        {
            List <IntPtr> containerList;

            this.ReadData();
            Hashtable controlGroup = new Hashtable();
            IntPtr    ok = IntPtr.Zero, rowNumber = IntPtr.Zero, cancel = IntPtr.Zero;

            foreach (DictionaryEntry entry in data)
            {
                ApiSetter.ClickButton(base.Add, base.HWnd, null, null);
                List <Page9_12_1Value> values = entry.Value as List <Page9_12_1Value>;
                // 初始化填报控件的对应关系
                if (ok == IntPtr.Zero || cancel == IntPtr.Zero || rowNumber == IntPtr.Zero || controlGroup.Count == 0)
                {
                    controlGroup.Clear();
                    ok = GetFillControlList(out containerList, out cancel);
                    if (containerList == null || containerList.Count < 11)
                    {
                        return(false);
                    }
                    rowNumber = GetRowNumberControl(containerList[1]);
                    int startIndex = 2;
                    int count      = 3;
                    while (count > 0)
                    {
                        List <IntPtr> sorted = ControlSorter.SortChild(containerList, startIndex, 3);
                        startIndex += 3;
                        Page9_12_1_Relation relation = new Page9_12_1_Relation(sorted);
                        if (relation.PositionDesc != null)
                        {
                            controlGroup.Add(relation.PositionDesc, relation);  // 用座椅位置作为键值存储控件句柄的对应关系。
                        }
                        count--;
                    }
                }
                if (values == null || values.Count == 0)
                {
                    continue;
                }
                foreach (var item in values) // 根据数据填写各座椅位置数据,并将已填写的座椅位置移除,
                {                            // 最后剩余的未填写项设置为不适用
                    if (item.Position == null)
                    {
                        continue;
                    }
                    Page9_12_1_Relation relation = controlGroup[item.Position] as Page9_12_1_Relation;
                    if (relation != null)
                    {
                        FillValue(entry.Key as string, rowNumber, relation, item);
                        relation.IsUsed = true;
                    }
                }
                foreach (DictionaryEntry c in controlGroup)
                {
                    Page9_12_1_Relation relation = c.Value as Page9_12_1_Relation;
                    if (relation != null && relation.IsUsed == false)
                    {
                        ApiSetter.ClickButton(relation.Position, base.HWnd, null, null);
                    }
                }
                ApiSetter.ClickButton(ok, base.HWnd, null, null);
                // 还原CheckBox状态
                ApiSetter.ClickButton(base.Add, base.HWnd, null, null); // 显示控件
                foreach (DictionaryEntry c in controlGroup)
                {
                    Page9_12_1_Relation relation = c.Value as Page9_12_1_Relation;
                    if (relation != null && relation.IsUsed == false)
                    {
                        ApiSetter.ClickButton(relation.Position, base.HWnd, null, null);
                    }
                    relation.IsUsed = false;
                }
                ApiSetter.ClickButton(cancel, base.HWnd, null, null);
            }
            this.Main.ClickSaveButton(base.Save);
            return(true);
        }