日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

Windows Mobile Widget Emulator

發布時間:2023/12/13 windows 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Windows Mobile Widget Emulator 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

今天Vimpyboy 在codeplex發布了Windows Mobile Widget Emulator。這是一個用來調試Windows Mobile 6.5 Widget的工具,我在做Windows Mobile 6.5 新功能widget開發 的時候就發現調試Widget很麻煩。也有想法做一個Emulator,其實這個Emulator目標很明顯,第一個目標就是實現MS Widget提供的javascript的menu對象。下面代碼來自于Windows Mobile Widget Emulator。實現menu對象。

var widget = {
menu: {
createMenuItem: function(id) {
this.id = id;
this.text = '';
this.onSelect = function() { };

return this;
},
setSoftKey: function(menuItem, idx) {
var menuItemCopy = menuItem.Copy();

if (idx == 1) {
var el = window.parent.document.getElementById('leftMenu');

var newItem = window.parent.document.createElement('li');
var newLink = window.parent.document.createElement('a');

newLink.onclick = function() {
menuItemCopy.onSelect()
};
newLink.href = '#';
newLink.innerHTML = menuItemCopy.text;

newItem.appendChild(newLink);
el.insertBefore(newItem, el.firstChild);

return this;
}
else {
var el = window.parent.document.getElementById('rightMenu');
var arrlength = widget.menu.menuItems.length;

var newItem = window.parent.document.createElement('li');
var newLink = window.parent.document.createElement('a');

newLink.onclick = function() {
menuItemCopy.onSelect()
};

newLink.setAttribute('id', 'widgetmenu-' + arrlength);
newLink.href = '#';
newLink.innerHTML = menuItemCopy.text;

widget.menu.menuItems[arrlength] = menuItemCopy;

newItem.appendChild(newLink);
el.insertBefore(newItem, el.firstChild);

return this;
}
},
append: function(menuItem) {
widget.menu.setSoftKey(menuItem);
},
clear: function() {
var el = window.parent.document.getElementById('rightMenu');
el.innerHTML = '';
},
leftSoftKeyIndex: 1,
menuItems: []
},
preferenceForKey: function(key) {
if (document.cookie.length > 0) {
idx = document.cookie.indexOf(key + '=');
if (idx != -1) {
idx = idx + key.length + 1;
idxlast = document.cookie.indexOf(';', idx);

if (idxlast == -1) idxlast = document.cookie.length;

return unescape(document.cookie.substring(idx, idxlast));
}
}
return '';
},
setPreferenceForKey: function(value, key) {

if (!key) return;

if (!value && key) {
var d = new Date();
var c = document.cookie.split(";");

for (var i = 0; i < c.length; i++) {
document.cookie = c[i] + "; expires =" + d.toGMTString();
}

return;
}

var saveValue = value;

if (value.text) saveValue = value.text;

if (value.value) saveValue = value.value;

if (saveValue.length == undefined || saveValue.length < 1) return;
if (saveValue.length == undefined || saveValue < 1) return;

var exdate = new Date();
exdate.setFullYear(2020, 12, 31);

document.cookie = key + '=' + escape(saveValue) + ';expires=' + exdate.toGMTString();
},
authorEmail: 'Placeholder: E-mail address of author.',
authorName: 'Placeholder: Name of author.',
authorURL: 'Placeholder: Web site URL for author.',
currentIcon: {
height: 100,
src: 'icon.png',
width: 100
},
description: 'Placeholder: Description of widget.',
height: 'Placeholder: Height of widget.',
identifier: 'Placeholder: A unique identifier for the widget.',
locale: 'Placeholder: Locale of widget.',
name: 'Placeholder: Name of widget.',
version: 'Placeholder: Version of widget.',
width: 'Placeholder: Width of widget.'
};

?

第二個目標是可以動態調整resolution。Windows Mobile Widget Emulator也實現了,和我想法是一樣的。

?

?

?

我當初的想法是直接使用MS 的emulator的圖片,這些圖片保存在C:\Program Files\Windows Mobile 6 SDK\PocketPC\DeviceemulationV650下,而且每個emulator都有XML定義文件,可以直接取出這些定義文件和圖片進行resolution的選擇。

?

第三個要實現的目標是,不需要修改開發中的widget的源代碼,直接可以調試。這個我想比較難實現,我開始想用firefox的addon來實現,可是firefox的javascript和ie有區別,在ff調試通過不一定在ie能用,可能做ie的addon可以解決這個問題。

Windows Mobile Widget Emulator也沒有解決這個問題,需要修改iframe和增加一個javascript的引用。原文如下

How to use

Put your widget in a new folder in the widgets folder.
Modify the iframe in index.html to show your widget.
Add this code to the html file used by your widget:
<script src="http://www.cnblogs.com/assets/Widget.js" type="text/javascript"></script>

Anyway,很高興Windows Mobile Widget Emulator的發布。以后開發widget我會使用他進行調試。


  • 轉載于:https://www.cnblogs.com/procoder/archive/2009/08/07/1540967.html

    總結

    以上是生活随笔為你收集整理的Windows Mobile Widget Emulator的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。