本文整理汇总了TypeScript中wing.window.showPopup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript window.showPopup方法的具体用法?TypeScript window.showPopup怎么用?TypeScript window.showPopup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wing.window
的用法示例。
在下文中一共展示了window.showPopup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: show
export function show(): void {
wing.window.showPopup<IFormOptions>(PopupType.Form, new Store(properties, scheme), {
title: '表单例子'
}).then((result) => {
result && wing.window.showInformationMessage(JSON.stringify(result.getProperties(true)));
});
}
示例2: provideTSClass
function provideTSClass(context: wing.TemplateFileContext, token: wing.CancellationToken): Thenable<wing.ITemplateFile> {
let asClassStore = new wing.Store(null, {
className: {
type: 'string',
title: '类名',
required: true
},
moduleName: {
type: 'string',
title: '模块名'
}
});
return wing.window.showPopup<wing.IFormOptions>(wing.PopupType.Form, asClassStore, {
title: '新建 TypeScript 类'
}).then(store => {
if (!store) {
return null;
}
let className = store.getValue('className');
return {
filename: className + '.ts',
content: getTSClassContent(className, store.getValue('moduleName'))
};
});
}
示例3: showWebViewPopup
function showWebViewPopup(html: wing.Uri) {
wing.window.showPopup<wing.IWebViewOptions>(wing.PopupType.WebView, {
uri: html
}, {
position: wing.PopupPosition.MIDDLE,
width: 600,
height: 400,
title: '测试',
movable: true,
closeButton: true,
modal: true
});
}
示例4: showWebViewPopup
function showWebViewPopup(html: wing.Uri) {
// var fileName = '/Users/guanxu/Documents/Tutorials/Game/Egret/ext-tut/ext-tut-code/src/chapters/C10_menu.ts';
// // wing.workspace.openTextDocument(wing.Uri.parse('untitled:' + fileName));
// wing.workspace.openTextDocument(fileName).then(doc => {
// console.log(doc);
// wing.window.showTextDocument(doc, wing.ViewColumn.One);
// });
// wing.window.showInformationMessage('hello');
wing.window.showPopup<wing.IWebViewOptions>(wing.PopupType.WebView, {
uri: html
}, {
position: wing.PopupPosition.MIDDLE,
width: 600,
height: 370,
title: 'New TypeScript File',
movable: true,
closeButton: true,
modal: true
});
}
示例5: doExchange
function doExchange(){
let e = wing.window.activeTextEditor;
if( !e){
wing.window.showErrorMessage("No File Selected Now");
return;
}
let filename = e.document.fileName;
let ext = path.extname(filename);
if( ext != ".exml"){
wing.window.showErrorMessage("File is not exml");
return;
}
let content = e.document.getText();
let xml = parser(content);
let isEui = is_eui(content);
baseClass = isEui ? "eui.Component" : getHostComponent(xml);
parseNS(xml);
classComponents = parseSkinConponents(xml,isEui);
let targetFileName = getTargetName(filename);
let baseName = path.basename(targetFileName);
properties = {
inputbox: targetFileName
};
className = baseName.split(".")[0];
//skinName = parseSkinname(filename);
wing.window.showPopup<IFormOptions>(PopupType.Form, new Store(properties, schema),{
title : "输出设置"
}).then((result)=>{
let settings = result.getProperties(true);
let classContent = assemble(className,baseClass,skinName,classComponents,settings);
fs.writeFileSync(settings["inputbox"],classContent,{encoding:"utf-8"});
wing.window.showInformationMessage('生成成功:'+settings["inputbox"]);
})
}
示例6: provideNodejsProject
function provideNodejsProject(context: wing.TemplateProjectContext, token: wing.CancellationToken): Thenable<wing.ITemplateProject> {
let project = new wing.Store(null, {
name: {
type: 'string',
title: '项目名称',
required: true
},
dir: {
type: 'string',
title: '项目路径',
required: true,
displayOrder: 1
},
version: {
type: 'string',
title: '版本',
default: '0.0.1',
required: true,
displayOrder: 2
},
license: {
type: 'string',
title: '许可协议',
enum: ['MIT', 'ISC', 'BSD', 'GPL'],
default: 'MIT',
displayOrder: 3
}
});
return wing.window.showPopup<wing.IFormOptions>(wing.PopupType.Form, project, {
title: '创建 NodeJS 项目'
}).then(store => {
if (!store) {
return null;
}
let projectName = store.getValue('name');
let projectDir = store.getValue('dir');
let projectPath = path.join(projectDir, projectName);
let packageObject = store.getProperties(true);
delete packageObject['dir'];
let packageJSON = JSON.stringify(packageObject, null, 2);
context.channel.clear();
context.channel.show();
return nfcall(fs.mkdir, projectPath).then(() => {
context.channel.appendLine('正在创建 package.json');
return nfcall(fs.writeFile, path.join(projectPath, 'package.json'), packageJSON);
}).then(() => {
context.channel.appendLine('正在创建 index.js');
return nfcall(fs.writeFile, path.join(projectPath, 'index.js'), '');
}).then(() => {
context.channel.appendLine('项目创建成功');
return { path: projectPath };
}, err => {
context.channel.appendLine('项目创建失败:' + err.message);
return null;
});
});
}