Permalink
Browse files

removed jquery and added save abilitiy

also submitted app to store for approval
  • Loading branch information...
1 parent 2788b43 commit 72b6773b2769a34474197d6f81fe833c445387e5 @calvinmm committed Nov 14, 2012
Showing with 491 additions and 148 deletions.
  1. +1 −0 .gitignore
  2. +5 −2 App1/App1.jsproj
  3. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU.appxupload
  4. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.ps1
  5. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1
  6. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1
  7. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1
  8. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1
  9. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1
  10. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1
  11. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1
  12. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1
  13. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1
  14. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1
  15. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1
  16. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1
  17. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1
  18. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1
  19. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1
  20. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/App1_1.0.0.0_AnyCPU.appx
  21. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/App1_1.0.0.0_AnyCPU.cer
  22. BIN App1/AppPackages/App1_1.0.0.0_AnyCPU_Test/Dependencies/Microsoft.WinJS.1.0.appx
  23. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU.appxupload
  24. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.ps1
  25. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1
  26. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1
  27. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1
  28. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1
  29. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1
  30. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1
  31. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1
  32. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1
  33. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1
  34. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1
  35. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1
  36. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1
  37. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1
  38. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1
  39. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1
  40. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/App1_1.0.0.1_AnyCPU.appx
  41. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/App1_1.0.0.1_AnyCPU.cer
  42. BIN App1/AppPackages/App1_1.0.0.1_AnyCPU_Test/Dependencies/Microsoft.WinJS.1.0.appx
  43. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU.appxupload
  44. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.ps1
  45. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/Add-AppDevPackage.psd1
  46. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1
  47. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1
  48. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1
  49. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1
  50. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1
  51. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1
  52. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1
  53. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1
  54. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1
  55. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1
  56. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1
  57. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1
  58. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1
  59. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1
  60. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/App1_1.0.0.2_AnyCPU.appx
  61. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/App1_1.0.0.2_AnyCPU.cer
  62. BIN App1/AppPackages/App1_1.0.0.2_AnyCPU_Test/Dependencies/Microsoft.WinJS.1.0.appx
  63. +360 −0 App1/Package.StoreAssociation.xml
  64. +0 −2 App1/css/default.css
  65. +0 −19 App1/default.html
  66. +76 −30 App1/js/Appbar.js
  67. +47 −90 App1/js/default.js
  68. +2 −5 App1/package.appxmanifest
View
@@ -62,6 +62,7 @@ local.properties
*.vspscc
.builds
*.dotCover
+*.pfx
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
View
@@ -47,12 +47,15 @@
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
<DefaultLanguage>en-US</DefaultLanguage>
- <PackageCertificateKeyFile>App1_TemporaryKey.pfx</PackageCertificateKeyFile>
+ <PackageCertificateKeyFile>App1_StoreKey.pfx</PackageCertificateKeyFile>
+ <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
+ <PackageCertificateThumbprint>7437AEC8EF913E6A24AC00433EAE4389C81995F8</PackageCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
+ <None Include="App1_StoreKey.pfx" />
<Content Include="default.html" />
<Content Include="images\hash_logo.png" />
<Content Include="images\hash_small.png" />
@@ -64,7 +67,7 @@
<Content Include="js\Appbar.js" />
<Content Include="js\default.js" />
<Content Include="css\default.css" />
- <Content Include="js\jquery-latest.js" />
+ <None Include="Package.StoreAssociation.xml" />
<None Include="App1_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
View
@@ -18,8 +18,6 @@
padding: 10px;
min-width: 80%;
width: 80%;
- min-height: 100%;
- height: 100%;
}
#right_col {
View
@@ -12,7 +12,6 @@
<!-- App1 references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
- <script src="/js/jquery-latest.js"></script>
<script src="/js/appbar.js"></script>
</head>
<body id="body">
@@ -25,28 +24,12 @@
</div>
</div>
- <!-- BEGINTEMPLATE: Template code for an app bar -->
<div id="appBar" data-win-control="WinJS.UI.AppBar" data-win-options="">
<button
data-win-control="WinJS.UI.AppBarCommand"
- data-win-options="{id:'cmdHome',label:'Home',icon:'home',
- section:'global',tooltip:'Go Home'}">
- </button>
- <button
- data-win-control="WinJS.UI.AppBarCommand"
data-win-options="{id:'cmdSave',label:'Save',icon:'save',
section:'global',tooltip:'Save note'}">
</button>
- <button
- data-win-control="WinJS.UI.AppBarCommand"
- data-win-options="{id:'cmdAdd',label:'Add',icon:'add',
- section:'global',tooltip:'New note'}">
- </button>
- <button
- data-win-control="WinJS.UI.AppBarCommand"
- data-win-options="{id:'cmdMail',label:' Mail',icon:'mail',
- section:'global',tooltip:'Mail note'}">
- </button>
<hr
data-win-control="WinJS.UI.AppBarCommand"
data-win-options="{type:'separator',section:'global'}" />
@@ -56,8 +39,6 @@
section:'global',tooltip:'Delete note'}">
</button>
</div>
- <!-- ENDTEMPLATE -->
- <!--<div id="statusMessage"></div>-->
</body>
View
@@ -2,51 +2,97 @@
"use strict";
var page = WinJS.UI.Pages.define("default.html", {
ready: function (element, options) {
- document.getElementById("cmdHome")
- .addEventListener("click", doClickHome, false);
document.getElementById("cmdSave")
.addEventListener("click", doClickSave, false);
- document.getElementById("cmdAdd")
- .addEventListener("click", doClickAdd, false);
- document.getElementById("cmdMail")
- .addEventListener("click", doClickMail, false);
document.getElementById("cmdDelete")
.addEventListener("click", doClickDelete, false);
- /*WinJS.log && WinJS.log("To show the bar, swipe up from " +
- "the bottom of the screen, right-click, or " +
- "press Windows Logo + z. To dismiss the bar, " +
- "tap in the application, swipe, right-click, " +
- "or press Windows Logo + z again.", "sample", "status");*/
},
});
// Command button functions
- function doClickHome() {
- //WinJS.log && WinJS.log("Home button pressed");
- }
-
function doClickSave() {
//WinJS.log && WinJS.log("Save button pressed");
- }
+ // Clean scenario output
+ //WinJS.log && WinJS.log("", "sample", "status");
- function doClickAdd() {
- //WinJS.log && WinJS.log("Add button pressed");
- }
+ // Verify that we are currently not snapped, or that we can unsnap to open the picker
+ var currentState = Windows.UI.ViewManagement.ApplicationView.value;
+ if (currentState === Windows.UI.ViewManagement.ApplicationViewState.snapped &&
+ !Windows.UI.ViewManagement.ApplicationView.tryUnsnap()) {
+ // Fail silently if we can't unsnap
+ return;
+ }
+
+ // Create the picker object and set options
+ var savePicker = new Windows.Storage.Pickers.FileSavePicker();
+ savePicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary;
+ // Dropdown of file types the user can save the file as
+ savePicker.fileTypeChoices.insert("HTML Document", [".html"]);
+ // Default file name if the user does not type one in or select a file to replace
+ savePicker.suggestedFileName = "markdown.html";
+
+ savePicker.pickSaveFileAsync().then(function (file) {
+ if (file) {
+ // Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.
+ Windows.Storage.CachedFileManager.deferUpdates(file);
+ // write to file
+
+ //Windows.Storage.FileIO.writeTextAsync(file, file.name).done(function () {
+ var fileout = document.getElementById('right_col_inner').innerHTML;
+
+ //Windows.Storage.FileIO.writeTextAsync(file, $("#right_col_inner").html()).done(function () {
+ Windows.Storage.FileIO.writeTextAsync(file, fileout).done(function () {
+ // Let Windows know that we're finished changing the file so the other app can update the remote version of the file.
+ // Completing updates may require Windows to ask for user input.
+ Windows.Storage.CachedFileManager.completeUpdatesAsync(file).done(function (updateStatus) {
+ if (updateStatus === Windows.Storage.Provider.FileUpdateStatus.complete) {
+ //WinJS.log && WinJS.log("File " + file.name + " was saved.", "sample", "status");
+ // Saved
+ var msg = new Windows.UI.Popups.MessageDialog(
+ "File " + file.name + " successfully saved.");
- function doClickMail() {
- //WinJS.log && WinJS.log("Mail button pressed");
+ // Add commands and set their command handlers
+ msg.commands.append(new Windows.UI.Popups.UICommand("Close"));
+
+ // Set the command that will be invoked by default
+ msg.defaultCommandIndex = 0;
+
+ // Set the command to be invoked when escape is pressed
+ msg.cancelCommandIndex = 1;
+
+ // Show the message dialog
+ msg.showAsync();
+ } else {
+ //WinJS.log && WinJS.log("File " + file.name + " couldn't be saved.", "sample", "status");
+ // Not saved
+ var msg = new Windows.UI.Popups.MessageDialog(
+ "File " + file.name + " not saved.");
+
+ // Add commands and set their command handlers
+ msg.commands.append(new Windows.UI.Popups.UICommand("Close"));
+
+ // Set the command that will be invoked by default
+ msg.defaultCommandIndex = 0;
+
+ // Set the command to be invoked when escape is pressed
+ msg.cancelCommandIndex = 1;
+
+ // Show the message dialog
+ msg.showAsync();
+ }
+ });
+ });
+ } else {
+ // Operation Cancelled
+ }
+ });
}
function doClickDelete() {
//WinJS.log && WinJS.log("Delete button pressed");
- $("#left_col_inner").html("");
- $("#right_col_inner").html("");
+ //$("#left_col_inner").html("");
+ //$("#right_col_inner").html("");
+ document.getElementById('left_col_inner').innerHTML = "";
+ document.getElementById('right_col_inner').innerHTML = "";
}
-
- WinJS.log = function (message) {
- var statusDiv = document.getElementById("statusMessage");
- if (statusDiv) {
- statusDiv.innerText = message;
- }
- };
})();
Oops, something went wrong.

0 comments on commit 72b6773

Please sign in to comment.