Ejemplo n.º 1
0
        public AddChannelWin(Camera cam)
        {
            _cam = cam;

            SerRecorderList = new ObservableCollection<Recorder>();
            UnBindPortsList = new ObservableCollection<Channel>();
            DataContext = this;

            this.InitializeComponent();

            this.Loaded += new RoutedEventHandler(AddChannel_Loaded);

            // 在此点之下插入创建对象所需的代码。
        }
Ejemplo n.º 2
0
        public AddDefenceWindow(Camera cam, Channel ch)
        {
            this.DataContext = this;

            this.InitializeComponent();
            this.Loaded += new RoutedEventHandler(AddDefenceWindow_Loaded);
            dm = this.FindResource("DefenceViewModelDataSource") as DefenceViewModel;

            selectedChannel = ch;
            selectedCamera = cam;

            WeekList = new ObservableCollection<string>();
            TimeList = new ObservableCollection<string>();

            // 在此点之下插入创建对象所需的代码。
        }
Ejemplo n.º 3
0
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // 在此处添加事件处理程序实现。
            if (sender == _ok)
            {
                if (this.selectedCamera == null)
                {
                    newCamera = new Camera();

                   newCamera.Name = _name.Text ;
                   newCamera.Channel =Int32.Parse( _channel.Text);
                   newCamera.Brightness = Int32.Parse(_brightness.Text);
                   newCamera.Contrast = Int32.Parse(_contrast.Text);
                   newCamera.Saturation = Int32.Parse( _saturation.Text);
                   newCamera.Hue = Int32.Parse(_hue.Text);
                   newCamera.KeyFrameIntervals = Int32.Parse( _keyFrameIntervals.Text);
                   newCamera.FrameRate = Int32.Parse(_frameRate.Text);
                   newCamera.SignalType = (_signalType.SelectedItem as ComboBoxItem).Content.ToString();
                   newCamera.Format = (_format.SelectedItem as ComboBoxItem).Content.ToString();
                   newCamera.Resolution = (_resolution.SelectedItem as ComboBoxItem).Content.ToString();
                   newCamera.BitrateType = (_bitrateType.SelectedItem as ComboBoxItem).Content.ToString();
                   newCamera.PicQuality = (_picQuality.SelectedItem as ComboBoxItem).Content.ToString();
                   newCamera.ImageFrameRate = Int32.Parse(_imageFrameRate.Text);

                   wsAdapter.addCamera(newCamera);

                }
                else
                {
                    selectedCamera.Name = _name.Text;
                    selectedCamera.Channel = Int32.Parse(_channel.Text);
                    selectedCamera.Brightness = Int32.Parse(_brightness.Text);
                    selectedCamera.Contrast = Int32.Parse(_contrast.Text);
                    selectedCamera.Saturation = Int32.Parse(_saturation.Text);
                    selectedCamera.Hue = Int32.Parse(_hue.Text);
                    selectedCamera.KeyFrameIntervals = Int32.Parse(_keyFrameIntervals.Text);
                    selectedCamera.FrameRate = Int32.Parse(_frameRate.Text);
                    selectedCamera.SignalType = (_signalType.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.Format = (_signalType.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.Resolution = (_resolution.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.BitrateType = (_bitrateType.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.PicQuality = (_picQuality.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.ImageFrameRate = Int32.Parse(_imageFrameRate.Text);

                    wsAdapter.editCamera(selectedCamera);
                }

            }
            this.Close();
        }
Ejemplo n.º 4
0
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // 在此处添加事件处理程序实现。
            if (sender == _ok)
            {
                if (this.selectedCamera == null)
                {
                    newCamera = new Camera();

                    newCamera.name = _name.Text;
                    newCamera.channel = Int32.Parse(_channel.Text);
                    newCamera.signalType = (_signalType.SelectedItem as ComboBoxItem).Content.ToString();
                    newCamera.type = (_type.SelectedItem as ComboBoxItem).Content.ToString();
                    newCamera.productor = (_productCombo.SelectedItem as ComboBoxItem).Content.ToString();
                    newCamera.group = _group.Text;
                    newCamera.remark = _remark.Text;
                    newCamera.ip = _ip.Text;
                    newCamera.port = _port.Text;
                    newCamera.user = _user.Text;
                    newCamera.password = _psd.Password;
                    newCamera.hostRecorder = _host;
                    newCamera.vrId = _host.Id;
                    NewCamera.analysisChNum = Int32.Parse(_analysisChNum.Text);

                    wsAdapter.addCamera(newCamera);

                }
                else
                {
                    selectedCamera.name = _name.Text;
                    selectedCamera.channel = Int32.Parse(_channel.Text);
                    selectedCamera.signalType = (_signalType.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.type = (_type.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.productor = (_productCombo.SelectedItem as ComboBoxItem).Content.ToString();
                    selectedCamera.group = _group.Text;
                    selectedCamera.remark = _remark.Text;
                    selectedCamera.ip = _ip.Text;
                    selectedCamera.port = _port.Text;
                    selectedCamera.user = _user.Text;
                    selectedCamera.password = _psd.Password;
                    selectedCamera.hostRecorder = _host;
                    selectedCamera.vrId = _host.Id;
                    selectedCamera.analysisChNum = Int32.Parse(_analysisChNum.Text);

                    wsAdapter.editCamera(selectedCamera);
                }

            }
            this.Close();
        }
Ejemplo n.º 5
0
        public ObservableCollection<Preposition> queryPrePositionByCamera(Camera cam)
        {
            string jsonResult = sVsp.findByVsId(cam.id.ToString());

            JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult);
            JToken jt = jo["retObj"];

            ObservableCollection<Preposition> prepositionList = new ObservableCollection<Preposition>();

            foreach (JToken bToken in jt)
            {
                Preposition p = JsonConvert.DeserializeObject<Preposition>(bToken.ToString());
                prepositionList.Add(p);
            }

            return prepositionList;
        }
Ejemplo n.º 6
0
        public Defence queryDefenceByChannel(Camera cam, Channel ch)
        {
            DefencePara dp = new DefencePara();
            dp.vsId = cam.id.ToString();
            dp.behId = ch.Id.ToString();
            string jsonStr = JsonConvert.SerializeObject(dp);

            string jsonResult = sDefence.findByParams(jsonStr);

            JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult);
            JToken jt = jo["retObj"];

            foreach (JToken bToken in jt)
            {
                  Defence d = JsonConvert.DeserializeObject<Defence>(bToken.ToString());

                  return d;
            }
            return null;
        }
Ejemplo n.º 7
0
        public Camera queryCamera(Camera camera)
        {
            try
            {
                string retStr = sVS.findById(camera.id.ToString());
                System.Diagnostics.Debug.WriteLine(retStr);

                JObject jo = (JObject)JsonConvert.DeserializeObject(retStr);
                JToken jt = jo["retObj"];

                Camera cam = JsonConvert.DeserializeObject<Camera>(jt.ToString());

                return cam;
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
                return null;
            }

            return null;
        }
Ejemplo n.º 8
0
        public bool queryBehaviourByCamera(Camera camera)
        {
            camera.behaviours.Clear();

            BehaviourPara bp = new BehaviourPara();
            bp.vsId = camera.id.ToString();
            //bp.vpId = "1";

            string jsonStr = JsonConvert.SerializeObject(bp);

            string jsonResult = sBehaviour.findByVs(jsonStr);
            //string jsonResult = Utilities.Instance.readTxtFile("c:\\behaviour.txt");

            JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult);
            JToken jt = jo["retObj"];
            foreach (JToken bToken in jt)
            {
                Behaviour b = JsonConvert.DeserializeObject<Behaviour>(bToken.ToString());

                camera.behaviours.Add(b);
            }

            return true;
        }
Ejemplo n.º 9
0
        public bool queryAlertByCamera(Camera camera, string level, DateTime begin, DateTime end)
        {
            AlarmPara2 ap = new AlarmPara2();

               //"{vsIds:\"1\",vpId:\"2\",alLevel:\"serious\",alSDateTime:\"2014-07-29 00:00:00\",
               //  alEDateTime:\"2014-07-29 23:59:59\"}";
            ap.vsId = camera.id.ToString();
            ap.vpId = "1";
            switch(level)
            {
                case "0":
                    ap.alLevel = "low";
                    break;
                case "1":
                    ap.alLevel = "middle";
                    break;
                case "2":
                    ap.alLevel = "serious";
                    break;
                default:
                    break;
            }
            ap.alSDate = begin.ToString("yyyy-MM-dd HH:mm:ss");
            ap.alEDate = end.ToString("yyyy-MM-dd HH:mm:ss");

            string jsonStr = JsonConvert.SerializeObject(ap);

            alarmInfoCollectionHistory.Clear();
            //string jsonResult = sAlert.findByParam(jsonStr);
            string jsonResult = "";

            JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult);
            JToken jt = jo["retObj"];
            foreach (JToken alarmToken in jt)
            {
                AlarmInfo ai = JsonConvert.DeserializeObject<AlarmInfo>(alarmToken.ToString());
                alarmInfoCollectionHistory.Add(ai);
            }

            return true;
        }
Ejemplo n.º 10
0
        public bool editCamera(Camera camera)
        {
            try
            {
                CameraPara cp = new CameraPara();
                cp.id = camera.id;
                cp.name = camera.name;
                cp.channel = camera.channel;
                cp.analysisChNum = camera.analysisChNum;

                switch (camera.signalType)
                {
                    case "复合流":
                        cp.signalType = "analogSignal";
                        break;
                    case "视频流":
                        cp.signalType = "analogSignal";
                        break;
                    default:
                        break;
                }

                cp.type = camera.type;
                cp.user = camera.user;
                cp.password = camera.password;
                cp.vrId = camera.hostRecorder.Id;
                cp.ip = camera.ip;
                cp.port = camera.port;
                cp.remark = camera.remark;
                cp.productor = camera.productor;
                cp.group = camera.group;
                cp.vrId = camera.vrId;

                string jsonStr = JsonConvert.SerializeObject(cp);
                string retStr = sVS.update(jsonStr);
                System.Diagnostics.Debug.WriteLine(retStr);

                return true;
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
                return false;
            }
        }
Ejemplo n.º 11
0
        public bool deleteCamera(Camera camera)
        {
            try
            {
                string retStr = sVS.delete(camera.id.ToString());
                System.Diagnostics.Debug.WriteLine(retStr);

                return true;
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
                return false;
            }
        }
Ejemplo n.º 12
0
        public bool bindChannel(Recorder recorder, Camera cam, int chnIndex, bool isBinding)
        {
            string jsonResult = null;
            try
            {
                BindChannelPara bc = new BindChannelPara();
                bc.vsId = cam.id.ToString();
                bc.vamIP = recorder.Ip;
                bc.channelIndex = chnIndex.ToString();
                bc.switchValue = "1";

                if(isBinding)
                {
                    bc.type = "bind";
                }
                else
                {
                    bc.type = "unbind";
                }

                string jsonStr = JsonConvert.SerializeObject(bc);

                jsonResult = sVS.updateBind(jsonStr);
                System.Diagnostics.Debug.WriteLine(jsonResult);

                JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult);
                JToken jt = jo["retObj"];
                Camera c = JsonConvert.DeserializeObject<Camera>(jt.ToString());
                if(c == null)
                {
                    System.Windows.MessageBox.Show("绑定通道失败");
                }
            }
            catch (System.Exception ex)
            {
                System.Windows.MessageBox.Show("绑定通道失败");
                return false;
            }
            return true;
        }