Exemplo n.º 1
0
        private static void AddDeviceToList()
        {
            foreach (SSDPResponse item in availableDevices)
            {
                if (ssdr.Location.Ip == item.Location.Ip &&
                    ssdr.Location.Port != "3000")
                {
                    return;
                }
            }

            ssdr.Mac = GetMacAddressFromArpTable(ssdr.Location.Ip);

            AvailableDevice ad = new AvailableDevice
            {
                Ip          = ssdr.Location.Ip,
                Port        = ssdr.Location.Port,
                Server      = ssdr.Server,
                ServicePort = "3000",
                Mac         = ssdr.Mac,
                Uuid        = (Guid)ssdr.Uuid,
                Usn         = ssdr.Usn
            };

            availableDevices.Add(ssdr);
            Thread.Sleep(1000);
            (Application.OpenForms["RemoteControl"] as RemoteControl).availableDeviceList.Load(ad);
        }
Exemplo n.º 2
0
        internal void StartPairNewDevice(Guid uuid, string name)
        {
            AvailableDevice ad = new AvailableDevice();

            ad             = availableDeviceList.availableDevList.Where(s => s.Uuid == uuid).FirstOrDefault();
            selectedDevice = new Device
            {
                FriendlyName = name,
                Ip           = ad.Ip,
                Port         = ad.ServicePort,
                MacAddress   = ad.Mac,
                Server       = ad.Server,
                Uuid         = ad.Uuid,
                ApiKey       = ""
            };

            deviceListFromConfig.Add(selectedDevice);
            SaveDeviceList();
            RefreshDeviceListComboBoxDelegate();

            cbSavedDevices.Invoke((Action) delegate
            {
                SetActiveDevice(name);
            });

            cbSavedDevices.Invoke((Action) delegate
            {
                Connect();
            });
        }
 public void Load(AvailableDevice ad)
 {
     availableDevList.Add(ad);
     OnPropertyChanged("AvailableDevList");
 }