Esempio n. 1
0
 internal void ClickSaveButton(IntPtr saveButton, bool selectNextNode)
 {
     if (saveButton != IntPtr.Zero)
     {
         ApiSetter.ClickButton(saveButton, _handle, (state) =>
         {
             SaveDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.SaveWindow, this, processId) as SaveDialog_3C;
             if (string.IsNullOrEmpty(fill.Message) || fill.Message.Contains("保存成功") == false)
             {
                 _state = FillState.Waiting;
                 if (_asyncHandle != null)
                 {
                     _asyncHandle.Reset();
                 }
             }
             else
             {
                 fill.DoFillWork(null);
                 if (selectNextNode)
                 {
                     this.SelectNextNode(true);
                 }
             }
         }, null);
     }
     else
     {
         _state = FillState.Waiting;
         if (_asyncHandle != null)
         {
             _asyncHandle.Reset();
         }
     }
 }
Esempio n. 2
0
        private static FillDialog_3C GetAttachWindow(uint processId)
        {
            FillDialog_3C current = null;
            StringBuilder text    = new StringBuilder(256);

            do
            {
                System.Threading.Thread.Sleep(500);
                NativeApi.EnumWindows((hwnd, lparam) =>
                {
                    text.Clear();
                    uint currentProcessId = 0;
                    NativeApi.GetWindowThreadProcessId(hwnd, out currentProcessId);
                    if (currentProcessId == processId)
                    {
                        long style = NativeApi.GetWindowLong(hwnd, -16);
                        if ((style & WindowStyles.WS_VISIBLE) != WindowStyles.WS_VISIBLE)
                        {
                            return(true);
                        }
                        NativeApi.GetWindowText(hwnd, text, 255);
                        if (text.ToString() == "编辑附件")
                        {
                            current = new AttachWindow_3C(hwnd);
                            current.InitHandle();
                            return(false);
                        }
                    }
                    return(true);
                }, IntPtr.Zero);
            } while (_run && (current == null || current.IsValidWindow() == false));
            return(current);
        }
Esempio n. 3
0
        public static FillDialog_3C GetFillDialog(out string windowType, uint processId)
        {
            windowType = null;
            FillDialog_3C current = null;
            IntPtr        hwnd    = GetWindowHandle(IntPtr.Zero, processId);

            current = new Login_3C(hwnd);
            current.InitHandle();
            if (current.IsValidWindow() == false)
            {
                current = new SelectFirmRelation_3C(hwnd);
                current.InitHandle();
                if (current.IsValidWindow() == false)
                {
                    return(null);
                }
                else
                {
                    windowType = CCCWindowType.FirmWindow;
                    return(current);
                }
            }
            else
            {
                windowType = CCCWindowType.LoginWindow;
                return(current);
            }
        }
Esempio n. 4
0
        private void ConfirmInfoTip(object state)
        {
            uint processId;

            NativeApi.GetWindowThreadProcessId(base.HWnd, out processId);
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.InfoTipWindow, base.HWnd, processId);

            fill.DoFillWork(null);
        }
Esempio n. 5
0
        public static FillDialog_3C GetFillDialog(string type, Main_3C main, uint processId)
        {
            FillDialog_3C current = GetFillDialog(type, main == null ? IntPtr.Zero : main.Hwnd, processId);

            if (current != null)
            {
                current.Owner = main;
            }
            return(current);
        }
Esempio n. 6
0
        /// <summary>
        /// 对指定节点进行追加。
        /// </summary>
        /// <param name="node">要对其进行追加的节点句柄。</param>
        /// <param name="name">追加的节点的后缀名称。</param>
        public void AppendNode(IntPtr node, string name)
        {
            this.ClickAppendMenu(node);
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.InputFileNameWindow, this, processId);

            fill.DoFillWork(new FillValue3C()
            {
                Value = name
            });
        }
Esempio n. 7
0
        /// <summary>
        /// 监听输入文件名窗口。
        /// </summary>
        /// <param name="value"></param>
        private void ListenInputFileNameWindow(object value)
        {
            _asyncHandle.Reset();
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.InputFileNameWindow, this, processId);

            fill.DoFillWork(_pageData["文件名"]);
            if (_asyncHandle != null)
            {
                _asyncHandle.Resume();
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 监听Select类型窗口。
        /// </summary>
        /// <param name="value"></param>
        private void ListenListBoxWindow(object value)
        {
            _asyncHandle.Reset();
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.ListCheckBoxWindow, this, processId);

            fill.DoFillWork(value);
            if (_asyncHandle != null)
            {
                _asyncHandle.Resume();
            }
        }
Esempio n. 9
0
        private void ListenMultiValueAndNoteWindow(object value)
        {
            _asyncHandle.Reset();
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.MultiValueAndNote, this, processId);

            fill.DoFillWork(value);
            if (_asyncHandle != null)
            {
                _asyncHandle.Resume();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 监听附件窗口
        /// </summary>
        /// <param name="value"></param>
        internal void ListenAttachWindow(object value)
        {
            _asyncHandle.Reset();
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.AttachWindow, this, processId);

            fill.DoFillWork(value);
            if (_asyncHandle != null)
            {
                _asyncHandle.Resume();
            }
        }
Esempio n. 11
0
        private void StartFillSelectFirm(object state)
        {
            FillValue3C value = state as FillValue3C;

            if (value != null)
            {
                uint processId;
                NativeApi.GetWindowThreadProcessId(base.HWnd, out processId);
                FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.FirmWindow, processId);
                fill.DoFillWork(value.Value);
            }
        }
Esempio n. 12
0
        private void FillOpenFileDialog(object fileName)
        {
            uint processId;

            NativeApi.GetWindowThreadProcessId(addButton, out processId);
            FillDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.OpenFileWindow, processId);

            if (fill != null)
            {
                fill.DoFillWork(fileName);
            }
        }
Esempio n. 13
0
        public static Main_3C GetMainWindow(string dataFileName, uint processId)
        {
            IntPtr        hwnd  = IntPtr.Zero;
            StringBuilder title = new StringBuilder(256);

            do
            {
                System.Threading.Thread.Sleep(500);
                hwnd = FillDialog_3C.GetWindowHandle(IntPtr.Zero, processId);
                NativeApi.GetWindowText(hwnd, title, 255);
            } while (hwnd == IntPtr.Zero || title.ToString().StartsWith("机动车产品强制认证参数申报管理系统客户端") == false);

            return(new Main_3C(hwnd, dataFileName, processId));
        }
Esempio n. 14
0
        /// <summary>
        /// 监听询问是否保存窗口。
        /// </summary>
        /// <param name="value">当前选择的节点文本。</param>
        internal static void ListenSaveRequireWindow(object value)
        {
            Main_3C main = value as Main_3C;

            while (_run)
            {
                SaveRequireWindow fill    = FillDialog_3C.GetSaveRequireWindow(main, main.ProcessId);
                string            message = string.Format("是否保存{0}数据?", main.SelectedText);
                if (fill != null && fill.Message != null && fill.Message == message)
                {
                    fill.DoFillWork(value);
                }
            }
        }
Esempio n. 15
0
 public override bool DoFillWork(object val)
 {
     if (_yesBtn == IntPtr.Zero)
     {
         return(false);
     }
     ApiSetter.ClickButton(_yesBtn, base.HWnd, (state) =>
     {
         SaveDialog_3C fill = FillDialog_3C.GetFillDialog(CCCWindowType.SaveWindow, base.Owner, base.Owner.ProcessId) as SaveDialog_3C;
         if (string.IsNullOrEmpty(fill.Message) || fill.Message.Contains("保存成功") == false)
         {
             base.Owner.Reset();
         }
         else
         {
             fill.DoFillWork(null);
             base.Owner.SelectNextNode(true);
         }
     }, null);
     base.Owner.ClickSaveButton(_yesBtn, true);
     return(true);
 }
Esempio n. 16
0
 public override void EndFill()
 {
     try
     {
         if (main != null)
         {
             main.Dispose();
         }
         this.DataProvider.Clean();
         //if (_fillThread != null)
         //    _fillThread.Abort();
     }
     catch
     {
     }
     finally
     {
         _fillThread = null;
         main        = null;
         _data.Clear();
         FillDialog_3C.EndListen();
     }
 }
Esempio n. 17
0
        private void GetTreeView()
        {
            treeView = main.TreeView;
            FillDialog_3C dialog = null;

            dialog = FillDialog_3C.GetFillDialog(CCCWindowType.PropertyWindow, main, this.processId);
            string category = _data["车辆类别"] == null ? "" : (_data["车辆类别"] as FillValue3C).Value;
            string property = _data["车辆属性"] == null ? "" : (_data["车辆属性"] as FillValue3C).Value;

            dialog.DoFillWork(new string[] { category, property });
            dialog = FillDialog_3C.GetFillDialog(CCCWindowType.InputFileNameWindow, main, this.processId);
            dialog.DoFillWork(new FillValue3C()
            {
                Value = Guid.NewGuid().ToString()
            });
            uint count = 0;

            while (count == 0)
            {
                count = treeView.GetCount();
                System.Threading.Thread.Sleep(500);
            }
        }
Esempio n. 18
0
        private void FillWorker(object state)
        {
            string        windowType = null;
            FillDialog_3C fill       = FillDialog_3C.GetFillDialog(out windowType, processId);

            try
            {
                // 存储数据文件所在目录下的所有文件(不包括子文件夹中的文件)
                _fillParameters = this.ReadFillParameter(state as string);
                TreeValue root = ReadAndConvertData();
                windowType = null;
                FillDialog_3C.BeginListen();
                fill = FillDialog_3C.GetFillDialog(out windowType, processId);
                if (fill != null)
                {
                    if (windowType == CCCWindowType.LoginWindow)
                    {
                        fill.FillValue = _data["厂商关系"] as FillValue3C;
                        fill.DoFillWork(_data["登录证书"]);
                    }
                    else if (windowType == CCCWindowType.FirmWindow)
                    {
                        FillValue3C value = _data["厂商关系"] as FillValue3C;
                        fill.DoFillWork(value == null ? "" : value.Value);
                    }
                }

                main = Main_3C.GetMainWindow(base.DataProvider.DataSourceFile, processId);
                //this.SetWindowPos();
                //main.FileTable = this.files;
                main.FillParameters = this._fillParameters;
                main.Records        = this._records;
                if (main.TreeView.GetCount() == 0)
                {
                    this.GetTreeView();
                }
                else
                {
                    main.UpdateSelectedNode();
                }
                main.TreeValue = root;
                FillDialog_3C.BeginListenSaveRequire(main);
                do
                {
                    System.Threading.Thread.Sleep(200);
                    main.FillPage();
                } while (main.SelectNextNode(true));
                this.EndFill();
                OnFinished(EventArgs.Empty);
                WebFillManager.ShowMessageBox("填报完成!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                if (main != null)
                {
                    LogHelper.Write(ex);
                    MessageBox.Show(ex.StackTrace + ex.Message);
                    this.EndFill();
                }
            }
        }
Esempio n. 19
0
        public static FillDialog_3C GetFillDialog(string type, IntPtr owner, uint processId)
        {
            IntPtr        hwnd    = IntPtr.Zero;
            FillDialog_3C current = null;

            if (type == CCCWindowType.AttachWindow)
            {
                current = GetAttachWindow(processId);
            }
            else if (type == CCCWindowType.SaveWindow)
            {
                current = GetSaveDialog(processId);
            }
            else
            {
                do
                {
                    System.Threading.Thread.Sleep(500);
                    hwnd = GetWindowHandle(owner, processId);
                    switch (type)
                    {
                    case CCCWindowType.AddWindow:
                        current = new AddWindow(hwnd);
                        break;

                    case CCCWindowType.FirmWindow:
                        current = new SelectFirmRelation_3C(hwnd);
                        break;

                    case CCCWindowType.InfoTipWindow:
                        current = new InfoTips_3C(hwnd);
                        break;

                    case CCCWindowType.InputFileNameWindow:
                        current = new InputFileName_3C(hwnd);
                        break;

                    case CCCWindowType.ListCheckBoxWindow:
                        current = new CheckListBox_3C(hwnd);
                        break;

                    case CCCWindowType.LoginWindow:
                        current = new Login_3C(hwnd);
                        break;

                    case CCCWindowType.MultiValueAndNote:
                        current = new AddValueAndNote(hwnd);
                        break;

                    case CCCWindowType.OpenFileWindow:
                        current = new OpenFileDialog_3C(hwnd);
                        break;

                    case CCCWindowType.PropertyWindow:
                        current = new SelectProperty_3C(hwnd);
                        break;

                    case CCCWindowType.RadioWindow:
                        current = new RadioButtonWindow(hwnd);
                        break;

                    case CCCWindowType.TextWindow:
                        current = new TextEditWindow(hwnd);
                        break;

                    case CCCWindowType.ColumnWindow:
                        current = new ColumnWindow(hwnd);
                        break;
                    }
                    if (current != null)
                    {
                        current.InitHandle();
                    }
                } while (_run && (hwnd == IntPtr.Zero || current == null || current.IsValidWindow() == false));
            }
            return(current);
        }