コード例 #1
0
        private async void LoadCameras()
        {
            try
            {
                var result = await SynoCommand.GetCamsASync();

                CameraViews = new ObservableCollection <CamControl>(result.Where(c => c.Enabled).Select(c => new CamControl(c, RefreshRate)).ToList());
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Unable to load cameras, error: " + Environment.NewLine + "{0}", ex.Message));
            }
        }
コード例 #2
0
        private async Task <bool> UpdatePictureBoxes()
        {
            bool result = false;

            List <ICam> results = await _synoCommand.GetCamsASync();

            _cams = results.Select(c => new CamUi(c, Ms4Minutes)).ToList();

            foreach (var cam in _cams)
            {
                CamUi newCam = cam;
                newCam.MouseDown   += MainFormMouseDown;
                newCam.DoubleClick += MainFormDoubleClick;
                newCam.ImageLoaded += cam_LoadCompleted;
                newCam.Visible      = false;

                Invoke(new Action(() => Controls.Add(newCam)));
                result = true;
            }

            return(result);
        }