Пример #1
0
 private void vtrCaptureLengthChangedHandler(VTR vtr, int newLength)
 {
     this.InvokeIfRequired(vtrControl =>
     {
         vtrControl.setCaptureLength(newLength);
     });
 }
Пример #2
0
        public VTRControl(VTR vtr)
        {
            _vtr = vtr;
            InitializeComponent();
            subscribeEvents();

            setNameLabel(_vtr.Name);
            updateByStateChange(_vtr.State);
            setCaptureFilename(_vtr.CaptureFilename);
            setUseInNextBatch(_vtr.UseInNextBatch);
            setCaptureLength(0);
        }
Пример #3
0
        private static void loadXML_vtrs(XmlNode vtrsNode)
        {
            foreach (XmlNode node in vtrsNode.ChildNodes)
            {
                string name                 = node.Attributes.GetNamedItem("name").Value;
                string captureDeviceId      = node.Attributes.GetNamedItem("capturedevice").Value;
                string controllerId         = node.Attributes.GetNamedItem("controller").Value;
                string controllerChannelStr = node.Attributes.GetNamedItem("controllerchannel").Value;

                if (!_captureDevices.ContainsKey(captureDeviceId))
                {
                    throw new Exception(string.Format("Can't find capture device with the ID '{0}'!", captureDeviceId));
                }
                ICaptureDevice captureDevice = _captureDevices[captureDeviceId];

                if (!_controllers.ContainsKey(controllerId))
                {
                    throw new Exception(string.Format("Can't find controller with the ID '{0}'!", captureDeviceId));
                }
                Controller controller = _controllers[controllerId];

                if (!int.TryParse(controllerChannelStr, out int controllerChannel) || (controllerChannel < 0))
                {
                    throw new Exception(string.Format("'{0}' is not a valid number for controller channel!", controllerChannelStr));
                }
                Controller.Adapter controllerAdapter = controller.GetAdapter(controllerChannel);

                List <IRouterCrosspoint> routerCrosspoints = new List <IRouterCrosspoint>();
                foreach (XmlNode childNode in node.ChildNodes)
                {
                    string routerId = childNode.Attributes.GetNamedItem("router").Value;
                    if (!_routers.ContainsKey(routerId))
                    {
                        throw new Exception(string.Format("Can't find router with the ID '{0}'!", routerId));
                    }
                    IRouter router = _routers[routerId];

                    if (childNode.Name == "leitchcrosspoint")
                    {
                        LeitchRouter leitchRouter = router as LeitchRouter;
                        if (leitchRouter == null)
                        {
                            throw new Exception(string.Format("The router with ID '{0}' is not a Leitch router!", routerId));
                        }

                        string levelStr = childNode.Attributes.GetNamedItem("level").Value;
                        if (!int.TryParse(levelStr, out int level) || (level < 0))
                        {
                            throw new Exception(string.Format("'{0}' is not a valid number for Leitch crosspoint level!", level));
                        }

                        string destinationStr = childNode.Attributes.GetNamedItem("destination").Value;
                        if (!int.TryParse(destinationStr, out int destination) || (destination < 0))
                        {
                            throw new Exception(string.Format("'{0}' is not a valid number for Leitch crosspoint destination!", destination));
                        }

                        string sourceStr = childNode.Attributes.GetNamedItem("source").Value;
                        if (!int.TryParse(sourceStr, out int source) || (source < 0))
                        {
                            throw new Exception(string.Format("'{0}' is not a valid number for Leitch crosspoint source!", source));
                        }

                        IRouterCrosspoint crosspoint = leitchRouter.GetCrosspoint(level, destination, source);
                        routerCrosspoints.Add(crosspoint);
                    }
                }

                VTR vtr = new VTR(name, routerCrosspoints, captureDevice, controllerAdapter);
                _vtrs.Add(vtr);
            }
        }
Пример #4
0
 private void vtrUseInNextBatchChangedHandler(VTR vtr, bool newValue)
 {
     setUseInNextBatch(newValue);
 }
Пример #5
0
 private void vtrCaptureFilenameChangedHandler(VTR vtr, string newCaptureFilename)
 {
     setCaptureFilename(newCaptureFilename);
 }
Пример #6
0
 private void vtrStateChangedHandler(VTR vtr, VTRState newState)
 {
     this.InvokeIfRequired(vtrControl => {
         vtrControl.updateByStateChange(newState);
     });
 }