コード例 #1
0
        public void Handle_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            ((ListView)sender).SelectedItem = null;

            ListViewItem listViewItem = (ListViewItem)e.Item;

            byte[] commands = listViewItem.Function();

            this.contentPageComponent.UserInteractionEnabled = false;

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

                switch (this.listViewItemCollection.IndexOf(listViewItem))
                {
                default:
//                  case 0  :
//                  case 2  :
                    Communication.Communication.SendCommands(commands, portName, portSettings, 10000, SendCommandsAction);                            // 10000mS!!!
                    break;

                case 1:
                case 3:
                    Communication.Communication.SendCommandsDoNotCheckCondition(commands, portName, portSettings, 10000, SendCommandsAction);         // 10000mS!!!
                    break;
                }
            }
            catch (Exception exception)
            {
                DebugExt.WriteLine(exception.Message);
            }
        }
コード例 #2
0
        public async void Handle_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            ((ListView)sender).SelectedItem = null;

            ListViewItem listViewItem = (ListViewItem)e.Item;

            if (listViewItem.Enabled)
            {
                byte[] commands = await listViewItem.Execute();

                this.contentPageComponent.UserInteractionEnabled = false;

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

                    Communication.Communication.SendCommands(commands, portName, portSettings, 10000, SendCommandsAction);     // 10000mS!!!
                }
                catch (Exception exception)
                {
                    DebugExt.WriteLine(exception.Message);
                }
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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);
            }
        }