示例#1
0
        public static SaveRequireWindow GetSaveRequireWindow(Main_3C main, uint processId)
        {
            IntPtr            hwnd    = IntPtr.Zero;
            SaveRequireWindow current = null;

            do
            {
                System.Threading.Thread.Sleep(500);
                hwnd = GetWindowHandle(main.Hwnd, processId);
                if (hwnd != IntPtr.Zero)
                {
                    current = new SaveRequireWindow(hwnd);
                }
                if (current != null)
                {
                    current.InitHandle();
                }
            } while (_run && (hwnd == IntPtr.Zero || current == null || current.IsValidWindow() == false));
            if (current != null && current.IsValidWindow())
            {
                current.Owner = main;
                return(current);
            }
            return(null);
        }
示例#2
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);
        }
示例#3
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);
                }
            }
        }
示例#4
0
        public static bool CheckCheckBox(IntPtr _parent, Main_3C owner, string note, List <string> values)
        {
            StringBuilder text       = new StringBuilder(256);
            IntPtr        saveButton = IntPtr.Zero;
            bool          result     = NativeApi.EnumChildWindows(_parent, (handle, lParam) =>
            {
                text.Clear();
                NativeApi.GetClassName(handle, text, 255);
                if (text.ToString().StartsWith(CCCFillManager.EditClassName))
                {
                    ApiSetter.SetText(handle, note);
                    return(true);
                }
                else if (text.ToString().StartsWith(CCCFillManager.ButtonClassName))
                {
                    text.Clear();
                    NativeApi.GetWindowText(handle, text, 255);
                    int index = values.IndexOf(text.ToString());
                    if (index != -1)
                    {
                        IntPtr hwndParent = new IntPtr((int)NativeApi.GetWindowLong(_parent, -8));
                        NativeApi.SendMessage(handle, WMMSG.WM_SETFOCUS, 0, 0);
                        ApiSetter.ClickButton(handle, hwndParent, null, null);
                        values.RemoveAt(index);
                    }
                    else if (text.ToString() == "保存")
                    {
                        saveButton = handle;
                    }
                }
                return(true);
            }, IntPtr.Zero);

            if (saveButton != IntPtr.Zero)
            {
                owner.ClickSaveButton(saveButton);
            }
            return(true);
        }
示例#5
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();
     }
 }
示例#6
0
        /// <summary>
        /// 生成树结构
        /// </summary>
        public void GenerateDir()
        {
            if (main == null)
            {
                main = Main_3C.GetMainWindow("", processId);
            }
            if (main.TreeView.GetCount() == 0)
            {
                return;
            }
            TreeValue root = main.GetTreeStructure();

            using (Office.Excel.ForwardExcelWriter writer = new Office.Excel.ForwardExcelWriter("目录字典.xlsx"))
            {
                writer.Open();
                Office.Excel.ForwardWriteWorksheet sheet = writer.CreateWorksheet() as Office.Excel.ForwardWriteWorksheet;
                sheet.WriteNextRow();
                sheet.WriteTextCell(1, writer.AddSharedString("Id"));
                sheet.WriteTextCell(2, writer.AddSharedString("目录名称"));
                sheet.WriteTextCell(3, writer.AddSharedString("父级目录Id"));
                WriteTreeDir(sheet, root);
            }
        }
示例#7
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();
                }
            }
        }
示例#8
0
 internal static void BeginListenSaveRequire(Main_3C main)
 {
     System.Threading.ThreadPool.QueueUserWorkItem(ListenSaveRequireWindow, main);
 }