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也實現了,和我想法是一樣的。

?widget1

widget2

?

?

我當初的想法是直接使用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

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/247361.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/247361.shtml
英文地址,請注明出處:http://en.pswp.cn/news/247361.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

JS 常用字符串數組遍歷函數方法整理

目錄 一、concat() 二、join() 三、push() 四、pop() 五、shift() 六、unshift() 七、slice() 九、substring() 和 substr() 十、sort 排序 十一、reverse() 十二、indexOf 和 lastIndexOf 十三、every 十四、some 十五、filter 十六、map ES6新增新操作數組的…

AttributeError: Can only use .str accessor with string values, which use np.object_ dtype in pandas

忘記網址了…… 問題&#xff1a; 分析思路與解決方法&#xff1a; 轉載于:https://www.cnblogs.com/bravesunforever/p/11247988.html

vue app掃PC端二維碼登錄

通過接口獲取二維碼唯一標識&#xff0c;例如&#xff1a;qrcodeId通過 qrcodejs2插件生成 二維碼&#xff08;二維碼內容就是 qrcodeId&#xff0c;具體根據APP 需要&#xff09;循環調用接口&#xff0c;查看掃碼狀態&#xff08;app是否掃碼確認登錄&#xff09; //下載插件…

第八章 方法

1. 概述 本章重點講述類型中的各種方法&#xff0c;包括實例構造器、類型構造器、操作符/類型轉換重載、擴展方法、分部方法。 2. 名詞解釋 ① 構造器&#xff1a;是允許將類型的實例初始化為良好狀態的一種特殊方法。 3. 主要內容 3.1 實例構造器和類(引用類型) ① 創建一個引…

Java生鮮電商平臺-促銷架構以及秒殺解決方案實戰

Java生鮮電商平臺-促銷架構以及秒殺解決方案實戰 背景:隨著這幾年的電商的大熱,我們經常看到一些商家為了促銷和快速收益,紛紛推出了秒殺活動.不管是日常的超市里面的促銷,明星演唱會門票售賣,還是春節訂閱火車票,等等我們都能看到秒殺活動的影子. 1. 構建秒殺活動架構 1.1 說明…

PHP---錯誤處理(error)

錯誤的級別 1. notice&#xff1a;提示2. warning&#xff1a;警告3. error&#xff1a;致命錯誤12345 注&#xff1a;notice和warning報錯后繼續執行&#xff0c;error報錯后停止 錯誤的提示方法 方法一&#xff1a;顯示在瀏覽器上 方法二&#xff1a;記錄在日志中執行 錯…

對url給后臺傳數據的時候特殊字符需要轉義

URL中的字符只能是ASCII字符&#xff0c;但是ASCII字符比較少&#xff0c;而URL則常常包含ASCII字符集以外的字符&#xff0c;如非英語字符&#xff0c;漢字&#xff0c;特殊符號等等&#xff0c;所以要對URL進行轉換。這個過程就叫做URL編碼&#xff0c;或者叫URL轉義&#xf…

PHP Cookie處理

Cookie 是什么&#xff1f; cookie是保存在客戶端的信息包&#xff08;一個文件&#xff09; cookie 常用于識別用戶。 cookie 是一種服務器留在用戶計算機上的小文件。每當同一臺計算機通過瀏覽器請求頁面時&#xff0c;這臺計算機將會發送 cookie。通過 PHP&#xff0c;您能…

python裝飾器補充

帶參裝飾器 msg """ 1.QQ 2.wechat """ avg input(驗證方式&#xff1a;)def auth(avg):def wrapper(f):def inner(*args,**kwargs):if avg QQ:user input(name)pwd input(password)if user alex and pwd 123456:f()else:print(輸入錯誤)…

PHP-連接數據庫

1.2 連接數據庫 通過PHP做MySQL的客戶端 1.2.1 開啟mysqli擴展 在php.ini中開啟mysqli擴展 extensionphp_mysqli.dll開啟擴展后重啟服務器&#xff0c;就可以使用mysqli_函數了&#xff0c;1.2.2 連接數據庫 創建news數據庫 -- 創建表 drop table if exists news; create …

python模塊初始與time、datetime及random

模塊初始與time、datetime及random 模塊初始 模塊的概念&#xff08;本質為一個py文件&#xff09; python模塊可以將代碼量較大的程序分割成多個有組織的、彼此獨立但又能互相交互的代碼片段&#xff0c;這些自我包含的有組織 的代碼段就是模塊&#xff0c;模塊在物理形式上表…

PHP-面向對象編程教程

1.2 面向對象介紹 1.2.1 介紹 面向對象是一個編程思想。編程思想有面向過程和面向對象 面向過程&#xff1a;編程思路集中的是過程上 面向對象&#xff1a;編程思路集中在參與的對象 以去飯館吃飯為例&#xff1a; ? 面向過程&#xff1a;點菜——做菜——上菜——吃飯—…

vue-property-decorator使用指南

在Vue中使用TypeScript時&#xff0c;非常好用的一個庫&#xff0c;使用裝飾器來簡化書寫。 一、安裝 npm i -S vue-property-decorator PropPropSyncProvideModelWatchInjectProvideEmitComponent (provided by vue-class-component)Mixins (the helper function named mix…

Java生鮮電商平臺-統一異常處理及架構實戰

Java生鮮電商平臺-統一異常處理及架構實戰 補充說明&#xff1a;本文講得比較細&#xff0c;所以篇幅較長。 請認真讀完&#xff0c;希望讀完后能對統一異常處理有一個清晰的認識。 背景 軟件開發過程中&#xff0c;不可避免的是需要處理各種異常&#xff0c;就我自己來說&…

VScode新建自定義模板快捷方式

VS新建vue文件的自定義模板 在使用vscode開發的時候&#xff0c;新建vue文件是不可或缺的&#xff0c;但是VSCode并沒有vue文件的初始化模板&#xff0c;這個需要自定義模板。 我們可以使用vscode的snippets在新建.vue 文件后輕松獲得一套模板。 具體步驟 打開VSCode -> …

ESLint Unary operator ‘++‘ used.

ESLint Unary operator used. 安裝了ESLint&#xff0c;用這個工具之后發現居然不會寫代碼了。好尷尬~ 感覺自己以前寫的JS都是假的... 沒有操作 increment(state) {state.count ; },for(let i 0; i < temp.length; i} {//... } 然后報了如下錯誤 Unary operator u…

sencha touch筆記(6)——路由控制(1)

做項目的時候在界面的跳轉上遇到了挺大的問題&#xff0c;本來跳轉不想通過路由來控制的&#xff0c;沒辦法&#xff0c;只能再去看一下路由的跳轉方式了。 應用程序的界面發生改變后&#xff0c;可以通過路由讓應用程序的界面返回到改變之前的狀態&#xff0c;例如瀏覽器中頁面…

Angular rxjs operators 筆記

toArray /*toArray把結果都塞到數組里去 */ const source = interval(1000); const example = source.pipe(take(10),toArray() );example.subscribe(val => console.log(val)); // output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] toArray /*pairwise把相鄰的兩個流組成數組 */…

Angular rxjs Subject筆記

BehaviorSubject /*ehaviorSubject接受一個默認參數,相當于new Subject后自動next(aa)之后到行為和Subject一致 */ const behave = new BehaviorSubject(aa); behave.subscribe(res => {console.log(res)

面試39 MySQL讀寫分離

&#xff08;1&#xff09;如何實現mysql的讀寫分離&#xff1f; 其實很簡單&#xff0c;就是基于主從復制架構&#xff0c;簡單來說&#xff0c;就搞一個主庫&#xff0c;掛多個從庫&#xff0c;然后我們就單單只是寫主庫&#xff0c;然后主庫會自動把數據給同步到從庫上去。 …