private void BaseDialogNative_FolderNameChanged(BaseDialogNative sender, string folderName) { if (mSourceControl != null) { mSourceControl.OnFolderNameChanged(folderName); } }
private void BaseDialogNative_FilesSelectedChanged(BaseDialogNative sender, IntPtr handle) { if (mSourceControl != null) { mSourceControl.OnFilesSelectedHandle(handle); } }
private void BaseDialogNative_FileNameChanged(BaseDialogNative sender, string filePath) { if (mSourceControl != null) { mSourceControl.OnFileNameChanged(filePath); } }
public void Dispose() { ReleaseHandle(); if (BaseDialogNative != null) { BaseDialogNative.FileNameChanged -= BaseDialogNative_FileNameChanged; BaseDialogNative.FolderNameChanged -= BaseDialogNative_FolderNameChanged; BaseDialogNative.FilesSelected -= BaseDialogNative_FilesSelectedChanged; BaseDialogNative.Dispose(); } }
private bool OpenFileDialogEnumWindowCallBack(IntPtr hwnd, int lParam) { StringBuilder className = new StringBuilder(256); NativeMethods.GetClassName(hwnd, className, className.Capacity); int controlID = NativeMethods.GetDlgCtrlID(hwnd); WINDOWINFO windowInfo; NativeMethods.GetWindowInfo(hwnd, out windowInfo); if (className.ToString().StartsWith("#32770")) { BaseDialogNative = new BaseDialogNative(hwnd); BaseDialogNative.FileNameChanged += BaseDialogNative_FileNameChanged; BaseDialogNative.FolderNameChanged += BaseDialogNative_FolderNameChanged; BaseDialogNative.FilesSelected += BaseDialogNative_FilesSelectedChanged; return(true); } switch ((ControlsID)controlID) { #region 隐藏的窗口 case ControlsID.CheckBoxReadOnly: { mChkReadOnly = hwnd; mChkReadOnlyInfo = windowInfo; NativeMethods.ShowWindow(hwnd, NativeMethods.SW_HIDE); break; } case ControlsID.LabelFileType: { mLabelFileType = hwnd; mLabelFileTypeInfo = windowInfo; NativeMethods.ShowWindow(hwnd, NativeMethods.SW_HIDE); break; } case ControlsID.ComboFileType: { mComboExtensions = hwnd; mComboExtensionsInfo = windowInfo; NativeMethods.ShowWindow(hwnd, NativeMethods.SW_HIDE); break; } case ControlsID.ComboFileName: { if (className.ToString().ToLower() == "comboboxex32") { mComboFileName = hwnd; mComboFileNameInfo = windowInfo; NativeMethods.ShowWindow(hwnd, NativeMethods.SW_HIDE); } break; } case ControlsID.ButtonOpen: { mOpenButton = hwnd; mOpenButtonInfo = windowInfo; break; } #endregion 隐藏的窗口 case ControlsID.ButtonHelp: { mHelpButton = hwnd; mHelpButtonInfo = windowInfo; NativeMethods.SetWindowText(hwnd, Lable_SelectTexg); break; } case ControlsID.DefaultView: mListViewPtr = hwnd; NativeMethods.GetWindowInfo(hwnd, out mListViewInfo); if (mSourceControl.DefaultViewMode != FolderViewMode.Default) { NativeMethods.SendMessage(mListViewPtr, (int)Msg.WM_COMMAND, (int)mSourceControl.DefaultViewMode, 0); } break; case ControlsID.ComboFolder: mComboFolders = hwnd; mComboFoldersInfo = windowInfo; break; case ControlsID.GroupFolder: mGroupButtons = hwnd; mGroupButtonsInfo = windowInfo; break; case ControlsID.LeftToolBar: mToolBarFolders = hwnd; mToolBarFoldersInfo = windowInfo; break; case ControlsID.ButtonCancel: { mCancelButton = hwnd; mCancelButtonInfo = windowInfo; NativeMethods.SetWindowText(hwnd, Lable_CancelText); break; } case ControlsID.LabelFileName: { mLabelFileName = hwnd; mLabelFileNameInfo = windowInfo; NativeMethods.SetWindowText(hwnd, Lable_OpenFloder); break; } } return(true); }