private void tool_strip_capture_Click(object sender, EventArgs e)
        {
            var key = (int)list_view_devices.SelectedItems[0].Tag;
            var img = DeviceController.GetDevice(key).process_image;

            SaveFileDialog file = new SaveFileDialog();

            file.Filter = "Images|*.jpg";
            if (file.ShowDialog() == DialogResult.OK)
            {
                img.Save(file.FileName, ImageFormat.Jpeg);
            }
        }
        private void EnableMenuButtons()
        {
            //define values attributs
            bool runing    = DeviceController.device_interface.font?.Running ?? false;
            var  key       = (int)list_view_devices.SelectedItems[0].Tag;
            bool recording = DeviceController.GetDevice(key).GetDeviceState() == DeviceState.Recording;

            //enable buttons menu
            tool_strip_start_font.Enabled  = !runing;
            tool_strip_stop_font.Enabled   = runing;
            tool_strip_capture.Enabled     = runing;
            tool_strip_start_video.Enabled = !recording && runing;
            tool_strip_stop_video.Enabled  = recording;
        }
 private void list_view_devices_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (list_view_devices.SelectedItems.Count > 0)
     {
         var key = (int)list_view_devices.SelectedItems[0].Tag;
         DeviceController.GetDevice(key).device.SetValuesInterface();
         DeviceController.selected_device       = key;
         DeviceController.image_grid.Image      = null;
         DeviceController.image_state.BackColor = SystemColors.Control;
     }
     else
     {
         DeviceController.LoadDevice();
     }
     EnableDeviceButtons();
 }
        //methods controls
        private void ActionDevice(Func <DeviceCapture, DeviceState> task)
        {
            int key;

            if (list_view_devices.SelectedItems.Count > 0)
            {
                var item = list_view_devices.SelectedItems[0];
                key             = (int)item.Tag;
                item.ImageIndex = (int)task(DeviceController.GetDevice(key));
            }
            else
            {
                key = DeviceController.selected_device;
                DeviceController.ChangeIconState(key, task(DeviceController.GetDevice(key)));
            }
            EnableDeviceButtons();
        }
示例#5
0
        public void DeviceGetUpdate_ValidRequest()
        {
            var connection = DeviceController.Connect();

            DeviceController.Authenticate(connection, DeviceGUID, DeviceKey);

            var res    = DeviceController.GetDevice(connection);
            var device = (JObject)res["device"];

            Expect((string)device["name"], EqualTo("test device"));

            device["name"] = "updated name";
            res            = DeviceController.SaveDevice(connection, DeviceGUID, device);
            Expect((string)res["status"], EqualTo("success"));

            res    = DeviceController.GetDevice(connection);
            device = (JObject)res["device"];
            Expect((string)device["name"], EqualTo("updated name"));

            device["name"] = "test device";
            DeviceController.SaveDevice(connection, DeviceGUID, device);
        }
示例#6
0
        public async void GetById()
        {
            var result = await DeviceController.GetDevice(1);

            Assert.IsType <OkObjectResult>(result.Result);
        }