Exemplo n.º 1
0
        public DiscoverWindow() : base(Gtk.WindowType.Toplevel)
        {
            this.Title          = "LinuxGUITest";
            this.DeleteEvent   += new DeleteEventHandler(OnDeleteEvent);
            this.WindowPosition = Gtk.WindowPosition.Center;

            _Provider = DeviceProviderRegistry.CreateSupportedDeviceProvider();

            _Provider.DeviceFound += new EventHandler <DeviceInfoEventArgs>(DeviceFound);
            _Provider.DeviceLost  += new EventHandler <DeviceInfoEventArgs>(DeviceLost);

            _UpdateThread = new Thread(new ThreadStart(UpdateFunction));
            _UpdateThread.Start();

            _HBox             = new HBox(true, 0);
            _HBox.Homogeneous = false;
            this.Add(_HBox);
            _HBox.Show();

            Gtk.TreeView tree = new Gtk.TreeView();
            tree.WidthRequest  = 250;
            tree.HeightRequest = 300;
            _HBox.PackStart(tree);

            // new column
            Gtk.TreeViewColumn devicetypeColumn = new Gtk.TreeViewColumn();
            devicetypeColumn.Title = "Type";
            Gtk.CellRendererText devicetypeCell = new CellRendererText();
            devicetypeColumn.PackStart(devicetypeCell, true);
            devicetypeColumn.AddAttribute(devicetypeCell, "text", 0);

            // new column
            Gtk.TreeViewColumn detailsColumn = new Gtk.TreeViewColumn();
            detailsColumn.Title = "Details";
            Gtk.CellRendererText detailseCell = new CellRendererText();
            detailsColumn.PackStart(detailseCell, true);
            detailsColumn.AddAttribute(detailseCell, "text", 1);

            tree.AppendColumn(devicetypeColumn);
            tree.AppendColumn(detailsColumn);
            _ListStore = new Gtk.ListStore(typeof(string), typeof(string));

            tree.Model = _ListStore;

            _HBox.ShowAll();


            LogLine("Searching for wii devices...");
            _Provider.StartDiscovering();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            // An IDeviceProvider performs the discovering of and connecting to (bluetooth) devices.
            // An IDeviceInfo holds the information of a discovered device.

            // Create a DeviceProvider based on the installed software.
            IDeviceProvider deviceProvider = DeviceProviderRegistry.CreateSupportedDeviceProvider();
            deviceProvider.DeviceFound += deviceProvider_DeviceFound;
            deviceProvider.DeviceLost += deviceProvider_DeviceLost;
            deviceProvider.StartDiscovering();

            Console.WriteLine("The IDeviceProvider is discovering...");

            while (true) { Thread.Sleep(1000); }
        }
Exemplo n.º 3
0
        public void Pair(ControlData data)
        {
            this.data = data;

            Console.WriteLine("Starting..");

            deviceProvider = DeviceProviderRegistry.CreateSupportedDeviceProvider();
            Console.WriteLine("Found provider: " + deviceProvider.ToString());

            deviceProvider.DeviceFound += DeviceFound;
            deviceProvider.DeviceLost  += DeviceLost;

            Console.WriteLine("Discovering device...");

            deviceProvider.StartDiscovering();
        }
Exemplo n.º 4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            idleTimer          = new System.Windows.Forms.Timer();
            idleTimer.Tick    += idleTimer_Tick;
            idleTimer.Interval = 10;
            idleTimer.Start();

            _Provider = DeviceProviderRegistry.CreateSupportedDeviceProvider();

            _Provider.DeviceFound += DeviceFound;
            _Provider.DeviceLost  += DeviceLost;

            _Provider.StartDiscovering();
        }