Ejemplo n.º 1
0
        private async void tgsDisplayOrientation_Toggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch = sender as ToggleSwitch;

            if (toggleSwitch != null)
            {
                if (updateDisplayOrientation)
                {
                    Byte o = 0;
                    if (toggleSwitch.IsOn)
                    {
                        o = 1;
                    }

                    try
                    {
                        ePaperDisplayOrientation orientation = (ePaperDisplayOrientation)o;
                        await epaper.SetDisplayOrientationAsync(orientation);

                        SetStatusText("Display Orientation change to:" + orientation.ToString());
                    }
                    catch (ePaperException ex)
                    {
                        SetStatusText("Error:" + ex.ePaperExceptionCode.ToString() + "   |  Return->" + ex.CommandResult);
                        RefreshSettings(false);
                    }
                }
                updateDisplayOrientation = true;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set display orientation
        /// </summary>
        /// <param name="o">display orientation</param>
        /// <returns>void</returns>
        public async Task SetDisplayOrientationAsync(ePaperDisplayOrientation o)
        {
            byte[] parameters = new byte[1] {
                (byte)o
            };
            string result = await SendCommand(ePaperCommand.SetDisplayOrientation, parameters);

            if (result != "OK")
            {
                ThrowException(result);
            }
        }
Ejemplo n.º 3
0
        private async Task GetDisplayOrientation()
        {
            ePaperDisplayOrientation o = await epaper.GetDisplayOrientationAsync();

            if (o == ePaperDisplayOrientation.Normal)
            {
                tgsDisplayOrientation.IsOn = false;
            }
            else
            {
                tgsDisplayOrientation.IsOn = true;
            }
        }