private static FillDialog_3C GetSaveDialog(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); current = new SaveDialog_3C(hwnd); current.InitHandle(); if (current.IsValidWindow()) { return(false); } } return(true); }, IntPtr.Zero); } while (_run && (current == null || current.IsValidWindow() == false)); return(current); }
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(); } } }
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); }