示例#1
0
        private async void tgsStorageArea_Toggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch = sender as ToggleSwitch;

            if (toggleSwitch != null)
            {
                if (updateStorageFlag)
                {
                    Byte sa = 0;
                    if (toggleSwitch.IsOn)
                    {
                        sa = 1;
                    }

                    try
                    {
                        ePaperStorageArea storageArea = (ePaperStorageArea)sa;
                        await epaper.SetStorageAreaAsync(storageArea);

                        SetStatusText("Storage Area change to:" + storageArea.ToString());
                    }
                    catch (ePaperException ex)
                    {
                        SetStatusText("Error:" + ex.ePaperExceptionCode.ToString() + "   |  Return->" + ex.CommandResult);
                        RefreshSettings(false);
                    }
                }
                updateStorageFlag = true;
            }
        }
示例#2
0
        /// <summary>
        /// Set e-Paper storage area setting
        /// </summary>
        /// <param name="storageArea">storage area</param>
        /// <returns>void</returns>
        public async Task SetStorageAreaAsync(ePaperStorageArea storageArea)
        {
            byte[] parameters = new byte[1] {
                (byte)storageArea
            };
            string result = await SendCommand(ePaperCommand.SetStorageArea, parameters);

            if (result != "OK")
            {
                ThrowException(result);
            }
        }
示例#3
0
        private async Task GetStorageArea()
        {
            ePaperStorageArea sa = await epaper.GetStorageAreaAsync();

            if (sa == ePaperStorageArea.NandFlash)
            {
                tgsStorageArea.IsOn = false;
            }
            else
            {
                tgsStorageArea.IsOn = true;
            }
        }