Beispiel #1
0
        private void AddManualIP()
        {
            Form_AddManualIp fip = new Form_AddManualIp();

            if (fip.ShowDialog() == true)
            {
                switch (BridgeStore.AddManualBridge(IPAddress.Parse(fip.GetIPAddress())))
                {
                case BridgeStore.AddManualBridgeResult.Success:
                    break;

                case BridgeStore.AddManualBridgeResult.Alreadyexists:
                    MessageBox.Show(GlobalStrings.Bridge_Already_Detected, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    break;

                case BridgeStore.AddManualBridgeResult.NotResponding:
                    MessageBox.Show(GlobalStrings.Error_Bridge_Not_Responding, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    break;

                default:
                    MessageBox.Show(GlobalStrings.Error_ErrorHasOccured, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    break;
                }
            }
        }
Beispiel #2
0
        private void AddManualIP()
        {
            Form_AddManualIp fip = new Form_AddManualIp();

            if (fip.ShowDialog() == true)
            {
                BasicConfig bridgeconfig = Hue.GetBridgeBasicConfig(IPAddress.Parse(fip.GetIPAddress()));
                if (bridgeconfig != null)
                {
                    Bridge br = new Bridge()
                    {
                        IpAddress = IPAddress.Parse(fip.GetIPAddress()),
                        Mac       = bridgeconfig.mac,
                        SwVersion = bridgeconfig.swversion,
                    };
                    if (!_listBridge.Any(x => x.IpAddress.Equals(br.IpAddress)))
                    {
                        _listBridge.Add(br);
                    }
                    else
                    {
                        MessageBox.Show(GlobalStrings.Bridge_Already_Detected, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show(GlobalStrings.Error_Getting_Bridge_Basic_Config, GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }