Add .NET Feedback and Storage Guide 42/134942/10
authorpr.jung <pr.jung@samsung.com>
Tue, 20 Jun 2017 10:11:26 +0000 (19:11 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Thu, 22 Jun 2017 05:45:08 +0000 (08:45 +0300)
PS8: Reviewed
PS10: Pushed review changes in again

Change-Id: Id3c408a9bbb1800c3fe095da1881b65681de4105
Signed-off-by: pr.jung <pr.jung@samsung.com>
org.tizen.guides/html/dotnet/feedback.htm [new file with mode: 0644]
org.tizen.guides/html/dotnet/storage.htm [new file with mode: 0644]

diff --git a/org.tizen.guides/html/dotnet/feedback.htm b/org.tizen.guides/html/dotnet/feedback.htm
new file mode 100644 (file)
index 0000000..d1d115c
--- /dev/null
@@ -0,0 +1,124 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />
+       <link rel="stylesheet" type="text/css" href="../css/styles.css" />
+       <link rel="stylesheet" type="text/css" href="../css/snippet.css" />
+       <script type="text/javascript" src="../scripts/snippet.js"></script>
+       <script type="text/javascript" src="../scripts/jquery.util.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/common.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/search.js" charset="utf-8"></script>
+
+       <title>Sound and Vibration Feedback</title>
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+       <div id="profile">
+               <p><img alt="Mobile C#" src="../images/mobile_s_cs.png"/></p>
+       </div>
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher for Mobile</li>
+               </ul>
+               <p class="toc-title">Content</p>
+               <ul class="toc">
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+                       <li><a href="#playtype">Playing Feedback with a Specific Type and Pattern</a></li>
+                       <li><a href="#support">Checking for Pattern Support</a></li>
+               </ul>
+               <p class="toc-title">Related Info</p>
+               <ul class="toc">
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Feedback.html">Tizen.System.Feedback Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Sound and Vibration Feedback</h1>
+
+  <p>You can play sound and vibration feedback with a specific pattern.</p>
+  <p>This feature is supported in mobile applications only.</p>
+
+  <p>The main features of the <code>Tizen.System.Feedback</code> class are:</p>
+  <ul>
+    <li>Playing a specific feedback pattern
+       <p>You can <a href="#playtype">play a sound or vibrate with a specific pattern</a>, or both. For a list of supported feedback patterns, see the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Feedback.html">Tizen.System.Feedback</a> class reference.</p></li>
+       <li>Checking for pattern support
+       <p>You can <a href="#support">determine whether a specific pattern is supported</a> for a given feedback type.</p></li>
+  </ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+<p>To enable your application to use the feedback functionality:</p>
+<ol>
+       <li>To use vibration feedback, the application has to request permission by adding the following privilege to the <code>tizen-manifest.xml</code> file:
+<pre class="prettyprint">
+&lt;privileges&gt;
+   &lt;privilege&gt;http://tizen.org/privilege/haptic&lt;/privilege&gt;
+&lt;/privileges&gt;
+</pre>
+       </li>   
+       <li>To use the methods and properties of the <code>Tizen.System.Feedback</code> class, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html">Tizen.System</a> namespace in your application:
+<pre class="prettyprint">
+using Tizen.System;
+</pre>
+</li>
+</ol>
+
+<h2 id="playtype">Playing Feedback with a Specific Type and Pattern</h2>
+<p>To play a specific feedback pattern with a specific feedback type:</p>
+<ol>
+       <li>Create a new instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Feedback.html">Tizen.System.Feedback</a> class:
+<pre class="prettyprint">
+Feedback feedback = new Feedback();
+</pre></li>
+       <li>Play the feedback with the <code>Play()</code> method of the <code>Tizen.System.Feedback</code> class. As parameters, enter the feedback type (defined by the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#a3b792c84143eb89c68f6e0ca06b454a0">Tizen.System.FeedbackType</a> enumeration), and a string to denote the pattern to be played:
+<pre class="prettyprint">
+feedback.Play(FeedbackType.Sound, "Tap");
+</pre>
+       </li>
+       <li>To stop the feedback, use the <code>Stop()</code> method:
+<pre class="prettyprint">
+feedback.Stop();
+</pre>
+       </li>
+</ol>
+
+<h2 id="support">Checking for Pattern Support</h2>
+
+<p>To determine whether a specific pattern is supported for a specific feedback type, use the <code>IsSupportedPattern()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Feedback.html">Tizen.System.Feedback</a> class:</p>
+<pre class="prettyprint">
+bool support;
+Feedback feedback = new Feedback();
+support = feedback.IsSupportedPattern(FeedbackType.Vibration, "Key0");
+</pre>
+<p>The return value defines whether the pattern is supported for the feedback type.</p>
+
+<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>
diff --git a/org.tizen.guides/html/dotnet/storage.htm b/org.tizen.guides/html/dotnet/storage.htm
new file mode 100644 (file)
index 0000000..1af1a52
--- /dev/null
@@ -0,0 +1,249 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />
+       <link rel="stylesheet" type="text/css" href="../css/styles.css" />
+       <link rel="stylesheet" type="text/css" href="../css/snippet.css" />
+       <script type="text/javascript" src="../scripts/snippet.js"></script>
+       <script type="text/javascript" src="../scripts/jquery.util.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/common.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/core.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../scripts/search.js" charset="utf-8"></script>
+
+       <title>Storages</title>
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+       <div id="profile">
+               <p><img alt="Mobile C#" src="../images/mobile_s_cs.png"/> <img alt="TV C#" src="../images/tv_s_cs.png"/></p>
+       </div>
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher for Mobile and TV</li>
+               </ul>
+               <p class="toc-title">Content</p>
+               <ul class="toc">
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+                       <li><a href="#storage">Retrieving Storage Information</a></li>
+                       <li><a href="#state">Monitoring Storage State Changes</a></li>
+                       <li><a href="#space">Retrieving Storage Space Information</a></li>
+               </ul>
+               <p class="toc-title">Related Info</p>
+               <ul class="toc">
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Storage.html">Tizen.System.Storage Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1StorageManager.html">Tizen.System.StorageManager Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Storages</h1>
+
+  <p>You can access storage information and manage directories.</p>
+  <p>You can access certain parts of the file system, which are represented as virtual root locations. These virtual roots form a collection of locations that function as a single virtual device file system. The following table lists the supported virtual roots.</p>
+<p align="center" class="Table"><strong>Table: File system virtual roots</strong></p>
+  <table border="1" style="width: 100%">
+   <tbody>
+    <tr>
+     <th>Virtual root</th>
+     <th>Description</th>
+    </tr>
+    <tr>
+     <td><code>Images</code></td>
+     <td>Location for storing images.</td>
+    </tr>
+    <tr>
+     <td><code>Sounds</code></td>
+     <td>Location for storing sound files.</td>
+    </tr>
+    <tr>
+     <td><code>Videos</code></td>
+     <td>Location for storing video files.</td>
+    </tr>
+    <tr>
+     <td><code>Camera</code></td>
+     <td>Location for storing photos.</td>
+    </tr>
+    <tr>
+     <td><code>Downloads</code></td>
+     <td>Location for storing downloaded items.</td>
+    </tr>
+    <tr>
+     <td><code>Music</code></td>
+     <td>Location for storing audio files.</td>
+    </tr>
+    <tr>
+     <td><code>Documents</code></td>
+     <td>Location for storing documents.</td>
+    </tr>
+    <tr>
+     <td><code>Others</code></td>
+     <td>Location for storing other files.</td>
+    </tr>
+       <tr>
+     <td><code>Ringtones</code></td>
+     <td>Location for ringtones (read-only location).</td>
+    </tr>
+   </tbody>
+  </table>
+
+  <p>The main features of the <code>Tizen.System.Storage</code> class include:</p>
+  <ul>
+   <li>Storage management
+   <p>You can manage different storage locations on the device.</p>
+   <p>You can <a href="#storage">retrieve additional information about the storage locations</a>, including which storage is supported on the device, using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1StorageManager.html">Tizen.System.StorageManager</a> class. You can also <a href="#state">monitor storage state changes</a>.</p>
+   </li>
+   <li>Storage space management
+   <p>You can <a href="#space">get the available and total size</a> of the storage.</p></li></ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+<p>To use the methods and properties of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Storage.html">Tizen.System.Storage</a> and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1StorageManager.html">Tizen.System.StorageManager</a> classes, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html">Tizen.System</a> namespace in your application:</p>
+<pre class="prettyprint">
+using Tizen.System;
+</pre>
+
+<h2 id="storage">Retrieving Storage Information</h2>
+
+<p>To retrieve storage information:</p>
+<ol>
+<li>Retrieve all storages in a device using the <code>Storages</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1StorageManager.html">Tizen.System.StorageManager</a> class, which returns a list of all device storages as instances of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Storage.html">Tizen.System.Storage</a> class:
+
+<pre class="prettyprint">
+var storages = StorageManager.Storages;
+var internalStorage = storages.Where(s =&gt; s.StorageType == StorageArea.Internal).FirstOrDefault();
+</pre>
+</li>
+<li>Get information about each storage instance:
+       <ul>
+       <li><p>Get the ID of a specific storage by using the <code>Id</code> property:</p>
+<pre class="prettyprint">
+var result = internalStorage.Id;
+</pre>
+</li>
+<li><p>Get the root directory of a specific storage by using the <code>RootDirectory</code> property:</p>
+<pre class="prettyprint">
+var result = internalStorage.RootDirectory;
+</pre>
+</li>
+
+<li>Get the directory path for a storage of a specific type.
+<p>The <code>GetAbsolutePath()</code> method of the <code>Tizen.System.Storage</code> class retrieves the absolute path to a storage of a particular type, which is defined by the values of the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#a31be3bb6e3bebcfb2d3a6c5c7a66fe37">Tizen.System.DirectoryType</a> enumeration.</p>
+<p>To get the directories of all storage types:</p>
+<pre class="prettyprint">
+foreach (DirectoryType directoryType in Enum.GetValues(typeof(DirectoryType)))
+{
+    var result = internalStorage.GetAbsolutePath(directoryType);
+}
+</pre>
+</li>
+
+<li>Get the storage type of a specific storage by using the <code>StorageType</code> property, which takes values from the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#a5c408f85972f9b602d72d299549297e7">Tizen.System.StorageArea</a> enumeration:
+
+<pre class="prettyprint">
+var result = internalStorage.StorageType;
+</pre>
+</li>
+
+<li>Get the mount state of a specific storage by using the <code>State</code> property, which takes values from the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1System.html#a8d686e878c0ffed2d2b0ccf0eaf52e33">Tizen.System.StorageState</a> enumeration:
+
+<pre class="prettyprint">
+var result = internalStorage.State;
+</pre></li>
+</ul>
+</li>
+</ol>
+
+<h2 id="state">Monitoring Storage State Changes</h2>
+
+<p>To monitor storage state changes:</p>
+
+<ol>
+<li>Define an event handler, which is called when the storage state changes:
+<pre class="prettyprint">
+EventHandler storageEventHandler = (s, e) =&gt;
+{
+    var storage = s as Storage;
+    if (storage == null)
+    {
+        return;
+    }
+    if (storage.State == StorageState.Unmountable)
+    {
+        unmountableStateAchieved = true;
+    }
+};
+</pre>
+<p>The event handler checks whether storage can be mounted or is corrupted and unmountable.</p>
+
+</li>
+
+<li>Register the event handler for the <code>StorageStateChanged</code> event of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Storage.html">Tizen.System.Storage</a> class:
+<pre class="prettyprint">
+foreach (var storage in StorageManager.Storages)
+{
+    storage.StorageStateChanged += storageEventHandler;
+}
+</pre>
+</li>
+
+<li>When no longer needed, deregister the event handler:
+<pre class="prettyprint">
+foreach (var storage in StorageManager.Storages)
+{
+    storage.StorageStateChanged -= storageEventHandler;
+}
+</pre>
+</li></ol>
+
+<h2 id="space">Retrieving Storage Space Information</h2>
+
+<p>To get the available and total size of the storage, use the <code>TotalSpace</code> and <code>AvailableSpace</code> properties in the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1System_1_1Storage.html">Tizen.System.Storage</a> class. For internal storage, they return the storage size, excluding the minimum memory size to launch the low memory pop-up in case of a low memory situation. Consequently, the available size must be less than the original available size, and you must use these properties to get the memory size.</p>
+
+<p>To retrieve storage space information:</p>
+<ul>
+<li>Get the total space of the storage using the <code>TotalSpace</code> property, which returns the total space of the given storage in bytes:
+
+<pre class="prettyprint">
+var storages = StorageManager.Storages;
+var internalStorage = storages.Where(s =&gt; s.StorageType == StorageArea.Internal).FirstOrDefault();
+var result = internalStorage.TotalSpace;
+</pre>
+</li>
+
+<li>Get the available space of the storage using the <code>AvailableSpace</code> property, which returns the available space of the given storage in bytes:
+
+<pre class="prettyprint">
+var storages = StorageManager.Storages;
+var internalStorage = storages.Where(s =&gt; s.StorageType == StorageArea.Internal).FirstOrDefault();
+var result = internalStorage.AvailableSpace;
+</pre></li>
+</ul>
+
+<script type="text/javascript" src="../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>