예제 #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();
         }
     }
 }
예제 #2
0
        public override bool DoFillWork(object state)
        {
            string fileName = state as string;

            ApiSetter.SetText(this.fileName, fileName);
            ApiSetter.ClickButton(okButton, base.HWnd, null, null);
            return(true);
        }
예제 #3
0
 public override bool DoFillWork(object state)
 {
     if (_okButton == IntPtr.Zero)
     {
         return(false);
     }
     return(ApiSetter.ClickButton(_okButton, base.HWnd, null, null));
 }
예제 #4
0
        public override bool DoFillWork(object propertyAndCategory)
        {
            string[] values = propertyAndCategory as string[];
            if (values == null || values.Length != 2)
            {
                return(false);
            }
            bool result = ApiSetter.CheckRadioButton(_category, values[0]) && ApiSetter.CheckRadioButton(_property, values[1]);

            return(result && ApiSetter.ClickButton(_okButton, base.HWnd, ConfirmInfoTip, null));
        }
예제 #5
0
파일: InputFileName.cs 프로젝트: hoku850/C-
        public override bool DoFillWork(object fileName)
        {
            FillValue3C value = fileName as FillValue3C;

            if (value == null || value.Value == null || _editHandle == IntPtr.Zero || _okButtonHandle == IntPtr.Zero)
            {
                return(false);
            }
            ApiSetter.SetText(_editHandle, value.Value);
            return(ApiSetter.ClickButton(_okButtonHandle, base.HWnd, null, null));
        }
예제 #6
0
        public override bool DoFillWork(object fillValue)
        {
            bool        result = false;
            FillValue3C value  = fillValue as FillValue3C;

            if (value != null)
            {
                result = ApiSetter.SetComboBoxSelected(base.HWnd, _comboBoxHandle, value.Value, true);
            }
            ApiSetter.ClickButton(_okBtnHandle, base.HWnd, StartFillSelectFirm, this.FillValue);
            return(result);
        }
예제 #7
0
        public unsafe override bool DoFillWork(object state)
        {
            NativeApi.SendMessage(_listBox, WMMSG.WM_SETFOCUS, 0, 0);
            uint msg   = WMMSG.LB_SETCURSEL;
            long style = NativeApi.GetWindowLong(_listBox, -16);

            if ((style & ListBoxStyles.LBS_MULTIPLESEL) == ListBoxStyles.LBS_MULTIPLESEL)
            {
                msg = WMMSG.LB_SETSEL;
            }
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.Value == null || fillValue.Separators == null || fillValue.Separators.Length < 1)
            {
                return(false);
            }
            string[] values = fillValue.Value.Split(fillValue.Separators[0]);
            if (values == null)
            {
                return(false);
            }
            int           count = NativeApi.SendMessage(_listBox, WMMSG.LB_GETCOUNT, 0, 0).ToInt32();
            StringBuilder text  = new StringBuilder(256);

            for (int i = 0; i < count; i++)
            {
                RECT   rect;
                IntPtr result = NativeApi.SendMessage(_listBox, WMMSG.LB_GETTEXT, i, text);
                if (values.Contains(text.ToString()))
                {
                    IntPtr checkedIndex = NativeApi.SendMessage(_listBox, msg, i, 0);
                    if (checkedIndex.ToInt32() == -1)
                    {
                        continue;
                    }
                    //NativeApi.SendMessage(base.HWnd, WMMSG.WM_COMMAND, (_listBox.ToInt32() & 0xFFFF | 0x10000), _listBox.ToInt32());
                    NativeApi.SendMessage(_listBox, WMMSG.LB_GETITEMRECT, i, ((IntPtr)(&rect)).ToInt32());
                    if (fillValue.DoubleClick)
                    {
                        NativeApi.SendMessage(_listBox, WMMSG.WM_LBUTTONDOWN, MouseVirtualKeys.None, (rect.Top << 16) | (rect.Left & 0xFFFF));
                        NativeApi.SendMessage(_listBox, WMMSG.WM_LBUTTONUP, MouseVirtualKeys.None, (rect.Top << 16) | (rect.Left & 0xFFFF));
                    }
                    NativeApi.SendMessage(_listBox, WMMSG.WM_LBUTTONDOWN, MouseVirtualKeys.None, (rect.Top << 16) | (rect.Left & 0xFFFF));
                    NativeApi.SendMessage(_listBox, WMMSG.WM_LBUTTONUP, MouseVirtualKeys.None, (rect.Top << 16) | (rect.Left & 0xFFFF));
                }
            }
            ApiSetter.ClickButton(_finishButton, base.HWnd, null, null);
            return(true);
        }
예제 #8
0
        public static bool CheckRadioButton(IntPtr _parent, string value)
        {
            StringBuilder text   = new StringBuilder(256);
            bool          result = NativeApi.EnumChildWindows(_parent, (handle, lParam) =>
            {
                text.Clear();
                NativeApi.GetWindowText(handle, text, 255);
                if (text.ToString() == value)
                {
                    IntPtr hwndParent = new IntPtr((int)NativeApi.GetWindowLong(_parent, -8));
                    NativeApi.SendMessage(handle, WMMSG.WM_SETFOCUS, 0, 0);
                    ApiSetter.ClickButton(handle, hwndParent, null, null);
                    return(false);
                }
                return(true);
            }, IntPtr.Zero);

            return(result == false);
        }
예제 #9
0
        public override bool DoFillWork(object state)
        {
            bool        result    = true;
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.Value == null || fillValue.Separators == null || fillValue.Separators.Length < 1)
            {
                return(false);
            }
            string[] values = fillValue.Value.Split(fillValue.Separators[0]);
            if (values != null)
            {
                for (int i = 0; i < radionPanels.Count && values.Length > i; i++)
                {
                    result = result && ApiSetter.CheckRadioButton(radionPanels[i], values[i]);
                }
            }
            return(result && ApiSetter.ClickButton(okButton, base.HWnd, null, null));
        }
예제 #10
0
        public override bool DoFillWork(object state)
        {
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.AttachFile == null || fillValue.Separators == null || fillValue.Separators.Length < 1)
            {
                return(false);
            }
            string[] fileNames = fillValue.AttachFile.Split(fillValue.Separators[0]);
            //bool flag = fillValue.AttachFile == fillValue.PublicAttachFile;
            foreach (string fileName in fileNames)
            {
                //string fullName = (base.Owner == null || string.IsNullOrEmpty(base.Owner.DataFilePath)) ?
                //    fileName : string.Format("{0}\\{1}", base.Owner.DataFilePath, fileName);
                //List<string> files = CheckFile(fileName, base.Owner.DataFilePath, fillValue.PublicAttachFile, flag);
                //if (files != null)
                //{
                //    foreach (var file in files)
                //    {
                string file = fileName;

                if (Path.GetFileName(fileName) == fileName)
                {
                    file = string.Format("{0}\\{1}", base.Owner.DataFilePath, fileName);
                }

                if (File.Exists(file))
                {
                    ApiSetter.ClickButton(addButton, base.HWnd, FillOpenFileDialog, file); // 点击添加按钮
                }
                else
                {
                    this.Owner.Records.Add(new FillRecord(ElementType.Unknown, RecordType.Failed, string.Format("文件 {0} 不存在", file), null));
                }
                //    }
                //}
                //else
                //    this.Owner.Records.Add(new FillRecord(ElementType.Unknown, RecordType.Failed, string.Format("文件 {0} 不存在", fullName), null));
            }
            ApiSetter.ClickButton(saveButton, base.HWnd, null, null); // 点击保存按钮
            return(true);
        }
예제 #11
0
        public unsafe override bool DoFillWork(object state)
        {
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.Value == null || fillValue.Separators == null || fillValue.Separators.Length < 1)
            {
                return(false);
            }
            string[] values = fillValue.Value.Split(fillValue.Separators[0]);
            if (values == null || values.Length == 0)
            {
                return(false);
            }
            ApiSetter.SetComboBoxSelected(base.HWnd, comboBox, values[0]);
            if (values.Length > 1)
            {
                uint msg   = WMMSG.LB_SETCURSEL;
                long style = NativeApi.GetWindowLong(listBox, -16);
                if ((style & ListBoxStyles.LBS_MULTIPLESEL) == ListBoxStyles.LBS_MULTIPLESEL)
                {
                    msg = WMMSG.LB_SETSEL;
                }
                int           count = NativeApi.SendMessage(listBox, WMMSG.LB_GETCOUNT, 0, 0).ToInt32();
                StringBuilder text  = new StringBuilder(256);
                for (int i = 0; i < count; i++)
                {
                    RECT   rect;
                    IntPtr result = NativeApi.SendMessage(listBox, WMMSG.LB_GETTEXT, i, text);
                    if (values.Contains(text.ToString()))
                    {
                        NativeApi.SendMessage(listBox, msg, i, 0);
                        NativeApi.SendMessage(listBox, WMMSG.LB_GETITEMRECT, i, ((IntPtr)(&rect)).ToInt32());
                        NativeApi.SendMessage(listBox, WMMSG.WM_LBUTTONDOWN, MouseVirtualKeys.MK_CONTROL, (rect.Top << 16) | (rect.Left & 0xFFFF));
                        NativeApi.SendMessage(listBox, WMMSG.WM_LBUTTONUP, MouseVirtualKeys.MK_CONTROL, (rect.Top << 16) | (rect.Left & 0xFFFF));
                    }
                }
                ApiSetter.ClickButton(multiInstall, base.HWnd, null, null);
            }
            return(ApiSetter.ClickButton(finish, base.HWnd, null, null));
        }
예제 #12
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);
 }
예제 #13
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);
        }
예제 #14
0
        public override bool DoFillWork(object state)
        {
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.Value == null || fillValue.Separators == null || fillValue.Separators.Length < 1)
            {
                return(false);
            }
            string[] values = fillValue.Value.Split(fillValue.Separators[0]);
            if (values == null || values.Length == 0)
            {
                return(true);
            }
            List <IntPtr> list = ControlSorter.SortContainer(_container);

            if (list == null)
            {
                return(false);
            }
            StringBuilder className = new StringBuilder(256);

            for (int i = 0; i < values.Length && i < list.Count; i++)
            {
                className.Clear();
                NativeApi.GetClassName(list[i], className, 255);
                string classNameStr = className.ToString();
                if (classNameStr.StartsWith(CCCFillManager.EditClassName))
                {
                    ApiSetter.SetText(list[i], values[i]);
                }
                else if (classNameStr.StartsWith(CCCFillManager.ComboBoxClassName))
                {
                    ApiSetter.SetComboBoxSelected(base.HWnd, list[i], values[i]);
                }
            }
            ApiSetter.ClickButton(_finishButton, base.HWnd, null, null);
            return(true);
        }
예제 #15
0
파일: InfoTips_3C.cs 프로젝트: qwdingyu/C-
 public override bool DoFillWork(object state)
 {
     return(ApiSetter.ClickButton(_okButton, base.HWnd, null, null));
 }
예제 #16
0
 public override bool DoFillWork(object firm)
 {
     return(ApiSetter.SetComboBoxSelected(base.HWnd, _comboBoxHandle, firm as string) &&
            ApiSetter.ClickButton(_okBtnHandle, base.HWnd, null, null));
 }
예제 #17
0
        private bool FillValue(string className, ref int index, IntPtr handle, FillValue3C value)
        {
            _asyncHandle.Wait();
            string parameterValue = null;

            if (value == null)
            {
                return(false);
            }
            FillParameter3C parameter = _fillParameters[value.Key] as FillParameter3C;

            if (index == -1)
            {
                parameterValue = value.Value;
            }
            else
            {
                string[] values = value.Value == null ? null : value.Value.Split(parameter.Separators[0]);
                parameterValue = (values == null || values.Length <= index) ?
                                 (string.IsNullOrEmpty(value.Note) ? "" : value.Note) : values[index];
            }
            StringBuilder text = null;

            switch (className)
            {
            case CCCFillManager.EditClassName:
                if (ApiSetter.IsEditable(handle, _handle) == false)
                {
                    index--;
                    break;
                }
                ApiSetter.SetText(handle, parameterValue);
                break;

            case CCCFillManager.ComboBoxClassName:
                if (ApiSetter.IsEditable(handle, _handle) == false)
                {
                    index--;
                    break;
                }
                ApiSetter.SetComboBoxSelected(_handle, handle, parameterValue, parameter.IsComboBoxPreciseMatch);
                break;

            case CCCFillManager.ButtonClassName:
                value.Separators = parameter.Separators;
                text             = new StringBuilder(256);
                NativeApi.GetWindowText(handle, text, 255);
                if (text.ToString() == "附件" && value != null && string.IsNullOrEmpty(value.AttachFile) == false)
                {
                    return(ApiSetter.ClickButton(handle, _handle, ListenAttachWindow, value));
                }
                else if (text.ToString() == "编辑")
                {
                    if (string.IsNullOrEmpty(value.OriginString))
                    {
                        return(false);
                    }
                    if (string.IsNullOrEmpty(parameter.EditType))
                    {
                        parameter.EditType = "add";
                    }
                    switch (parameter.EditType.ToLower())
                    {
                    case "add":
                        return(ApiSetter.ClickButton(handle, _handle, ListenAddWindow, value));

                    case "radio":
                        return(ApiSetter.ClickButton(handle, _handle, ListenRadioWindow, value));

                    case "select":
                        return(ApiSetter.ClickButton(handle, _handle, ListenListBoxWindow, value));

                    case "multiselect":
                        value.DoubleClick = true;
                        return(ApiSetter.ClickButton(handle, _handle, ListenListBoxWindow, value));

                    case "text":
                        return(ApiSetter.ClickButton(handle, _handle, ListenTextWindow, value));

                    case "column":
                        return(ApiSetter.ClickButton(handle, _handle, ListenColumnWindow, value));

                    case "multinote":
                        return(ApiSetter.ClickButton(handle, _handle, ListenMultiValueAndNoteWindow, value));

                    default:
                        return(false);
                    }
                }
                else
                {
                }
                break;
            }
            return(true);
        }
예제 #18
0
        public override bool DoFillWork(object state)
        {
            FillValue3C fillValue = state as FillValue3C;

            if (fillValue == null || fillValue.Value == null || fillValue.Separators == null || fillValue.Separators.Length < 2 || inputCount == 0)
            {
                return(false);
            }

            foreach (char c in fillValue.Separators)
            {
                fillValue.Value = fillValue.Value.Replace(c, ',');
            }
            List <string[]> values = new List <string[]>();

            string[] array = fillValue.Value.Split(new char[] { ',' }, StringSplitOptions.None);
            string[] group = null;
            for (int i = 0; i < array.Length; i++)
            {
                int mod = (i % inputCount);
                if (mod == 0)
                {
                    group = new string[inputCount];
                    values.Add(group);
                }
                group[mod] = array[i];
            }
            //List<string[]> values = new List<string[]>();
            //foreach (var item in fillValue.Value.Split(fillValue.Separators[1]))
            //{
            //    values.Add(item.Split(fillValue.Separators[0]));
            //}
            bool          result    = true;
            StringBuilder className = new StringBuilder(256);

            for (int index = 0; index < values.Count && current != IntPtr.Zero; index++)
            {
                List <IntPtr> sorted = ControlSorter.SortContainer(current);
                if (sorted != null)
                {
                    string[] parametrValues = values[index];
                    for (int i = 0; i < sorted.Count && parametrValues.Length > i; i++)
                    {
                        NativeApi.GetClassName(sorted[i], className, 255);
                        string classNameStr = className.ToString();
                        if (classNameStr.StartsWith(CCCFillManager.EditClassName))
                        {
                            ApiSetter.SetText(sorted[i], parametrValues[i]);
                        }
                        else if (classNameStr.StartsWith(CCCFillManager.ComboBoxClassName))
                        {
                            ApiSetter.SetComboBoxSelected(base.HWnd, sorted[i], parametrValues[i]);
                        }
                    }
                }
                if (index < values.Count - 1)
                {
                    ApiSetter.ClickButton(addButton, base.HWnd, null, null);
                }
                current = NativeApi.FindWindowEx(container, current, null, null);
            }
            return(result && ApiSetter.ClickButton(saveButton, base.HWnd, null, null));
        }