private void FillValue(string key, IntPtr rowNumber, Page9_13_3_Relation relation, Page9_13_3Value value) { if (ApiSetter.SetComboBoxSelected(base.HWnd, rowNumber, key) == false) { return; } ApiSetter.SetText(relation.CarStructOuterSide_DFP, value.CarStructOuterSide_DFP); ApiSetter.SetText(relation.SeatStructOuterSide_DFP, value.SeatStructOuterSide_DFP); ApiSetter.SetText(relation.CarStructInnerSide_DFP, value.CarStructInnerSide_DFP); ApiSetter.SetText(relation.SeatStructInnerSide_DFP, value.SeatStructInnerSide_DFP); if (string.IsNullOrEmpty(value.CarStruct_UFP) && string.IsNullOrEmpty(value.SeatStruct_UFP)) { ApiSetter.ClickButton(relation.UpperFixedPoint, base.HWnd, null, null); // 上固定点不适用 } else { long style = NativeApi.GetWindowLong(relation.CarStruct_UFP, -16); if ((style & WindowStyles.WS_DISABLED) == WindowStyles.WS_DISABLED) { ApiSetter.ClickButton(relation.UpperFixedPoint, base.HWnd, null, null); } ApiSetter.SetText(relation.CarStruct_UFP, value.CarStruct_UFP); ApiSetter.SetText(relation.SeatStruct_UFP, value.SeatStruct_UFP); } }
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); }
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); // 初始化填报控件的对应关系 if (ok == IntPtr.Zero || cancel == IntPtr.Zero || rowNumber == IntPtr.Zero || controlGroup.Count == 0) { controlGroup.Clear(); ok = GetFillControlList(out containerList, out cancel); rowNumber = IntPtr.Zero; if (containerList == null) { return(false); } containerList = ControlSorter.SortChild(containerList[0]); List <IntPtr> sorted = ControlSorter.SortChild(containerList, 0, 1); rowNumber = sorted[1]; sorted = ControlSorter.SortChild(containerList, 1, 1); List <Page9_13_3_Relation> relations = new List <Page9_13_3_Relation>(4); for (int i = 0; i < sorted.Count - 1; i += 2) { Page9_13_3_Relation relation = new Page9_13_3_Relation(); relation.SetSeatPosition(sorted[i], sorted[i + 1]); relations.Add(relation); if (relation.SeatPosDesc != null) { controlGroup.Add(relation.SeatPosDesc, relation); } } int startIndex = 2; int count = 3; while (count > 0 && startIndex + 3 <= containerList.Count) { sorted = ControlSorter.SortChild(containerList, startIndex, 3); // 生成9.13.3的控件对应关系。 if (sorted.Count != 11) { continue; } Page9_13_3_Relation relation = relations[3 - count]; relation.UpperFixedPoint = sorted[4]; relation.CarStructOuterSide_DFP = sorted[5]; relation.SeatStructOuterSide_DFP = sorted[6]; relation.CarStructInnerSide_DFP = sorted[7]; relation.SeatStructInnerSide_DFP = sorted[8]; relation.CarStruct_UFP = sorted[9]; relation.SeatStruct_UFP = sorted[10]; count--; startIndex += 3; } } List <Page9_13_3Value> values = entry.Value as List <Page9_13_3Value>; if (values == null || values.Count == 0) { continue; } foreach (var item in values) // 根据数据填写各座椅位置数据,并将已填写的座椅位置移除, { if (item.SeatPosition == null) { continue; } Page9_13_3_Relation relation = controlGroup[item.SeatPosition] as Page9_13_3_Relation; if (relation != null) { FillValue(entry.Key as string, rowNumber, relation, item); relation.IsUsed = true; } } foreach (DictionaryEntry c in controlGroup) { Page9_13_3_Relation relation = c.Value as Page9_13_3_Relation; if (relation != null && relation.IsUsed == false) { ApiSetter.ClickButton(relation.SeatPosition, 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_13_3_Relation relation = c.Value as Page9_13_3_Relation; if (relation != null && relation.IsUsed == false) { ApiSetter.ClickButton(relation.SeatPosition, base.HWnd, null, null); } relation.IsUsed = false; } ApiSetter.ClickButton(cancel, base.HWnd, null, null); } this.Main.ClickSaveButton(base.Save); return(true); }
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); }
public virtual bool FillPage() { if (editRange == IntPtr.Zero) { return(false); } if (sheet.ReadFollowingRow(2)) { bool isEmptyRow; Dictionary <int, string> values = new Dictionary <int, string>(); IntPtr ok; do { values.Clear(); object content; isEmptyRow = true; string str = ""; while (sheet.ReadNextCell(false)) { content = sheet.GetContent(); str = content == null ? "" : content.ToString(); if (string.IsNullOrEmpty(str) == false) { isEmptyRow = false; } values.Add(sheet.CurrentCell.ColumnIndex - 1, content == null ? null : content.ToString()); } if (isEmptyRow) { continue; } ApiSetter.ClickButton(add, hwnd, null, null); ok = IntPtr.Zero; List <IntPtr> list = ControlSorter.SortContainer(editRange); StringBuilder className = new StringBuilder(256); int index = 0; foreach (var handle in list) { className.Clear(); NativeApi.GetClassName(handle, className, 255); string classNameStr = className.ToString(); if (classNameStr.StartsWith(CCCFillManager.ComboBoxClassName)) { if (values.ContainsKey(index) && ApiSetter.IsEditable(handle)) { ApiSetter.SetComboBoxSelected(hwnd, handle, values[index]); index++; } } else if (classNameStr.StartsWith(CCCFillManager.EditClassName)) { if (values.ContainsKey(index) && ApiSetter.IsEditable(handle)) { ApiSetter.SetText(handle, values[index]); index++; } } else if (classNameStr.StartsWith(CCCFillManager.ButtonClassName)) { StringBuilder text = className.Clear(); NativeApi.GetWindowText(handle, text, 255); if (text.ToString() == "确定") { ok = handle; } else if (text.ToString() == "附件" && values.ContainsKey(index) && string.IsNullOrEmpty(values[index]) == false) { ApiSetter.ClickButton(handle, hwnd, ListenAttachWindow, new FillValue3C() { PublicAttachFile = values[index], Separators = FillParameter3C.DefaultSeparators }); } } } if (ok != IntPtr.Zero) { ApiSetter.ClickButton(ok, hwnd, null, null); } } while (sheet.ReadNextRow()); this.Main.ClickSaveButton(this.Save); return(true); } return(false); }
public override bool FillPage() { List <IntPtr> containerList; this.ReadData(); Hashtable controlGroup = new Hashtable(); IntPtr ok = IntPtr.Zero, rowNumber = IntPtr.Zero, cancel = IntPtr.Zero; foreach (var item in data) { ApiSetter.ClickButton(base.Add, base.HWnd, null, null); Page9_12_2_Relation relation = null; // 初始化填报控件 if (ok == IntPtr.Zero || cancel == IntPtr.Zero || rowNumber == IntPtr.Zero || controlGroup.Count == 0) { controlGroup.Clear(); ok = GetFillControlList(out containerList, out cancel); if (containerList == null) { return(false); } rowNumber = containerList[6]; int startIndex = 7; int count = 3; while (count > 0) { relation = new Page9_12_2_Relation(containerList, startIndex); if (relation.SeatPosDesc != null) { controlGroup.Add(relation.SeatPosDesc, relation); } count--; startIndex += 5; } } // 填写内容 if (item.SeatPosition != null) { relation = controlGroup[item.SeatPosition] as Page9_12_2_Relation; if (relation != null) { FillValue(item.RowOfSeat, rowNumber, relation, item); relation.IsUsed = true; } } // 将未填写项标为不适用 foreach (DictionaryEntry c in controlGroup) { relation = c.Value as Page9_12_2_Relation; if (relation != null && relation.IsUsed == false) { ApiSetter.ClickButton(relation.SeatPosition, 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) { relation = c.Value as Page9_12_2_Relation; if (relation != null && relation.IsUsed == false) { ApiSetter.ClickButton(relation.SeatPosition, base.HWnd, null, null); } relation.IsUsed = false; } ApiSetter.ClickButton(cancel, base.HWnd, null, null); } this.Main.ClickSaveButton(base.Save); return(true); }
public override bool DoFillWork(object str) { return(ApiSetter.CheckRadioButton(base.Hwnd, str as string) && ApiSetter.ClickButton(_okButton, base.Hwnd)); }