Beispiel #1
0
        public async Task RefreshPortInfo()
        {
            Dictionary <string, string> targetDictionary;

            if (Device.RuntimePlatform == Device.iOS)
            {
                targetDictionary = new Dictionary <string, string>
                {
                    { "LAN", "TCP:" },
                    { "Bluetooth", "BT:" },
                    { "Bluetooth Low Energy", "BLE:" },
                    { "USB", "USB:" },
                    { "All", "" }
                };
            }
            else
            {
                targetDictionary = new Dictionary <string, string>
                {
                    { "LAN", "TCP:" },
                    { "Bluetooth", "BT:" },
                    { "USB", "USB:" },
                    { "All", "" }
                };
            }

            try
            {
                string target = targetDictionary[await DisplayActionSheet("Select Interface.", "Cancel", null, targetDictionary.Keys.ToArray())];

                this.contentPageComponent.UserInteractionEnabled = false;

                listViewItemCollection.Clear();

                try
                {
                    if (target == "")
                    {
                        Communication.Communication.SearchPrinter(SearchPrinterAction);
                    }
                    else
                    {
                        Communication.Communication.SearchPrinter(target, SearchPrinterAction);
                    }
                }
                catch (Exception exception)
                {
                    DebugExt.WriteLine(exception.Message);
                }
            }
            catch
            {
                await Navigation.PopAsync(true);
            }
        }
Beispiel #2
0
        public void RefreshDeviceStatus()
        {
            this.contentPageComponent.UserInteractionEnabled = false;

            listViewItemCollection.Clear();

            try
            {
                string portName     = Configuration.PortName;
                string portSettings = Configuration.PortSettings;

                Communication.Communication.GetDeviceStatus(portName, portSettings, 10000, GetDeviceStatusAction);     // 10000mS!!!
            }
            catch (Exception exception)
            {
                DebugExt.WriteLine(exception.Message);
            }
        }