1

I've tried to create a new/custom settings option for my WinJS Windows 8 Metro application and it just won't seem to show up. I tried following the suggestions here and didn't get anywhere. Here is the JS I am using to intialize everything, and I am seeing "Manage Cache" in the charm bar, but clicking it just closes it:

WinJS.UI.processAll();
WinJS.Application.onsettings = function (e) {
    e.detail.applicationcommands = {
        "managecache": { title: "Manage Cache", href: "/html/manageCacheCharm.html" }
    };
    WinJS.UI.SettingsFlyout.populateSettings(e);
};
WinJS.Application.start();

Here is the body of the html:

<div data-win-control="WinJS.UI.SettingsFlyout" aria-label="Manage cache flyout" data-win-options="{settingsCommandId:'managecache', width: 'narrow'}">
<!-- Use either 'win-ui-light' or 'win-ui-dark' depending on the contrast between the header title and background color -->
<div class="win-ui-dark win-header" style="background-color:#2d6c61">
    <!-- Background color reflects app's personality -->
    <button type="button" id="backButton" class="win-backbutton"></button>
    <div class="win-label">Manage Cache</div>
</div>
<div class="win-content ">
    <div class="win-settings-section">
        <h3>Email App Cache</h3>
        <p>Email the app cache to send an administrator to help diagnose checklist issues.</p>
        <p><button id="sendAppCacheButton" onclick="sendAppCache()">Email cache to Admin</button></p>
        <p id="sendCacheResult"></p>

        <h3>Clear App Cache</h3>
        <p>Clear the app cache if you are experiencing issues. Unsynced changes will be lost.</p>
        <p><button id="clearAppCacheButton" onclick="clearAppCache()">Clear app cache</button></p>
        <p id="clearCacheResult"></p>
    </div>
</div>

Everything looks to be in order...any suggestions? Thanks!

Community
  • 1
  • 1
Ethan
  • 67
  • 1
  • 2
  • 8
  • Where is the JS for your PageControl? Is that your complete HTML? Normally you'd have a JS and probably a CSS reference above the part you provided. Or are you loading the JS for the control (where you do WinJS.UI.Pages.define for the page) somewhere else? – Brandon Paddock Apr 07 '15 at 23:26
  • I didn't include it here because right now it is just the two empty functions (sendAppCache & clearAppCache) inside a – Ethan Apr 08 '15 at 12:16
  • If you put a script tag with a breakpoint or "debugger" statement in your SettingsFlyout HTML file, does it get it? Also, are there any errors in the output window? Or the JavaScript Console window? – Brandon Paddock Apr 19 '15 at 19:40
  • Good question, but VS doesn't seem to successfully keep the breakpoint on the code when I run the project. I did try console.log and WinJS.log and saw neither in the output. – Ethan Apr 20 '15 at 18:29
  • If your debugger statement or console.log in the HTML file aren't firing, then that suggests the HTML page isn't being loaded. Do you see any console output about it being unable to find the page? Perhaps you are providing an incorrect path to the file? Or have a typo somewhere? – Brandon Paddock Apr 26 '15 at 22:22
  • I didn't see any console output in the JS Console of VS. I thought that too and tried other paths but if you change anything it gives you an error that file is not found. We've given up, at least for the moment, on trying to get it to work. Thanks for your help troubleshooting though – Ethan Apr 29 '15 at 17:00

0 Answers0