示例#1
0
        private void deviceField_click(object sender, RoutedEventArgs e)
        {
            _controls.deviceField clicked = (_controls.deviceField)sender;
            string[] ip = clicked.deviceIp.Content.ToString().Split(':');

            if (_class.core.connectToDevice(ip[0], ip[1]))
            {
                _class.core.contactList = null;
                this.NavigationService.Navigate(new _pages.contacts());
            }
        }
示例#2
0
        void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                _class.deviceInfo device = null;
                var json = e.Result;
                device = JsonConvert.DeserializeObject <_class.deviceInfo>(json);

                marginTop = 65 * i;
                _controls.deviceField deviceField = new _controls.deviceField();
                deviceField.MouseDown         += deviceField_click;
                deviceField.Margin             = new Thickness(0, marginTop, 0, 0);
                deviceField.deviceName.Content = _class.core.DecodeFromUtf8(device.deviceName.Replace("\n", " "));
                deviceField.deviceIp.Content   = device.deviceIP;
                deviceGrid.Children.Add(deviceField);
                i++;
            }
            catch
            {
            }
        }