560 likes | 707 Views
BCIS 4650 Visual Programming for Business Applications. App Package Manifest Search Share Contract. App Manifest Package. What is the App Package Manifest?. Is an XML file containing metadata about your Windows Store app, ex., App identity External capabilities required by the app
E N D
BCIS 4650 Visual Programming for Business Applications App Package Manifest Search Share Contract The University of North Texas, ITDS Dept., Dr. Vedder
What is the App Package Manifest? • Is an XML file containing metadata about your Windows Store app, ex., • App identity • External capabilities required by the app • Created automatically by VS, but you can edit • Required and cannot be changed after app package “signed” The University of North Texas, ITDS Dept., Dr. Vedder
Package.appmanifest in VS 2013 A series of tabbed forms • Application – name, description, orientation, notification settings, etc. • Visual Assets – app splash screen, tile sizes, app logo images The University of North Texas, ITDS Dept., Dr. Vedder
Application Tabas opened in Manifest Designer The University of North Texas, ITDS Dept., Dr. Vedder
Visual Assets Tab The University of North Texas, ITDS Dept., Dr. Vedder
Package.appmanifest, 2 • Capabilities – request(s) for your app to interact with other functions; part of what the customer sees at the Store • Declarations –ID what external activities for which your app can be a contract target (task completer) The University of North Texas, ITDS Dept., Dr. Vedder
Capabilities Tab The University of North Texas, ITDS Dept., Dr. Vedder
Declarations Tab The University of North Texas, ITDS Dept., Dr. Vedder
Package.appmanifest, 3 • Content URIs – for hosting HTML content inside the app that use JavaScript (which you allow or disallow) • Packaging – information required for display at the Windows Store The University of North Texas, ITDS Dept., Dr. Vedder
Content URIs Tab The University of North Texas, ITDS Dept., Dr. Vedder
Packaging Tab The University of North Texas, ITDS Dept., Dr. Vedder
Search is Different in Win 8.1 • Win 8.1: Must use SearchBox Class (in Win 8.0, had to use Search Charm) • SearchBox looks in Windows and on the Web • Must write custom code to search within your app The University of North Texas, ITDS Dept., Dr. Vedder
SearchBox Class • Similar to a TextBox in appearance • Properties include: • PlaceholderText property for instructing / requesting from user • QueryText property for what user typed • FocusOnKeyboardInput property (bool) The University of North Texas, ITDS Dept., Dr. Vedder
SearchBox Class, 2 • Events include: • QueryChanged event when text changes • QuerySubmitted event when user clicks search button (must have this handler!) • SuggestionsRequested event when text changes and app must offer new suggestions: <SearchBoxSuggestionsRequested=“someeventhandler"/> privatevoidSearchBox_SuggestionsRequested(object sender, SearchBoxSuggestionsRequestedEventArgs e) The University of North Texas, ITDS Dept., Dr. Vedder
SearchBoxQuerySubmitted, part 1 The University of North Texas, ITDS Dept., Dr. Vedder
SearchBoxQuerySubmitted, part 2 The University of North Texas, ITDS Dept., Dr. Vedder
If Needed, Add a SearchResultsPage The University of North Texas, ITDS Dept., Dr. Vedder
Suggestion Support for Querieshow you code determines the query Found in the namespace Windows.ApplicationModel.Search • Search History • Query (autocomplete) • Local content • Result The University of North Texas, ITDS Dept., Dr. Vedder
Search History Suggestions • Is ON as default, even across sessions (SearchHistoryEnabled=True) • SearchHistoryContext property: use if more than one SB/app to set unique ID • To remove search history • Add the namespace Windows.ApplicationModel.Search.Core • SearchSuggestionManagermanager = new SearchSuggestionManager(); manager.ClearHistory(); The University of North Texas, ITDS Dept., Dr. Vedder
Autocomplete Query Suggestionsbut you must create the suggestions The University of North Texas, ITDS Dept., Dr. Vedder
Autocomplete Query in Action The University of North Texas, ITDS Dept., Dr. Vedder
Local Content Suggestions • Use for, ex., looking for picture or music files on local device • Invoke SearchBoxmethod SetLocalContentSuggestionSettings • Must add local file search capability to app package manifest (double-click in Solution Explorer to open) The University of North Texas, ITDS Dept., Dr. Vedder
Sample Requested Capabilities The University of North Texas, ITDS Dept., Dr. Vedder
Advanced Query Syntax (AQS) • Is part of MS Windows Desktop Search • Use to define better and thus narrow file searches on local devices • Set value of AqsFilter property to this • Go here for syntax details: http://msdn.microsoft.com/en-us/library/windows/apps/aa965711.aspx The University of North Texas, ITDS Dept., Dr. Vedder
Music Search Sampleor , ex., could use “ext:=.mp3” as AqsFilter value publicMainPage() { this.InitializeComponent(); // Let Windows provide suggestions from local files. varsettings = newWindows.ApplicationModel.Search.LocalContentSuggestionSettings(); settings.Enabled = true; // Access to the music library requires that the Music Library capability// be declared in the app manifest .settings.Locations.Add(Windows.Storage.KnownFolders.MusicLibrary); settings.AqsFilter = "kind:Music"; MySearchBox.SetLocalContentSuggestionSettings(settings); } The University of North Texas, ITDS Dept., Dr. Vedder
Result: Comment on Search OutcomeSee Nathan, Chap. 15 Request = a property of SearchBoxSuggestionsRequestedEeventArgs that can hold the collection of suggestions you want to offer Tag = unqiue ID for each ResultSuggestion The University of North Texas, ITDS Dept., Dr. Vedder
What are Contracts & Extensions? • Software ‘agreements’ that regulate interactions between Win Store apps or between your app and other parts of the Windows OS • Package manifest for your app must contain the needed declarations The University of North Texas, ITDS Dept., Dr. Vedder
What is a Contract? • An agreement between Win apps or Win OS governing their interaction • Examples— • Sharing content • Tracking file use to ensure user sees latest version • File open / save • Media play • Windows settings The University of North Texas, ITDS Dept., Dr. Vedder
What is an Extension? • An agreement between a Win app and the Windows OS • Allows developers to customize standard Windows features for use by their app and possibly other apps The University of North Texas, ITDS Dept., Dr. Vedder
Sample Extensions Include… • User account picture provider • Onboard camera settings • SSL / certificate installation The University of North Texas, ITDS Dept., Dr. Vedder
Charms Bar Pop-from-right common task bar All charms have abilities/settings that are available to Windows 8 apps
The Concept of Share • People want others to appreciate what they are passionate about. • People often want content from one app in another app. • Windows 8 Share provides a lightweight, in-context experience for app to app sharing.
Share Source and Target ShareSource Windows SharePane ShareTarget (Receiver)
Data Formats for Shareinclude Plain text Formatted (“rich”) text Images Files Uniform Resource Identifiers (URIs) HTML Custom data formats
Your App as a Share Source No entry needed in App Manifest DataPackage is the core sharing object, and can hold more than one data format at the same time Useful to provide customer with a title, description, and a visual reference if appropriate (i.e., a thumbnail) You must figure out what to share
1. Add Namespace(s) w/using… • Windows.ApplicationModel.DataTransfer • Windows.Storage – for files • Windows.Storage.Pickers – for selecting images and files • Windows.Storage.Streams – for large or custom-format data The University of North Texas, ITDS Dept., Dr. Vedder
2. Get an Instance of DataTransferManager • Instantiate a DataTransferManager object; initialize it to object associated with the active window (i.e., clicking the Share Charm) • When user requests a share, fire an OnDataRequested event The University of North Texas, ITDS Dept., Dr. Vedder
3. Add the Sharable Content • What displays in the Share Pane • The actual DataPackage, in this case mixed format data • See Brown, Nathan for details The University of North Texas, ITDS Dept., Dr. Vedder
Different Outcomes Depending on Share Target The University of North Texas, ITDS Dept., Dr. Vedder
Your App as a Share Target • If your app manipulates or stores data, it could be a share target • Must declare app as a share target in the app package manifest; ID what’s sharable The University of North Texas, ITDS Dept., Dr. Vedder
1. Add a Share Target ContractAdd | New Item | Windows Store The University of North Texas, ITDS Dept., Dr. Vedder
2a. What will be Sharable?nothing specified yet, so errors The University of North Texas, ITDS Dept., Dr. Vedder
2b. What will be Sharable? The University of North Texas, ITDS Dept., Dr. Vedder
3. ShareTargetPage • Code automatically generated • Displays share details to user The University of North Texas, ITDS Dept., Dr. Vedder
4. Code Auto-Added to App.xaml The University of North Texas, ITDS Dept., Dr. Vedder