增加说明文件.

增加目录选择
增加文件选择
This commit is contained in:
JackLee 2026-04-08 22:27:42 +08:00
parent efff16f328
commit 3c6329c251
4 changed files with 49 additions and 35 deletions

View File

@ -0,0 +1,8 @@
该目录主要用户检测设备得分辨率,通过分辨率计算出主窗口得大小,实现动态实时尺寸<br>
当前进度:<br>
支持默认0显示物理设备的分辨率获取.<br>
开发中:<br>
支持多物理设备的分辨率获取,同时要求支持建模画面进行流转功能,且扭转的组件只能为XCom组件.
需要将XCom组件寄生于一个page中进行流转,不流转软件所有界面本身.防止其他设备性能过低导致卡顿问题.<br>

View File

@ -12,7 +12,7 @@ export struct SWNewFile {
Column({ space: 5 }) { Column({ space: 5 }) {
Row(){ Row(){
Text('保存目录:').width('10%') Text('保存目录:').width('10%')
TextInput().width('80%') TextInput({placeholder:this.message}).width('80%')
Button('选择目录') Button('选择目录')
.width('10%') .width('10%')
.backgroundColor($r('sys.color.background_secondary')) .backgroundColor($r('sys.color.background_secondary'))
@ -24,44 +24,45 @@ export struct SWNewFile {
let context = getContext(this) as common.Context; let context = getContext(this) as common.Context;
try { try {
const documentSelectOptions = new picker.DocumentSelectOptions(); const documentSelectOptions = new picker.DocumentSelectOptions();
documentSelectOptions.selectMode = picker.DocumentSelectMode.FOLDER;
const documentPicker = new picker.DocumentViewPicker(context); const documentPicker = new picker.DocumentViewPicker(context);
documentPicker.select(documentSelectOptions).then((documentSelectResult: Array<string>) => { documentPicker.select(documentSelectOptions).then((documentSelectResult: Array<string>) => {
this.message = JSON.stringify(documentSelectResult); this.message =documentSelectResult.toString();
if (documentSelectResult.length === 0) { if (documentSelectResult.length === 0) {
return; return;
} }
this.getUIContext().showAlertDialog( // this.getUIContext().showAlertDialog(
{ // {
title: '文件路径', // title: '文件路径',
message: this.message, // message: this.message,
autoCancel: true, // autoCancel: true,
alignment: DialogAlignment.Center, // alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 }, // offset: { dx: 0, dy: -20 },
gridCount: 3, // gridCount: 3,
width: 300, // width: 300,
height: 300, // height: 300,
cornerRadius: $r('sys.float.corner_radius_level7'), // cornerRadius: $r('sys.float.corner_radius_level7'),
borderWidth: 1, // borderWidth: 1,
borderStyle: BorderStyle.Dashed, // borderStyle: BorderStyle.Dashed,
borderColor: Color.Blue, // borderColor: Color.Blue,
backgroundColor: Color.White, // backgroundColor: Color.White,
textStyle: { wordBreak: WordBreak.BREAK_ALL }, // textStyle: { wordBreak: WordBreak.BREAK_ALL },
confirm: { // confirm: {
value: '确定', // value: '确定',
action: () => { // action: () => {
console.log('Confirm button is clicked.'); // console.log('Confirm button is clicked.');
}, // },
}, // },
onWillDismiss: (dismissDialogAction: DismissDialogAction) => { // onWillDismiss: (dismissDialogAction: DismissDialogAction) => {
if (dismissDialogAction.reason === DismissReason.PRESS_BACK) { // if (dismissDialogAction.reason === DismissReason.PRESS_BACK) {
dismissDialogAction.dismiss(); // dismissDialogAction.dismiss();
} // }
if (dismissDialogAction.reason === DismissReason.TOUCH_OUTSIDE) { // if (dismissDialogAction.reason === DismissReason.TOUCH_OUTSIDE) {
dismissDialogAction.dismiss(); // dismissDialogAction.dismiss();
} // }
} // }
} // }
) // )
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {
console.error(`DocumentViewPicker.select failed with err: ${err.code}, ${err.message}`); console.error(`DocumentViewPicker.select failed with err: ${err.code}, ${err.message}`);
}); });
@ -73,7 +74,7 @@ export struct SWNewFile {
}.height('5%') }.height('5%')
Row(){ Row(){
Text('文件名:') Text('文件名:')
TextInput() TextInput({placeholder:'model.prt'})
}.height('5%') }.height('5%')
Blank().height('85%') Blank().height('85%')
Row(){ Row(){

View File

@ -0,0 +1,5 @@
该目录主要针对运行环境得检测<br>
CheckDriver 用于检测运行设备,设备区分平板和PC <br>
CheckDispMode 用于检测设备窗口运行模式,这里分为自由多窗.要求用户强制使用自由多窗获取更好建模体验 <br>
同时该目录具备一个监听功能,发现用户修改模式后,实时弹出提醒.<br>