You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/08/17 21:31:15 UTC

[4/5] js commit: Rename away

Rename away


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/f0ec45f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/f0ec45f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/f0ec45f6

Branch: refs/heads/master
Commit: f0ec45f6eac75e53003b5f5853d0d9c1de1c39ef
Parents: 3cd1e84
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Aug 17 12:15:29 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Aug 17 12:15:29 2012 -0700

----------------------------------------------------------------------
 Jakefile                                           |    2 +-
 lib/win8metro/exec.js                              |   84 ----
 lib/win8metro/platform.js                          |   40 --
 .../plugin/win8metro/AccelerometerProxy.js         |   41 --
 lib/win8metro/plugin/win8metro/CameraProxy.js      |  321 ---------------
 lib/win8metro/plugin/win8metro/CaptureProxy.js     |  134 ------
 lib/win8metro/plugin/win8metro/CompassProxy.js     |   41 --
 lib/win8metro/plugin/win8metro/DeviceProxy.js      |   12 -
 lib/win8metro/plugin/win8metro/FileProxy.js        |   72 ----
 lib/win8metro/plugin/win8metro/MediaFile.js        |   42 --
 lib/win8metro/plugin/win8metro/MediaProxy.js       |  159 -------
 .../plugin/win8metro/NetworkStatusProxy.js         |   49 ---
 .../plugin/win8metro/NotificationProxy.js          |   60 ---
 lib/win8metro/plugin/win8metro/console.js          |   25 --
 lib/win8metro/plugin/win8metro/device.js           |   36 --
 lib/win8metro/plugin/win8metro/geolocation.js      |   89 ----
 lib/windows8/exec.js                               |   83 ++++
 lib/windows8/platform.js                           |   40 ++
 lib/windows8/plugin/windows8/AccelerometerProxy.js |   41 ++
 lib/windows8/plugin/windows8/CameraProxy.js        |  321 +++++++++++++++
 lib/windows8/plugin/windows8/CaptureProxy.js       |  134 ++++++
 lib/windows8/plugin/windows8/CompassProxy.js       |   41 ++
 lib/windows8/plugin/windows8/DeviceProxy.js        |   12 +
 lib/windows8/plugin/windows8/FileProxy.js          |   72 ++++
 lib/windows8/plugin/windows8/MediaFile.js          |   42 ++
 lib/windows8/plugin/windows8/MediaProxy.js         |  159 +++++++
 lib/windows8/plugin/windows8/NetworkStatusProxy.js |   49 +++
 lib/windows8/plugin/windows8/NotificationProxy.js  |   60 +++
 lib/windows8/plugin/windows8/console.js            |   25 ++
 lib/windows8/plugin/windows8/device.js             |   36 ++
 lib/windows8/plugin/windows8/geolocation.js        |   89 ++++
 31 files changed, 1205 insertions(+), 1206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
index 7c412f9..7abbbcf 100644
--- a/Jakefile
+++ b/Jakefile
@@ -68,7 +68,7 @@ task('build', ['clean', 'hint'], function () {
         
         console.log("building " + commitId);
 
-        packager.generate("win8metro",commitId);
+        packager.generate("windows8",commitId);
         packager.generate("blackberry",commitId);
         packager.generate("playbook",commitId);
         packager.generate("ios",commitId);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/exec.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/exec.js b/lib/win8metro/exec.js
deleted file mode 100644
index bc20a2b..0000000
--- a/lib/win8metro/exec.js
+++ /dev/null
@@ -1,84 +0,0 @@
-var cordova = require('cordova');
-
-
- /* definition of named properties expected by the native side,
-    all arrays are stored in order of how they are received from common js code.
-    When other platforms evolve to using named args this will be removed.
- */
-
-
-/**
- * Execute a cordova command.  It is up to the native side whether this action
- * is synchronous or asynchronous.  The native side can return:
- *      Synchronous: PluginResult object as a JSON string
- *      Asynchrounous: Empty string ""
- * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
- * depending upon the result of the action.
- *
- * @param {Function} success    The success callback
- * @param {Function} fail       The fail callback
- * @param {String} service      The name of the service to use
- * @param {String} action       Action to be run in cordova
- * @param {String[]} [args]     Zero or more arguments to pass to the method
-
- */
-
-
-
-var CommandProxy  = {
-
-    "Accelerometer": require('cordova/plugin/win8metro/AccelerometerProxy'),
-    "Camera":require('cordova/plugin/win8metro/CameraProxy'),
-    "Capture":require('cordova/plugin/win8metro/CaptureProxy'),
-    "Compass":require('cordova/plugin/win8metro/CompassProxy'),
-    "Device":require('cordova/plugin/win8metro/DeviceProxy'),
-    "File":require('cordova/plugin/win8metro/FileProxy'),
-    "Media":require('cordova/plugin/win8metro/MediaProxy'),
-    "NetworkStatus":require('cordova/plugin/win8metro/NetworkStatusProxy'),
-    "Notification":require('cordova/plugin/win8metro/NotificationProxy')
-};
-
-module.exports = function(success, fail, service, action, args) {
-
-    if(CommandProxy[service] && CommandProxy[service][action]) {
-
-        var callbackId = service + cordova.callbackId++;
-        console.log("EXEC:" + service + " : " + action);
-
-        if (typeof success == "function" || typeof fail == "function") {
-            cordova.callbacks[callbackId] = {success:success, fail:fail};
-        }
-        // pass it on to Notify
-        try {
-            CommandProxy [service][action](success, fail, args);
-        }
-        catch(e) {
-            console.log("Exception calling native with command :: " + service + " :: " + action  + " ::exception=" + e);
-        }
-    }
-    else
-    {
-        if(fail) { fail("Missing Command Error"); }
-    }
-
-};
-
-// cordova.exec.addCommandProxy("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
-module.exports.addCommandProxy = function(id,proxyObj) {
-
-    CommandProxy[id] = proxyObj;
-};
-
-// cordova.exec.removeCommandProxy("Accelerometer");
-module.exports.removeCommandProxy = function(id) {
-
-    var proxy = CommandProxy[id];
-    delete CommandProxy[id];
-    CommandProxy[id] = null;
-    return proxy;
-};
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/platform.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/platform.js b/lib/win8metro/platform.js
deleted file mode 100644
index c5a91b5..0000000
--- a/lib/win8metro/platform.js
+++ /dev/null
@@ -1,40 +0,0 @@
-
-var cordova = require('cordova'),
-    exec = require('cordova/exec'),
-    channel = cordova.require("cordova/channel");
-
-module.exports = {
-    id: "win8metro",
-    initialize:function() {
-
-    },
-    objects: {
-        navigator: {
-            children: {
-                device: {
-                    path:"cordova/plugin/win8metro/device",
-                    children:{
-                        capture:{
-                            path:"cordova/plugin/capture"
-                        }
-                    }
-                },
-                console: {
-                    path: "cordova/plugin/win8metro/console"
-                }
-            }
-        }
-    },
-    merges: {
-        MediaFile: {
-            path: "cordova/plugin/win8metro/MediaFile"
-        },
-        navigator: {
-            children: {
-                notification: {
-                    path: 'cordova/plugin/win8metro/geolocation'
-                }
-            }
-        }
-    }
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/AccelerometerProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/AccelerometerProxy.js b/lib/win8metro/plugin/win8metro/AccelerometerProxy.js
deleted file mode 100644
index 6b1b14d..0000000
--- a/lib/win8metro/plugin/win8metro/AccelerometerProxy.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*global Windows:true */
-var cordova = require('cordova'),
-    Acceleration = require('cordova/plugin/Acceleration');
-
-/* This is the actual implementation part that returns the result on Win8Metro
-*/
-
-module.exports = {
-    onDataChanged:null,
-    start:function(win,lose){
-
-        var accel = Windows.Devices.Sensors.Accelerometer.getDefault();
-        if(!accel) {
-            lose("No accelerometer found");
-        }
-        else {
-            var self = this;
-            accel.reportInterval = Math.max(16,accel.minimumReportInterval);
-
-            // store our bound function
-            this.onDataChanged = function(e) {
-                var a = e.reading;
-                win(new Acceleration(a.accelerationX,a.accelerationY,a.accelerationZ));
-            };
-            accel.addEventListener("readingchanged",this.onDataChanged);
-        }
-    },
-    stop:function(win,lose){
-        console.log("Accelerometer.stop");
-        var accel = Windows.Devices.Sensors.Accelerometer.getDefault();
-        if(!accel) {
-            lose("No accelerometer found");
-        }
-        else {
-            accel.removeEventListener("readingchanged",this.onDataChanged);
-            this.onDataChanged = null;
-            accel.reportInterval = 0; // back to the default
-            win();
-        }
-    }
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/CameraProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/CameraProxy.js b/lib/win8metro/plugin/win8metro/CameraProxy.js
deleted file mode 100755
index 1049fb7..0000000
--- a/lib/win8metro/plugin/win8metro/CameraProxy.js
+++ /dev/null
@@ -1,321 +0,0 @@
-/*global Windows:true, URL:true */
-
-
-var cordova = require('cordova'),
-    Camera = require('cordova/plugin/CameraConstants');
-
-
-module.exports = {
-
-    // args will contain :
-    //  ...  it is an array, so be careful
-    // 0 quality:50,
-    // 1 destinationType:Camera.DestinationType.FILE_URI,
-    // 2 sourceType:Camera.PictureSourceType.CAMERA,
-    // 3 targetWidth:-1,
-    // 4 targetHeight:-1,
-    // 5 encodingType:Camera.EncodingType.JPEG,
-    // 6 mediaType:Camera.MediaType.PICTURE,
-    // 7 allowEdit:false,
-    // 8 correctOrientation:false,
-    // 9 saveToPhotoAlbum:false,
-    // 10 popoverOptions:null
-
-    takePicture: function (successCallback, errorCallback, args) {
-        var encodingType = args[5];
-        var targetWidth = args[3];
-        var targetHeight = args[4];
-        var sourceType = args[2];
-        var destinationType = args[1];
-        var mediaType = args[6];
-        var saveToPhotoAlbum = args[9];
-
-
-        var package = Windows.ApplicationModel.Package.current;
-        var packageId = package.installedLocation;
-
-        // resize method :)
-        var resizeImage = function (file) {
-            var tempPhotoFileName = "";
-            if (encodingType == Camera.EncodingType.PNG) {
-                tempPhotoFileName = "camera_cordova_temp_return.png";
-            } else {
-                tempPhotoFileName = "camera_cordova_temp_return.jpg";
-            }
-            var imgObj = new Image();
-            var success = function (fileEntry) {
-                var successCB = function (filePhoto) {
-                    var filePhoto = filePhoto,
-                        fileType = file.contentType,
-                        reader = new FileReader();
-                    reader.onloadend = function () {
-                        var image = new Image();
-                        image.src = reader.result;
-                        image.onload = function () {
-                            var imageWidth = targetWidth,
-                                imageHeight = targetHeight;
-                            var canvas = document.createElement('canvas');
-
-                            canvas.width = imageWidth;
-                            canvas.height = imageHeight;
-
-                            var ctx = canvas.getContext("2d");
-                            ctx.drawImage(this, 0, 0, imageWidth, imageHeight);
-
-                            // The resized file ready for upload
-                            var _blob = canvas.msToBlob();
-                            var _stream = _blob.msDetachStream();
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                                storageFolder.createFileAsync(tempPhotoFileName, Windows.Storage.CreationCollisionOption.generateUniqueName).done(function (file) {
-                                    file.openAsync(Windows.Storage.FileAccessMode.readWrite).done(function (fileStream) {
-                                        Windows.Storage.Streams.RandomAccessStream.copyAndCloseAsync(_stream, fileStream).done(function () {
-                                            var _imageUrl = URL.createObjectURL(file);
-                                            successCallback(_imageUrl);
-                                        }, function () { errorCallback("Resize picture error."); })
-                                    }, function () { errorCallback("Resize picture error."); })
-                                }, function () { errorCallback("Resize picture error."); })
-                            })
-
-                        }
-                    }
-
-                    reader.readAsDataURL(filePhoto);
-
-                }
-                var failCB = function () {
-                    errorCallback("File not found.")
-                }
-                fileEntry.file(successCB, failCB);
-            }
-
-            var fail = function (fileError) {
-                errorCallback("FileError, code:" + fileError.code);
-            }
-            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
-                    success(new FileEntry(storageFile.name, storageFile.path));
-                }, function () {
-                    fail(FileError.INVALID_MODIFICATION_ERR);
-                }, function () {
-                    errorCallback("Folder not access.");
-                });
-            })
-
-        }
-
-        // because of asynchronous method, so let the successCallback be called in it.
-        var resizeImageBase64 = function (file) {
-            var imgObj = new Image();
-            var success = function (fileEntry) {
-                var successCB = function (filePhoto) {
-                    var filePhoto = filePhoto,
-                        fileType = file.contentType,
-                        reader = new FileReader();
-                    reader.onloadend = function () {
-                        var image = new Image();
-                        image.src = reader.result;
-
-                        image.onload = function () {
-                            var imageWidth = targetWidth,
-                                imageHeight = targetHeight;
-                            var canvas = document.createElement('canvas');
-
-                            canvas.width = imageWidth;
-                            canvas.height = imageHeight;
-
-                            var ctx = canvas.getContext("2d");
-                            ctx.drawImage(this, 0, 0, imageWidth, imageHeight);
-
-                            // The resized file ready for upload
-                            var finalFile = canvas.toDataURL(fileType);
-
-                            // Remove the prefix such as "data:" + contentType + ";base64," , in order to meet the Cordova API.
-                            var arr = finalFile.split(",");
-                            var newStr = finalFile.substr(arr[0].length + 1);
-                            successCallback(newStr);
-                        }
-                    }
-
-                    reader.readAsDataURL(filePhoto);
-
-                }
-                var failCB = function () {
-                    errorCallback("File not found.")
-                }
-                fileEntry.file(successCB, failCB);
-            }
-
-            var fail = function (fileError) {
-                errorCallback("FileError, code:" + fileError.code);
-            }
-            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
-                    success(new FileEntry(storageFile.name, storageFile.path));
-                }, function () {
-                    fail(FileError.INVALID_MODIFICATION_ERR);
-                }, function () {
-                    errorCallback("Folder not access.");
-                });
-            })
-
-        }
-
-        if (sourceType != Camera.PictureSourceType.CAMERA) {
-            var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
-            fileOpenPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
-            if (mediaType == Camera.MediaType.PICTURE) {
-                fileOpenPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
-            } else if (mediaType == Camera.MediaType.VIDEO) {
-                fileOpenPicker.fileTypeFilter.replaceAll([".avi", ".flv", ".asx", ".asf", ".mov", ".mp4", ".mpg", ".rm", ".srt", ".swf", ".wmv", ".vob"]);
-            } else {
-                fileOpenPicker.fileTypeFilter.replaceAll(["*"]);
-            }
-            fileOpenPicker.pickSingleFileAsync().then(function (file) {
-                if (file) {
-                    if (destinationType == Camera.DestinationType.FILE_URI) {
-                        if (targetHeight > 0 && targetWidth > 0) {
-                            resizeImage(file);
-                        } else {
-                            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
-                                    var _imageUrl = URL.createObjectURL(storageFile);
-                                    successCallback(_imageUrl);
-                                }, function () {
-                                    fail(FileError.INVALID_MODIFICATION_ERR);
-                                }, function () {
-                                    errorCallback("Folder not access.");
-                                });
-                            })
-
-                        }
-                    }
-                    else {
-                        if (targetHeight > 0 && targetWidth > 0) {
-                            resizeImageBase64(file);
-                        } else {
-                            Windows.Storage.FileIO.readBufferAsync(file).done(function (buffer) {
-                                var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
-                                successCallback(strBase64);
-                            })
-                        }
-
-                    }
-
-                } else {
-                    errorCallback("User didn't choose a file.");
-                }
-            }, function () {
-                errorCallback("User didn't choose a file.")
-            })
-        }
-        else {
-
-            var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
-            cameraCaptureUI.photoSettings.allowCropping = true;
-            var allowCrop = !!args[7];
-            if (!allowCrop) {
-                cameraCaptureUI.photoSettings.allowCropping = false;
-            }
-
-            if (encodingType == Camera.EncodingType.PNG) {
-                cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.png;
-            } else {
-                cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.jpeg;
-            }
-            // decide which max pixels should be supported by targetWidth or targetHeight.
-            if (targetWidth >= 1280 || targetHeight >= 960) {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.large3M;
-            } else if (targetWidth >= 1024 || targetHeight >= 768) {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
-            } else if (targetWidth >= 800 || targetHeight >= 600) {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
-            } else if (targetWidth >= 640 || targetHeight >= 480) {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.smallVga;
-            } else if (targetWidth >= 320 || targetHeight >= 240) {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.verySmallQvga;
-            } else {
-                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable;
-            }
-
-            cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (picture) {
-                if (picture) {
-                    // save to photo album successCallback
-                    var success = function (fileEntry) {
-                        if (destinationType == Camera.DestinationType.FILE_URI) {
-                            if (targetHeight > 0 && targetWidth > 0) {
-                                resizeImage(picture);
-                            } else {
-                                Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                                    picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
-                                        var _imageUrl = URL.createObjectURL(storageFile);
-                                        successCallback(_imageUrl);
-                                    }, function () {
-                                        fail(FileError.INVALID_MODIFICATION_ERR);
-                                    }, function () {
-                                        errorCallback("Folder not access.");
-                                    });
-                                })
-                            }
-                        } else {
-                            if (targetHeight > 0 && targetWidth > 0) {
-                                resizeImageBase64(picture);
-                            } else {
-                                Windows.Storage.FileIO.readBufferAsync(picture).done(function (buffer) {
-                                    var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
-                                    successCallback(strBase64);
-                                })
-                            }
-                        }
-                    }
-                    // save to photo album errorCallback
-                    var fail = function () {
-                        //errorCallback("FileError, code:" + fileError.code);
-                        errorCallback("Save fail.");
-                    }
-
-                    if (saveToPhotoAlbum) {
-                        Windows.Storage.StorageFile.getFileFromPathAsync(picture.path).then(function (storageFile) {
-                            storageFile.copyAsync(Windows.Storage.KnownFolders.picturesLibrary, picture.name, Windows.Storage.NameCollisionOption.generateUniqueName).then(function (storageFile) {
-                                success(storageFile);
-                            }, function () {
-                                fail();
-                            })
-                        })
-                        //var directory = new DirectoryEntry("Pictures", parentPath);
-                        //new FileEntry(picture.name, picture.path).copyTo(directory, null, success, fail);
-                    } else {
-                        if (destinationType == Camera.DestinationType.FILE_URI) {
-                            if (targetHeight > 0 && targetWidth > 0) {
-                                resizeImage(picture);
-                            } else {
-                                Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
-                                    picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
-                                        var _imageUrl = URL.createObjectURL(storageFile);
-                                        successCallback(_imageUrl);
-                                    }, function () {
-                                        fail(FileError.INVALID_MODIFICATION_ERR);
-                                    }, function () {
-                                        errorCallback("Folder not access.");
-                                    });
-                                })
-                            }
-                        } else {
-                            if (targetHeight > 0 && targetWidth > 0) {
-                                resizeImageBase64(picture);
-                            } else {
-                                Windows.Storage.FileIO.readBufferAsync(picture).done(function (buffer) {
-                                    var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
-                                    successCallback(strBase64);
-                                })
-                            }
-                        }
-                    }
-                } else {
-                    errorCallback("User didn't capture a photo.");
-                }
-            }, function () {
-                errorCallback("Fail to capture a photo.");
-            })
-        }
-    }
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/CaptureProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/CaptureProxy.js b/lib/win8metro/plugin/win8metro/CaptureProxy.js
deleted file mode 100755
index 1864e9e..0000000
--- a/lib/win8metro/plugin/win8metro/CaptureProxy.js
+++ /dev/null
@@ -1,134 +0,0 @@
-var MediaFile = require('cordova/plugin/MediaFile');
-var CaptureError = require('cordova/plugin/CaptureError');
-var CaptureAudioOptions = require('cordova/plugin/CaptureAudioOptions');
-var CaptureImageOptions = require('cordova/plugin/CaptureImageOptions');
-var CaptureVideoOptions = require('cordova/plugin/CaptureVideoOptions');
-var MediaFileData = require('cordova/plugin/MediaFileData');
-
-module.exports = {
-    
-    // No UI support. The duration of the audio recording.
-    cameraCaptureAudioDuration: null,
-
-    captureAudio:function(successCallback, errorCallback, options) {
-		var options = options[0];
-        var audioOptions = new CaptureAudioOptions();
-        if (options.duration && options.duration > 0) {
-            audioOptions.duration = options.duration;
-            cameraCaptureAudioDuration = audioOptions.duration;
-        } else {
-            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-            return;
-        }
-        var mediaCaputreSettings;
-        var initCaptureSettings = function () {
-            mediaCaputreSettings = null;
-            mediaCaputreSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
-            mediaCaputreSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;
-        }
-        initCaptureSettings();
-        var mediaCapture = new Windows.Media.Capture.MediaCapture();
-        mediaCapture.initializeAsync(mediaCaputreSettings).done(function () {
-            Windows.Storage.KnownFolders.musicLibrary.createFileAsync("captureAudio.mp3", Windows.Storage.NameCollisionOption.generateUniqueName).then(function (storageFile) {
-                var mediaEncodingProfile = new Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                var stopRecord = function () {
-                    mediaCapture.stopRecordAsync().then(function (result) {
-                        storageFile.getBasicPropertiesAsync().then(function (basicProperties) {
-                            var results = [];
-                            results.push(new MediaFile(storageFile.name, storageFile.path, storageFile.contentType, basicProperties.dateModified, basicProperties.size));
-                            successCallback(results);
-                        }, function () {
-                            errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
-                        })
-                    }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
-                }
-                mediaCapture.startRecordToStorageFileAsync(mediaEncodingProfile, storageFile).then(function () {
-                    setTimeout(stopRecord, cameraCaptureAudioDuration * 1000);
-                }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
-            }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
-        })
-    },
-
-    captureImage:function (successCallback, errorCallback, options) {
-		var options = options[0];
-        var imageOptions = new CaptureImageOptions();
-        var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
-        cameraCaptureUI.photoSettings.allowCropping = true;
-        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable;
-        cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.jpeg;
-        cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (file) {
-            file.moveAsync(Windows.Storage.KnownFolders.picturesLibrary, "cameraCaptureImage.jpg", Windows.Storage.NameCollisionOption.generateUniqueName).then(function () {
-                file.getBasicPropertiesAsync().then(function (basicProperties) {
-                    var results = [];
-                    results.push(new MediaFile(file.name, file.path, file.contentType, basicProperties.dateModified, basicProperties.size));
-                    successCallback(results);
-                }, function () {
-                    errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
-                })
-            }, function () {
-                errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
-            });
-        }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
-    },
-
-    captureVideo:function (successCallback, errorCallback, options) {
-		var options = options[0];
-        var videoOptions = new CaptureVideoOptions();
-        if (options.duration && options.duration > 0) {
-            videoOptions.duration = options.duration;
-        }
-        if (options.limit > 1) {
-            videoOptions.limit = options.limit;
-        }
-        var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
-        cameraCaptureUI.videoSettings.allowTrimming = true;
-        cameraCaptureUI.videoSettings.format = Windows.Media.Capture.CameraCaptureUIVideoFormat.mp4;
-        cameraCaptureUI.videoSettings.maxDurationInSeconds = videoOptions.duration;
-        cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.video).then(function (file) {
-            file.moveAsync(Windows.Storage.KnownFolders.videosLibrary, "cameraCaptureVedio.mp4", Windows.Storage.NameCollisionOption.generateUniqueName).then(function () {
-                file.getBasicPropertiesAsync().then(function (basicProperties) {
-                    var results = [];
-                    results.push(new MediaFile(file.name, file.path, file.contentType, basicProperties.dateModified, basicProperties.size));
-                    successCallback(results);
-                }, function () {
-                    errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
-                })
-            }, function () {
-                errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
-            });
-        }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
-    
-    },
-	
-    getFormatData:function (successCallback, errorCallback, args) {
-	    var contentType = args[1];
-	    Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(function (storageFile) {
-	            var mediaTypeFlag = String(contentType).split("/")[0].toLowerCase();
-	            if (mediaTypeFlag === "audio") {
-	                storageFile.properties.getMusicPropertiesAsync().then(function (audioProperties) {
-	                    successCallback(new MediaFileData(null, audioProperties.bitrate, 0, 0, audioProperties.duration / 1000));
-	                }, function () {
-	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-	                })
-	            }
-	            else if (mediaTypeFlag === "video") {
-	                storageFile.properties.getVideoPropertiesAsync().then(function (videoProperties) {
-	                    successCallback(new MediaFileData(null, videoProperties.bitrate, videoProperties.height, videoProperties.width, videoProperties.duration / 1000));
-	                }, function () {
-	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-	                })
-	            }
-	            else if (mediaTypeFlag === "image") {
-	                storageFile.properties.getImagePropertiesAsync().then(function (imageProperties) {
-	                    successCallback(new MediaFileData(null, 0, imageProperties.height, imageProperties.width, 0));
-	                }, function () {
-	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-	                })
-	            }
-	            else { errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)) }
-	        }, function () {
-	            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-	        }
-	    )
-	}
-}	

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/CompassProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/CompassProxy.js b/lib/win8metro/plugin/win8metro/CompassProxy.js
deleted file mode 100644
index 9be8ecd..0000000
--- a/lib/win8metro/plugin/win8metro/CompassProxy.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*global Windows:true */
-var cordova = require('cordova'),
-    CompassHeading = require('cordova/plugin/CompassHeading');
-
-
-module.exports = {
-
-    onReadingChanged:null,
-    getHeading:function(win,lose) {
-        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
-        if(!deviceCompass) {
-            setTimeout(function(){lose("Compass not available");},0);
-        }
-        else {
-
-            deviceCompass.reportInterval = Math.max(16,deviceCompass.minimumReportInterval);
-
-            this.onReadingChanged = function(e) {
-                var reading = e.reading;
-                var heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth);
-                win(heading);
-            };
-            deviceCompass.addEventListener("readingchanged",this.onReadingChanged);
-        }
-
-    },
-    stopHeading:function(win,lose) {
-        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
-        if(!deviceCompass) {
-            setTimeout(function(){lose("Compass not available");},0);
-        }
-        else {
-
-            deviceCompass.removeEventListener("readingchanged",this.onReadingChanged);
-            this.onReadingChanged = null;
-            deviceCompass.reportInterval = 0;
-            win();
-        }
-
-    }
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/DeviceProxy.js b/lib/win8metro/plugin/win8metro/DeviceProxy.js
deleted file mode 100644
index 6856f21..0000000
--- a/lib/win8metro/plugin/win8metro/DeviceProxy.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var cordova = require('cordova');
-
-
-module.exports = {
-
-        getDeviceInfo:function(win,fail,args){
-            console.log("NativeProxy::getDeviceInfo");
-            setTimeout(function(){
-                win({platform:"win8metro", version:"8", name:"metrova", uuid:"42", cordova:"2.0.1"});
-            },0);
-        }
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/FileProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/FileProxy.js b/lib/win8metro/plugin/win8metro/FileProxy.js
deleted file mode 100644
index 9c2dade..0000000
--- a/lib/win8metro/plugin/win8metro/FileProxy.js
+++ /dev/null
@@ -1,72 +0,0 @@
-var cordova = require('cordova');
-
-
-module.exports = {
-
-    getFileMetaData:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    getMetadata:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    getParent:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    readAsText:function(win,fail,args) { // ["fileName","encoding"]
-        var fileName = args[0];
-        var encoding = args[1];
-    },
-    readAsDataURL:function(win,fail,args) { // ["fileName"]
-        var fileName = args[0];
-    },
-    getDirectory:function(win,fail,args) { // ["fullPath","path","options"]
-        var fullPath = args[0];
-        var path = args[1];
-        var options = args[2];
-    },
-    remove:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    removeRecursively:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    getFile:function(win,fail,args) { // ["fullPath","path","options"]
-        var fullPath = args[0];
-        var path = args[1];
-        var options = args[2];
-    },
-    readEntries:function(win,fail,args) { // ["fullPath"]
-        var fullPath = args[0];
-    },
-    write:function(win,fail,args) { // ["fileName","data","position"]
-        var fileName = args[0];
-        var data = args[1];
-        var position = args[2];
-    },
-    truncate:function(win,fail,args) { // ["fileName","size"]
-        var fileName = args[0];
-        var size = args[1];
-    },
-    copyTo:function(win,fail,args) { // ["fullPath","parent", "newName"]
-        var fullPath = args[0];
-        var parent = args[1];
-        var newName = args[2];
-    },
-    moveTo:function(win,fail,args) { // ["fullPath","parent", "newName"]
-        var fullPath = args[0];
-        var parent = args[1];
-        var newName = args[2];
-    },
-    tempFileSystem:null,
-    persistentFileSystem:null,
-    requestFileSystem:function(win,fail,args) { // ["type","size"]
-
-        var type = args[0];
-        var size = args[1];
-
-    },
-    resolveLocalFileSystemURI:function(win,fail,args) { // ["uri"]
-        var uri = args[0];
-    }
-
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/MediaFile.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/MediaFile.js b/lib/win8metro/plugin/win8metro/MediaFile.js
deleted file mode 100755
index 2522dfe..0000000
--- a/lib/win8metro/plugin/win8metro/MediaFile.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var MediaFileData = require('cordova/plugin/MediaFileData');
-var CaptureError = require('cordova/plugin/CaptureError');
-
-module.exports = {
-
-    getFormatData: function (successCallback, errorCallback, args) {
-		Windows.Storage.StorageFile.getFileFromPathAsync(this.fullPath).then(
-			function (storageFile) {
-				var mediaTypeFlag = String(contentType).split("/")[0].toLowerCase();
-				if (mediaTypeFlag === "audio") {
-					storageFile.properties.getMusicPropertiesAsync().then(
-						function (audioProperties) {
-							successCallback(new MediaFileData(null, audioProperties.bitrate, 0, 0, audioProperties.duration / 1000));
-						}, function () {
-							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-						}
-					)
-				} else if (mediaTypeFlag === "video") {
-					storageFile.properties.getVideoPropertiesAsync().then(
-						function (videoProperties) {
-							successCallback(new MediaFileData(null, videoProperties.bitrate, videoProperties.height, videoProperties.width, videoProperties.duration / 1000));
-						}, function () {
-							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-						}
-					)
-				} else if (mediaTypeFlag === "image") {
-					storageFile.properties.getImagePropertiesAsync().then(
-						function (imageProperties) {
-							successCallback(new MediaFileData(null, 0, imageProperties.height, imageProperties.width, 0));
-						}, function () {
-							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-						}
-					)
-				} else {
-					errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT))
-				}
-			}, function () {
-				errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
-			}
-		)
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/MediaProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/MediaProxy.js b/lib/win8metro/plugin/win8metro/MediaProxy.js
deleted file mode 100644
index 39de090..0000000
--- a/lib/win8metro/plugin/win8metro/MediaProxy.js
+++ /dev/null
@@ -1,159 +0,0 @@
-var cordova = require('cordova');
-
-module.exports = {
-    mediaCaptureMrg:null,
-
-    // Initiates the audio file
-    create:function(win, lose, args) {
-        var id = args[0];
-        var src = args[1];
-        var thisM = Media.get(id);
-        Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STARTING);
-
-        Media.prototype.node = null;
-
-        var fn = src.split('.').pop(); // gets the file extension
-        if (thisM.node === null) {
-            if (fn === 'mp3' || fn === 'wma' || fn === 'wma' ||
-                fn === 'cda' || fn === 'adx' || fn === 'wm' ||
-                fn === 'm3u' || fn === 'wmx') {
-                thisM.node = new Audio(src);
-                thisM.node.load();
-                var dur = thisM.node.duration;
-                if (isNaN(dur)) {
-                    dur = -1;
-                };
-                Media.onStatus(id, Media.MEDIA_DURATION, dur);
-            } else {
-                lose("Invalid file type");
-            }
-        }
-    },
-
-    // Start playing the audio
-    startPlayingAudio:function(win, lose, args) {
-        var id = args[0];
-        //var src = args[1];
-        //var options = args[2];
-        Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_RUNNING);
-
-        (Media.get(id)).node.play();
-    },
-
-    // Stops the playing audio
-    stopPlayingAudio:function(win, lose, args) {
-        var id = args[0];
-        try {
-            (Media.get(id)).node.pause();
-            (Media.get(id)).node.currentTime = 0;
-            Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
-            win();
-        } catch (err) {
-            lose("Failed to stop: "+err);
-        };
-    },
-
-    // Seeks to the postion in the audio
-    seekToAudio:function(win, lose, args) {
-        var id = args[0];
-        var milliseconds = args[1];
-        try {
-            (Media.get(id)).node.currentTime = milliseconds / 1000;
-            win();
-        } catch (err) {
-            lose("Failed to seek: "+err);
-        };
-    },
-
-    // Pauses the playing audio
-    pausePlayingAudio:function(win, lose, args) {
-        var id = args[0];
-        var thisM = Media.get(id);
-        try {
-            thisM.node.pause();
-            Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_PAUSED);
-        } catch (err) {
-            lose("Failed to pause: "+err);
-        }
-    },
-
-    // Gets current position in the audio
-    getCurrentPositionAudio:function(win, lose, args) {
-        var id = args[0];
-        try {
-            var p = (Media.get(id)).node.currentTime;
-            Media.onStatus(id, Media.MEDIA_POSITION, p);
-            win(p);
-        } catch (err) {
-            lose(err);
-        }
-    },
-
-    // Start recording audio
-    startRecordingAudio:function(win, lose, args) {
-        var id = args[0];
-        var src = args[1];
-        // Initialize device
-        Media.prototype.mediaCaptureMgr = null;
-        var thisM = (Media.get(id));
-        var captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
-        captureInitSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;
-        thisM.mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
-        thisM.mediaCaptureMgr.addEventListener("failed", lose);
-
-        thisM.mediaCaptureMgr.initializeAsync(captureInitSettings).done(function (result) {
-            thisM.mediaCaptureMgr.addEventListener("recordlimitationexceeded", lose);
-            thisM.mediaCaptureMgr.addEventListener("failed", lose);
-        }, lose);
-        // Start recording
-        Windows.Storage.KnownFolders.musicLibrary.createFileAsync(src, Windows.Storage.CreationCollisionOption.replaceExisting).done(function (newFile) {
-            var storageFile = newFile;
-            var fileType = this.src.split('.').pop();
-            var encodingProfile = null;
-            switch (fileType) {
-                case 'm4a':
-                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createM4a(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                    break;
-                case 'mp3':
-                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                    break;
-                case 'wma':
-                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createWma(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                    break;
-                default:
-                    lose("Invalid file type for record");
-                    break;
-            };
-            thisM.mediaCaptureMgr.startRecordToStorageFileAsync(encodingProfile, storageFile).done(win, lose);
-        }, lose);
-    },
-
-    // Stop recording audio
-    stopRecordingAudio:function(win, lose, args) {
-        var id = args[0];
-        var thisM = Media.get(id);
-        thisM.mediaCaptureMgr.stopRecordAsync().done(win, lose);
-    },
-
-    // Release the media object
-    release:function(win, lose, args) {
-        var id = args[0];
-        var thisM = Media.get(id);
-        try {
-            delete thisM.node;
-        } catch (err) {
-            lose("Failed to release: "+err);
-        }
-    },
-    setVolume:function(win, lose, args) {
-        var id = args[0];
-        var volume = args[1];
-        var thisM = Media.get(id);
-        thisM.volume = volume;
-    }
-
-    //    Still need code for Media.onStatus
-    //        Need to fire event when duration is looked up
-    //                                position is looked up
-    //                                media is stopped
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/NetworkStatusProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/NetworkStatusProxy.js b/lib/win8metro/plugin/win8metro/NetworkStatusProxy.js
deleted file mode 100644
index 6916d0a..0000000
--- a/lib/win8metro/plugin/win8metro/NetworkStatusProxy.js
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/*global Windows:true */
-
-var cordova = require('cordova');
-
-
-module.exports = {
-
-    getConnectionInfo:function(win,fail,args)
-    {
-        var winNetConn = Windows.Networking.Connectivity;
-        var networkInfo = winNetConn.NetworkInformation;
-        var networkCostInfo = winNetConn.NetworkCostType;
-        var networkConnectivityInfo = winNetConn.NetworkConnectivityLevel;
-        var networkAuthenticationInfo = winNetConn.NetworkAuthenticationType;
-        var networkEncryptionInfo = winNetConn.NetworkEncryptionType;
-
-        var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
-        if(profile) {
-        var conLevel = profile.getNetworkConnectivityLevel();
-
-        switch (conLevel) {
-            case Windows.Networking.Connectivity.NetworkConnectivityLevel.none:
-                break;
-            case Windows.Networking.Connectivity.NetworkConnectivityLevel.localAccess:
-                break;
-            case Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess:
-                break;
-            case Windows.Networking.Connectivity.NetworkConnectivityLevel.constrainedInternetAccess:
-                break;
-        }
-    }
-
-
-        // FYI
-        //Connection.UNKNOWN  'Unknown connection';
-        //Connection.ETHERNET 'Ethernet connection';
-        //Connection.WIFI     'WiFi connection';
-        //Connection.CELL_2G  'Cell 2G connection';
-        //Connection.CELL_3G  'Cell 3G connection';
-        //Connection.CELL_4G  'Cell 4G connection';
-        //Connection.NONE     'No network connection';
-
-        setTimeout(function(){
-            win("wifi");
-        },0);
-    }
-
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/NotificationProxy.js b/lib/win8metro/plugin/win8metro/NotificationProxy.js
deleted file mode 100644
index 96441a8..0000000
--- a/lib/win8metro/plugin/win8metro/NotificationProxy.js
+++ /dev/null
@@ -1,60 +0,0 @@
-var cordova = require('cordova');
-
-module.exports = {
-    alert:function(win, loseX, args) {
-        var message = args[0];
-        var _title = args[1];
-        var _buttonLabel = args[2];
-
-        var md = new Windows.UI.Popups.MessageDialog(message, _title);
-        md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
-        md.showAsync().then(win);
-    },
-
-    confirm:function(win, loseX, args) {
-        var message = args[0];
-        var _title = args[1];
-        var _buttonLabels = args[2];
-
-		var btnList = [];
-        function commandHandler (command) {
-			win(btnList[command.label]);
-		};
-
-        var md = new Windows.UI.Popups.MessageDialog(message, _title);
-        var button = _buttonLabels.split(',');
-        var btnList = [];
-        for (var i = 0; i<button.length; i++) {
-			btnList[button[i]] = i+1;
-			md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
-		};
-        md.showAsync();
-    },
-
-    vibrate:function(winX, loseX, args) {
-        var mills = args[0];
-
-        //...
-    },
-
-    beep:function(winX, loseX, args) {
-        var count = args[0];
-        /*
-        var src = //filepath//
-        var playTime = 500; // ms
-        var quietTime = 1000; // ms
-        var media = new Media(src, function(){});
-        var hit = 1;
-        var intervalId = window.setInterval( function () {
-            media.play();
-            sleep(playTime);
-            media.stop();
-            media.seekTo(0);
-            if (hit < count) {
-                hit++;
-            } else {
-                window.clearInterval(intervalId);
-            }
-        }, playTime + quietTime); */
-    }
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/console.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/console.js b/lib/win8metro/plugin/win8metro/console.js
deleted file mode 100644
index a0ada8e..0000000
--- a/lib/win8metro/plugin/win8metro/console.js
+++ /dev/null
@@ -1,25 +0,0 @@
-
-if(!console || !console.log)
-{
-    var exec = require('cordova/exec');
-
-    var debugConsole = {
-        log:function(msg){
-            exec(null,null,"DebugConsole","log",msg);
-        },
-        warn:function(msg){
-            exec(null,null,"DebugConsole","warn",msg);
-        },
-        error:function(msg){
-            exec(null,null,"DebugConsole","error",msg);
-        }
-    };
-
-    module.exports = debugConsole;
-}
-else if(console && console.log) {
-    
-  console.log("console.log exists already!");
-  console.warn = console.warn || function(msg){console.log("warn:"+msg);};
-  console.error = console.error || function(msg){console.log("error:"+msg);};
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/device.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/device.js b/lib/win8metro/plugin/win8metro/device.js
deleted file mode 100644
index 26381fe..0000000
--- a/lib/win8metro/plugin/win8metro/device.js
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-if(!console || !console.log)
-{
-    var exec = require('cordova/exec'),
-        channel = require('cordova/channel');
-
-
-
-    var debugConsole = {
-        log:function(msg){
-        exec(null,null,"DebugConsole","log",msg);
-        },
-        warn:function(msg){
-            exec(null,null,"DebugConsole","warn",msg);
-        },
-        error:function(msg){
-            exec(null,null,"DebugConsole","error",msg);
-        }
-    };
-
-
-    module.exports = debugConsole;
-}
-else
-{
-
-    if(console && console.log)
-    {
-        console.log("console.log exists already!");
-        console.warn = console.warn || function(msg){console.log("warn:"+msg);};
-        console.error = console.error || function(msg){console.log("error:"+msg);};
-
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/win8metro/plugin/win8metro/geolocation.js
----------------------------------------------------------------------
diff --git a/lib/win8metro/plugin/win8metro/geolocation.js b/lib/win8metro/plugin/win8metro/geolocation.js
deleted file mode 100644
index 434dcf9..0000000
--- a/lib/win8metro/plugin/win8metro/geolocation.js
+++ /dev/null
@@ -1,89 +0,0 @@
-var Position = require('cordova/plugin/Position'),
-    PositionError = require('cordova/plugin/PositionError');
-
-module.exports = { // Merges with common
-
-
-    getLocation:function(win, lose, args) {
-        // options.enableHighAccuracy
-        // options.maximumAge
-        // options.timeout
-
-        var geolocator = new Windows.Devices.Geolocation.Geolocator();
-        if (options.enableHighAccuracy) {
-            geolocator.desiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.high;
-        }
-
-        geolocator.getGeopositionAsync(options.maximumAge, options.timeout).done(
-            function(geoposition) {
-                // Win8 JS API coordinate Object
-                win(geoposition.coordinate);
-            }, function() {
-                var e = new Object();
-
-                switch (geolocator.locationStatus) {
-                    case Windows.Devices.Geolocation.PositionStatus.ready:
-                        // Location data is available
-                        e.message = "Location is available.";
-                        e.code = PositionError.TIMEOUT;
-                        lose (e);
-                        break;
-                    case Windows.Devices.Geolocation.PositionStatus.initializing:
-                        // This status indicates that a GPS is still acquiring a fix
-                        e.message = "A GPS device is still initializing.";
-                        e.code = PositionError.POSITION_UNAVAILABLE;
-                        lose(e);
-                        break;
-                    case Windows.Devices.Geolocation.PositionStatus.noData:
-                        // No location data is currently available
-                        e.message = "Data from location services is currently unavailable.";
-                        e.code = PositionError.POSITION_UNAVAILABLE;
-                        lose(e);
-                        break;
-                    case Windows.Devices.Geolocation.PositionStatus.disabled:
-                        // The app doesn't have permission to access location,
-                        // either because location has been turned off.
-                        e.message = "Your location is currently turned off. " +
-                        "Change your settings through the Settings charm " +
-                        " to turn it back on.";
-                        e.code = PositionError.PERMISSION_DENIED;
-                        lose(e);
-                        break;
-                    case Windows.Devices.Geolocation.PositionStatus.notInitialized:
-                        // This status indicates that the app has not yet requested
-                        // location data by calling GetGeolocationAsync() or
-                        // registering an event handler for the positionChanged event.
-                        e.message = "Location status is not initialized because " +
-                        "the app has not requested location data.";
-                        e.code = PositionError.POSITION_UNAVAILABLE;
-                        lose(e);
-                        break;
-                    case Windows.Devices.Geolocation.PositionStatus.notAvailable:
-                        // Location is not available on this version of Windows
-                        e.message = "You do not have the required location services " +
-                        "present on your system.";
-                        e.code = PositionError.POSITION_UNAVAILABLE;
-                        lose(e);
-                        break;
-                    default:
-                        e.code = PositionError.TIMEOUT;
-                        lose(e);
-                        break;
-
-                }
-            }
-        )
-    },
-
-    addWatch:function(win, lose, args) {
-        // id
-        // options
-        // options.maximumAge
-        // options.timeout
-        // timers[]
-        timers[id] = new Windows.Devices.Geolocation.Geolocator().getGeopositionAsync(options.maximumAge, options.timeout).done(
-            new Geolocation().getCurrentPosition(win, lose, options)
-        )
-    }
-    // clearWatch is not needed as in common code the timer is deleted
-};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/exec.js
----------------------------------------------------------------------
diff --git a/lib/windows8/exec.js b/lib/windows8/exec.js
new file mode 100644
index 0000000..14e03d3
--- /dev/null
+++ b/lib/windows8/exec.js
@@ -0,0 +1,83 @@
+var cordova = require('cordova');
+
+
+ /* definition of named properties expected by the native side,
+    all arrays are stored in order of how they are received from common js code.
+    When other platforms evolve to using named args this will be removed.
+ */
+
+
+/**
+ * Execute a cordova command.  It is up to the native side whether this action
+ * is synchronous or asynchronous.  The native side can return:
+ *      Synchronous: PluginResult object as a JSON string
+ *      Asynchrounous: Empty string ""
+ * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
+ * depending upon the result of the action.
+ *
+ * @param {Function} success    The success callback
+ * @param {Function} fail       The fail callback
+ * @param {String} service      The name of the service to use
+ * @param {String} action       Action to be run in cordova
+ * @param {String[]} [args]     Zero or more arguments to pass to the method
+ */
+
+
+
+var CommandProxy  = {
+
+    "Accelerometer": require('cordova/plugin/win8metro/AccelerometerProxy'),
+    "Camera":require('cordova/plugin/win8metro/CameraProxy'),
+    "Capture":require('cordova/plugin/win8metro/CaptureProxy'),
+    "Compass":require('cordova/plugin/win8metro/CompassProxy'),
+    "Device":require('cordova/plugin/win8metro/DeviceProxy'),
+    "File":require('cordova/plugin/win8metro/FileProxy'),
+    "Media":require('cordova/plugin/win8metro/MediaProxy'),
+    "NetworkStatus":require('cordova/plugin/win8metro/NetworkStatusProxy'),
+    "Notification":require('cordova/plugin/win8metro/NotificationProxy')
+};
+
+module.exports = function(success, fail, service, action, args) {
+
+    if(CommandProxy[service] && CommandProxy[service][action]) {
+
+        var callbackId = service + cordova.callbackId++;
+        console.log("EXEC:" + service + " : " + action);
+
+        if (typeof success == "function" || typeof fail == "function") {
+            cordova.callbacks[callbackId] = {success:success, fail:fail};
+        }
+        // pass it on to Notify
+        try {
+            CommandProxy [service][action](success, fail, args);
+        }
+        catch(e) {
+            console.log("Exception calling native with command :: " + service + " :: " + action  + " ::exception=" + e);
+        }
+    }
+    else
+    {
+        if(fail) { fail("Missing Command Error"); }
+    }
+
+};
+
+// cordova.exec.addCommandProxy("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
+module.exports.addCommandProxy = function(id,proxyObj) {
+
+    CommandProxy[id] = proxyObj;
+};
+
+// cordova.exec.removeCommandProxy("Accelerometer");
+module.exports.removeCommandProxy = function(id) {
+
+    var proxy = CommandProxy[id];
+    delete CommandProxy[id];
+    CommandProxy[id] = null;
+    return proxy;
+};
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/platform.js
----------------------------------------------------------------------
diff --git a/lib/windows8/platform.js b/lib/windows8/platform.js
new file mode 100644
index 0000000..c5a91b5
--- /dev/null
+++ b/lib/windows8/platform.js
@@ -0,0 +1,40 @@
+
+var cordova = require('cordova'),
+    exec = require('cordova/exec'),
+    channel = cordova.require("cordova/channel");
+
+module.exports = {
+    id: "win8metro",
+    initialize:function() {
+
+    },
+    objects: {
+        navigator: {
+            children: {
+                device: {
+                    path:"cordova/plugin/win8metro/device",
+                    children:{
+                        capture:{
+                            path:"cordova/plugin/capture"
+                        }
+                    }
+                },
+                console: {
+                    path: "cordova/plugin/win8metro/console"
+                }
+            }
+        }
+    },
+    merges: {
+        MediaFile: {
+            path: "cordova/plugin/win8metro/MediaFile"
+        },
+        navigator: {
+            children: {
+                notification: {
+                    path: 'cordova/plugin/win8metro/geolocation'
+                }
+            }
+        }
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/AccelerometerProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/AccelerometerProxy.js b/lib/windows8/plugin/windows8/AccelerometerProxy.js
new file mode 100644
index 0000000..6b1b14d
--- /dev/null
+++ b/lib/windows8/plugin/windows8/AccelerometerProxy.js
@@ -0,0 +1,41 @@
+/*global Windows:true */
+var cordova = require('cordova'),
+    Acceleration = require('cordova/plugin/Acceleration');
+
+/* This is the actual implementation part that returns the result on Win8Metro
+*/
+
+module.exports = {
+    onDataChanged:null,
+    start:function(win,lose){
+
+        var accel = Windows.Devices.Sensors.Accelerometer.getDefault();
+        if(!accel) {
+            lose("No accelerometer found");
+        }
+        else {
+            var self = this;
+            accel.reportInterval = Math.max(16,accel.minimumReportInterval);
+
+            // store our bound function
+            this.onDataChanged = function(e) {
+                var a = e.reading;
+                win(new Acceleration(a.accelerationX,a.accelerationY,a.accelerationZ));
+            };
+            accel.addEventListener("readingchanged",this.onDataChanged);
+        }
+    },
+    stop:function(win,lose){
+        console.log("Accelerometer.stop");
+        var accel = Windows.Devices.Sensors.Accelerometer.getDefault();
+        if(!accel) {
+            lose("No accelerometer found");
+        }
+        else {
+            accel.removeEventListener("readingchanged",this.onDataChanged);
+            this.onDataChanged = null;
+            accel.reportInterval = 0; // back to the default
+            win();
+        }
+    }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/CameraProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/CameraProxy.js b/lib/windows8/plugin/windows8/CameraProxy.js
new file mode 100644
index 0000000..f4c91c3
--- /dev/null
+++ b/lib/windows8/plugin/windows8/CameraProxy.js
@@ -0,0 +1,321 @@
+/*global Windows:true, URL:true */
+
+
+var cordova = require('cordova'),
+    Camera = require('cordova/plugin/CameraConstants');
+
+
+module.exports = {
+
+    // args will contain :
+    //  ...  it is an array, so be careful
+    // 0 quality:50,
+    // 1 destinationType:Camera.DestinationType.FILE_URI,
+    // 2 sourceType:Camera.PictureSourceType.CAMERA,
+    // 3 targetWidth:-1,
+    // 4 targetHeight:-1,
+    // 5 encodingType:Camera.EncodingType.JPEG,
+    // 6 mediaType:Camera.MediaType.PICTURE,
+    // 7 allowEdit:false,
+    // 8 correctOrientation:false,
+    // 9 saveToPhotoAlbum:false,
+    // 10 popoverOptions:null
+
+    takePicture: function (successCallback, errorCallback, args) {
+        var encodingType = args[5];
+        var targetWidth = args[3];
+        var targetHeight = args[4];
+        var sourceType = args[2];
+        var destinationType = args[1];
+        var mediaType = args[6];
+        var saveToPhotoAlbum = args[9];
+
+
+        var package = Windows.ApplicationModel.Package.current;
+        var packageId = package.installedLocation;
+
+        // resize method :)
+        var resizeImage = function (file) {
+            var tempPhotoFileName = "";
+            if (encodingType == Camera.EncodingType.PNG) {
+                tempPhotoFileName = "camera_cordova_temp_return.png";
+            } else {
+                tempPhotoFileName = "camera_cordova_temp_return.jpg";
+            }
+            var imgObj = new Image();
+            var success = function (fileEntry) {
+                var successCB = function (filePhoto) {
+                    var filePhoto = filePhoto,
+                        fileType = file.contentType,
+                        reader = new FileReader();
+                    reader.onloadend = function () {
+                        var image = new Image();
+                        image.src = reader.result;
+                        image.onload = function () {
+                            var imageWidth = targetWidth,
+                                imageHeight = targetHeight;
+                            var canvas = document.createElement('canvas');
+
+                            canvas.width = imageWidth;
+                            canvas.height = imageHeight;
+
+                            var ctx = canvas.getContext("2d");
+                            ctx.drawImage(this, 0, 0, imageWidth, imageHeight);
+
+                            // The resized file ready for upload
+                            var _blob = canvas.msToBlob();
+                            var _stream = _blob.msDetachStream();
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                                storageFolder.createFileAsync(tempPhotoFileName, Windows.Storage.CreationCollisionOption.generateUniqueName).done(function (file) {
+                                    file.openAsync(Windows.Storage.FileAccessMode.readWrite).done(function (fileStream) {
+                                        Windows.Storage.Streams.RandomAccessStream.copyAndCloseAsync(_stream, fileStream).done(function () {
+                                            var _imageUrl = URL.createObjectURL(file);
+                                            successCallback(_imageUrl);
+                                        }, function () { errorCallback("Resize picture error."); })
+                                    }, function () { errorCallback("Resize picture error."); })
+                                }, function () { errorCallback("Resize picture error."); })
+                            })
+
+                        }
+                    }
+
+                    reader.readAsDataURL(filePhoto);
+
+                }
+                var failCB = function () {
+                    errorCallback("File not found.")
+                }
+                fileEntry.file(successCB, failCB);
+            }
+
+            var fail = function (fileError) {
+                errorCallback("FileError, code:" + fileError.code);
+            }
+            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
+                    success(new FileEntry(storageFile.name, storageFile.path));
+                }, function () {
+                    fail(FileError.INVALID_MODIFICATION_ERR);
+                }, function () {
+                    errorCallback("Folder not access.");
+                });
+            })
+
+        }
+
+        // because of asynchronous method, so let the successCallback be called in it.
+        var resizeImageBase64 = function (file) {
+            var imgObj = new Image();
+            var success = function (fileEntry) {
+                var successCB = function (filePhoto) {
+                    var filePhoto = filePhoto,
+                        fileType = file.contentType,
+                        reader = new FileReader();
+                    reader.onloadend = function () {
+                        var image = new Image();
+                        image.src = reader.result;
+
+                        image.onload = function () {
+                            var imageWidth = targetWidth,
+                                imageHeight = targetHeight;
+                            var canvas = document.createElement('canvas');
+
+                            canvas.width = imageWidth;
+                            canvas.height = imageHeight;
+
+                            var ctx = canvas.getContext("2d");
+                            ctx.drawImage(this, 0, 0, imageWidth, imageHeight);
+
+                            // The resized file ready for upload
+                            var finalFile = canvas.toDataURL(fileType);
+
+                            // Remove the prefix such as "data:" + contentType + ";base64," , in order to meet the Cordova API.
+                            var arr = finalFile.split(",");
+                            var newStr = finalFile.substr(arr[0].length + 1);
+                            successCallback(newStr);
+                        }
+                    }
+
+                    reader.readAsDataURL(filePhoto);
+
+                }
+                var failCB = function () {
+                    errorCallback("File not found.")
+                }
+                fileEntry.file(successCB, failCB);
+            }
+
+            var fail = function (fileError) {
+                errorCallback("FileError, code:" + fileError.code);
+            }
+            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
+                    success(new FileEntry(storageFile.name, storageFile.path));
+                }, function () {
+                    fail(FileError.INVALID_MODIFICATION_ERR);
+                }, function () {
+                    errorCallback("Folder not access.");
+                });
+            })
+
+        }
+
+        if (sourceType != Camera.PictureSourceType.CAMERA) {
+            var fileOpenPicker = new Windows.Storage.Pickers.FileOpenPicker();
+            fileOpenPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
+            if (mediaType == Camera.MediaType.PICTURE) {
+                fileOpenPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);
+            } else if (mediaType == Camera.MediaType.VIDEO) {
+                fileOpenPicker.fileTypeFilter.replaceAll([".avi", ".flv", ".asx", ".asf", ".mov", ".mp4", ".mpg", ".rm", ".srt", ".swf", ".wmv", ".vob"]);
+            } else {
+                fileOpenPicker.fileTypeFilter.replaceAll(["*"]);
+            }
+            fileOpenPicker.pickSingleFileAsync().then(function (file) {
+                if (file) {
+                    if (destinationType == Camera.DestinationType.FILE_URI) {
+                        if (targetHeight > 0 && targetWidth > 0) {
+                            resizeImage(file);
+                        } else {
+                            Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                                file.copyAsync(storageFolder, file.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
+                                    var _imageUrl = URL.createObjectURL(storageFile);
+                                    successCallback(_imageUrl);
+                                }, function () {
+                                    fail(FileError.INVALID_MODIFICATION_ERR);
+                                }, function () {
+                                    errorCallback("Folder not access.");
+                                });
+                            })
+
+                        }
+                    }
+                    else {
+                        if (targetHeight > 0 && targetWidth > 0) {
+                            resizeImageBase64(file);
+                        } else {
+                            Windows.Storage.FileIO.readBufferAsync(file).done(function (buffer) {
+                                var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
+                                successCallback(strBase64);
+                            })
+                        }
+
+                    }
+
+                } else {
+                    errorCallback("User didn't choose a file.");
+                }
+            }, function () {
+                errorCallback("User didn't choose a file.")
+            })
+        }
+        else {
+
+            var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
+            cameraCaptureUI.photoSettings.allowCropping = true;
+            var allowCrop = !!args[7];
+            if (!allowCrop) {
+                cameraCaptureUI.photoSettings.allowCropping = false;
+            }
+
+            if (encodingType == Camera.EncodingType.PNG) {
+                cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.png;
+            } else {
+                cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.jpeg;
+            }
+            // decide which max pixels should be supported by targetWidth or targetHeight.
+            if (targetWidth >= 1280 || targetHeight >= 960) {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.large3M;
+            } else if (targetWidth >= 1024 || targetHeight >= 768) {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
+            } else if (targetWidth >= 800 || targetHeight >= 600) {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.mediumXga;
+            } else if (targetWidth >= 640 || targetHeight >= 480) {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.smallVga;
+            } else if (targetWidth >= 320 || targetHeight >= 240) {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.verySmallQvga;
+            } else {
+                cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable;
+            }
+
+            cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (picture) {
+                if (picture) {
+                    // save to photo album successCallback
+                    var success = function (fileEntry) {
+                        if (destinationType == Camera.DestinationType.FILE_URI) {
+                            if (targetHeight > 0 && targetWidth > 0) {
+                                resizeImage(picture);
+                            } else {
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                                    picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
+                                        var _imageUrl = URL.createObjectURL(storageFile);
+                                        successCallback(_imageUrl);
+                                    }, function () {
+                                        fail(FileError.INVALID_MODIFICATION_ERR);
+                                    }, function () {
+                                        errorCallback("Folder not access.");
+                                    });
+                                })
+                            }
+                        } else {
+                            if (targetHeight > 0 && targetWidth > 0) {
+                                resizeImageBase64(picture);
+                            } else {
+                                Windows.Storage.FileIO.readBufferAsync(picture).done(function (buffer) {
+                                    var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
+                                    successCallback(strBase64);
+                                })
+                            }
+                        }
+                    }
+                    // save to photo album errorCallback
+                    var fail = function () {
+                        //errorCallback("FileError, code:" + fileError.code);
+                        errorCallback("Save fail.");
+                    }
+
+                    if (saveToPhotoAlbum) {
+                        Windows.Storage.StorageFile.getFileFromPathAsync(picture.path).then(function (storageFile) {
+                            storageFile.copyAsync(Windows.Storage.KnownFolders.picturesLibrary, picture.name, Windows.Storage.NameCollisionOption.generateUniqueName).then(function (storageFile) {
+                                success(storageFile);
+                            }, function () {
+                                fail();
+                            })
+                        })
+                        //var directory = new DirectoryEntry("Pictures", parentPath);
+                        //new FileEntry(picture.name, picture.path).copyTo(directory, null, success, fail);
+                    } else {
+                        if (destinationType == Camera.DestinationType.FILE_URI) {
+                            if (targetHeight > 0 && targetWidth > 0) {
+                                resizeImage(picture);
+                            } else {
+                                Windows.Storage.StorageFolder.getFolderFromPathAsync(packageId.path).done(function (storageFolder) {
+                                    picture.copyAsync(storageFolder, picture.name, Windows.Storage.NameCollisionOption.replaceExisting).then(function (storageFile) {
+                                        var _imageUrl = URL.createObjectURL(storageFile);
+                                        successCallback(_imageUrl);
+                                    }, function () {
+                                        fail(FileError.INVALID_MODIFICATION_ERR);
+                                    }, function () {
+                                        errorCallback("Folder not access.");
+                                    });
+                                })
+                            }
+                        } else {
+                            if (targetHeight > 0 && targetWidth > 0) {
+                                resizeImageBase64(picture);
+                            } else {
+                                Windows.Storage.FileIO.readBufferAsync(picture).done(function (buffer) {
+                                    var strBase64 = Windows.Security.Cryptography.CryptographicBuffer.encodeToBase64String(buffer);
+                                    successCallback(strBase64);
+                                })
+                            }
+                        }
+                    }
+                } else {
+                    errorCallback("User didn't capture a photo.");
+                }
+            }, function () {
+                errorCallback("Fail to capture a photo.");
+            })
+        }
+    }
+};
\ No newline at end of file