コード例 #1
0
        /// <summary>
        ///  Method for led feature
        /// </summary>
        private void LedSample()
        {
            bool value;
            // Checks the led feature is supported in this device
            var result = Information.TryGetValue <bool>("http://tizen.org/feature/led", out value);
            var t      = Task.Run(async delegate
            {
                await Task.Delay(300);
                return;
            });

            if (!result || !value)
            {
                // Led is not supported
                this.Navigation.PushAsync(new SimpleResult("Wearable doesn't support led feature"));
                return;
            }

            try
            {
                // Plays the LED that is located at the front of the device
                Led.Play(500, 200, Tizen.Common.Color.FromRgba(255, 255, 255, 1));
                // Wait 300ms
                t.Wait();
                // Stops the LED
                Led.Stop();

                // Operations are succeed
                this.Navigation.PushAsync(new SimpleResult("Succeed: Led"));
            }
            catch (Exception e)
            {
                // Operations are failed
                this.Navigation.PushAsync(new SimpleResult("Failed: Led\n" + e.Message));
            }
        }