本文整理匯總了TypeScript中wing.window類的典型用法代碼示例。如果您正苦於以下問題:TypeScript window類的具體用法?TypeScript window怎麽用?TypeScript window使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了window類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: activate
export function activate(context: wing.ExtensionContext) {
console.log('activate');
let html = wing.Uri.file(path.join(context.extensionPath, 'web/index.html'));
wing.window.webviews.forEach(webview => {
webviewAdded(webview);
});
wing.window.onDidCreateWebView((webview) => {
webviewAdded(webview);
});
wing.window.onDidDeleteWebView((webview) => {
webviewRemoved(webview);
});
// wing.commands.registerCommand('extension.previewWebView', () => {
// previewWebView(html);
// });
// hello
wing.commands.registerCommand('extension.showNewTsClassPopup', () => {
showWebViewPopup(html);
});
}
示例2: action
export function action(): void {
wing.window.showInformationMessage("This is an info message");
wing.window.showErrorMessage("This is an error message");
wing.window.showWarningMessage('This is a warn message');
wing.window.showInformationMessage('This is a info message with callback', 'Show Again').then(value => {
if (value == 'Show Again') {
wing.window.showInformationMessage('Show Again');
}
});
}
示例3: 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'))
};
});
}
示例4: 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)));
});
}
示例5:
wing.workspace.openTextDocument(fileName).then(doc => {
console.log('ext - openTextDocument');
console.log(doc);
wing.window.showTextDocument(doc, wing.ViewColumn.One);
// 直接發送消息
// 如果當前已經打開了要替換的文檔,onDidOpenTextDocument不會觸發,窗口就沒法關閉
webview.send('openTextDocumentSuccess');
});;
示例6: showFileName
function showFileName(context) {
wing.window.showInformationMessage('showFileName');
let editor = wing.window.activeTextEditor;
if (!editor) {
return;
}
let doc = editor.document;
let fileName = doc.fileName;
wing.window.showInformationMessage(fileName);
// if (fileName.indexOf('.psd')>=0 || fileName.indexOf('.psb')>=0) {
// // wing.window.showInformationMessage('obj file');
// _fileName = fileName;
// let html = wing.Uri.file(path.join(context.extensionPath, 'web/index.html'));
// // showWebViewPopup(html);
// previewWebView(html);
// }
}
示例7: run
function run() {
var items: ActionQuickPickItem[] = [];
items.push({ label: "1.Show Message", description: "", action: showMessage.action });
items.push({ label: "2.Show Popup", description: "", action: showPopup.action });
wing.window.showQuickPick(items).then((item) => {
if (item) {
item.action();
}
});
}
示例8: activate
export function activate(context: wing.ExtensionContext) {
let html = wing.Uri.file(path.join(context.extensionPath, 'web/index.html'));
wing.window.webviews.forEach(webview => {
webviewAdded(webview);
});
wing.window.onDidCreateWebView((webview) => {
webviewAdded(webview);
});
wing.window.onDidDeleteWebView((webview) => {
webviewRemoved(webview);
});
wing.commands.registerCommand('extension.newUiStoryboard', () => {
previewWebView(html);
});
wing.commands.registerCommand('extension.showWebViewPopup', () => {
showWebViewPopup(html);
});
}
示例9: 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
});
}
示例10: 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"]);
})
}