Ejemplo n.º 1
0
        private void Button_Click_search(object sender, RoutedEventArgs e)
        {
            if (this.DummyDevice.Id == null)
            {
                MessageBox.Show("Please enter some id . This field can't be blank . ");
                return;
            }

            DataModels.DeviceModel d3 = ServerConnection.Devices.getDeviceById(this.DummyDevice.Id);
            if (d3 == null)
            {
                MessageBox.Show(" No such device Present .PLease enter a valid device id. ");
                return;
            }
            string textboxmeasure = "";

            foreach (string ss in d3.measurements)
            {
                textboxmeasure = textboxmeasure + ss + ",";
            }
            textboxmeasure                   = textboxmeasure.Substring(0, textboxmeasure.Length - 1);
            this.DummyDevice.Id              = d3.id;
            this.DummyDevice.Name            = d3.name;
            this.DummyDevice.Overview        = d3.overview;
            this.DummyDevice.Resolution      = d3.resolution;
            this.DummyDevice.Weight          = d3.weight;
            this.DummyDevice.Batterycapacity = d3.batterycapacity;
            this.DummyDevice.Measure         = textboxmeasure;
            MessageBox.Show(" Search successful ! ");
        }
Ejemplo n.º 2
0
        private void Button_Click_del(object sender, RoutedEventArgs e)
        {
            string idDel = this.DummyDevice.Id;

            DataModels.DeviceModel d3 = ServerConnection.Devices.getDeviceById(this.DummyDevice.Id);
            if (d3 == null)
            {
                MessageBox.Show(" No such device Present .PLease enter a valid device id. ");
                return;
            }
            ServerConnection.Devices.deleteDevice(idDel);
        }
Ejemplo n.º 3
0
        private void Button_Click_modify(object sender, RoutedEventArgs e)
        {
            string idDel = this.DummyDevice.Id;

            DataModels.DeviceModel d3 = ServerConnection.Devices.getDeviceById(this.DummyDevice.Id);
            if (d3 == null)
            {
                MessageBox.Show(" No such device Present .PLease enter a valid device id. ");
                return;
            }
            DeviceModel device = new DeviceModel();

            device.id              = this.DummyDevice.Id;
            device.name            = this.DummyDevice.Name;
            device.overview        = this.DummyDevice.Overview;
            device.resolution      = this.DummyDevice.Resolution;
            device.batterycapacity = this.DummyDevice.Batterycapacity;
            device.weight          = this.DummyDevice.Weight;
            List <string> actualmeasure2 = this.DummyDevice.Measure.Split(',').ToList();

            device.measurements = new List <string>(actualmeasure2);
            ServerConnection.Devices.modifyDevice(idDel, device);
        }
Ejemplo n.º 4
0
        private void Button_Click_add(object sender, RoutedEventArgs e)
        {
            string idDel = this.DummyDevice.Id;

            DataModels.DeviceModel d3 = ServerConnection.Devices.getDeviceById(this.DummyDevice.Id);
            if (d3 != null)
            {
                MessageBox.Show(" A device with this id is already present . PLease use a different id . ");
                return;
            }
            DeviceModel device = new DeviceModel();

            device.id              = this.DummyDevice.Id;
            device.name            = this.DummyDevice.Name;
            device.overview        = this.DummyDevice.Overview;
            device.resolution      = this.DummyDevice.Resolution;
            device.batterycapacity = this.DummyDevice.Batterycapacity;
            device.weight          = this.DummyDevice.Weight;
            List <string> actualmeasure = this.DummyDevice.Measure.Split(',').ToList();

            device.measurements = new List <string>(actualmeasure);

            ServerConnection.Devices.addDevice(device);
        }