Exemple #1
0
        private async void Save_btn_OnClick(object sender, RoutedEventArgs e)
        {
            Device device = new Device();

            device.DeviceName = device_name_txt.Text;
            device.DeviceType = device_type_txt.Text;
            device.DeviceIp   = device_ip_txt.Text;
            device.StreamLink = stream_link_txt.Text;

            if (face_rdo.IsChecked == true)
            {
                device.FaceDetection = "on";
            }
            else
            {
                device.FaceDetection = "off";
            }

            if (motion_rdo.IsChecked == true)
            {
                device.Motion = "on";
            }
            else
            {
                device.Motion = "off";
            }

            if (face_rdo.IsChecked == false && motion_rdo.IsChecked == false)
            {
                message_lbl.Text = "Please select one or both face detection and/or motion detection";
            }
            else
            {
                if (device.DeviceName != "" && device.DeviceType != "" && device.DeviceIp != "" && device.StreamLink != "")
                {
                    string returnMsg = await DataProcessor.AddDevice(device);

                    message_lbl.Text = returnMsg;
                }
                else
                {
                    message_lbl.Text = "Please enter all the device details";
                }
            }
        }