示例#1
0
        public void ReadValidDuplicateTests(ResourceId resourceId, ReadParam param, Enums.ValidDuplicated dupType)
        {
            var request = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>(IdParam, PrepareUserField.Data[resourceId].First().ToString()),
                new KeyValuePair <string, string>(SelectParam, Select.DisplayLabel.GetEnumStringValue())
            };
            var duplicateParam = param == ReadParam.Id ? IdParam : SelectParam;
            var duplicateValue = string.Empty;

            if (dupType == Enums.ValidDuplicated.SameValue)
            {
                duplicateValue = request.Where(x => x.Key == duplicateParam).FirstOrDefault().Value;
            }
            else
            {
                duplicateValue = duplicateParam == IdParam ? PrepareUserField.Data[resourceId].Last().ToString() : Select.DisplayCaption.GetEnumStringValue();
            }
            request.Add(new KeyValuePair <string, string>(duplicateParam, duplicateValue));
            var defaultManager = new DefaultManager();
            var result         = defaultManager.Send <FieldDetailsResponse>(FieldManager.FieldHandlingRelativeUrl, request, HttpMethod.GET);

            PrAssert.That(result, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not read field details");
            foreach (var item in request)
            {
                if (item.Key == IdParam)
                {
                    PrAssert.That(result.Result.Values[Guid.Parse(item.Value)].Id, PrIs.Not.Null.Or.Empty);
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            //调试解析过程开关
            Switchs.DebugParse = false;
            //调试解释执行过程
            Switchs.DebugInterpret = true;
            ConsoleParam param = ReadParam.Read();
            JVM          jvm   = new JVM();

            jvm.StartJVM(param);

            Console.Read();
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mainw_Loaded(object sender, RoutedEventArgs e)
        {
            this.update_color  = false;
            this.w_rgb_index   = 0;
            this.w_depth_index = 0;
            ///初始化共享内存
            this.SHrgb        = new ShareMem();
            this.SHdepth      = new ShareMem();
            this.SHpointcloud = new ShareMem();
            if (0 != this.SHrgb.Init("_sharemem_for_colorpixels_", 921604))
            {
                this.exit("shared memory initial error.");
            }
            if (0 != this.SHdepth.Init("_sharemem_for_depthpixels_", 921604))
            {
                this.exit("shared memory initial error.");
            }
            if (0 != this.SHpointcloud.Init("_sharemem_for_point_cloud_", 3686404))
            {
                this.exit("shared memory initial error.");
            }

            this.SHrgb_py        = new ShareMem();
            this.SHdepth_py      = new ShareMem();
            this.SHpointcloud_py = new ShareMem();
            if (0 != this.SHrgb_py.Init("_sharemem_for_colorpixels_cspy", 921604))
            {
                this.exit("shared memory initial error.");
            }
            if (0 != this.SHdepth_py.Init("_sharemem_for_depthpixels_cspy", 921604))
            {
                this.exit("shared memory initial error.");
            }
            if (0 != this.SHpointcloud_py.Init("_sharemem_for_point_cloud_cspy", 3686404))
            {
                this.exit("shared memory initial error.");
            }

            string exename       = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            string directoryName = Path.GetDirectoryName(exename);

            this.Visibility = System.Windows.Visibility.Hidden;
            this.tr         = new tem2rgb(directoryName + "//tem_rgb.txt");
            this.rp         = new ReadParam();
            this.rp.GetTransitMatrix(directoryName + "//installtion_param.txt");
            this.fg_flg = this.rp.GetGroundParam(directoryName + "//groundfilter_param.txt");

            foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    this.sensor = potentialSensor;
                    break;
                }
            }

            if (null != this.sensor)
            {
                this.sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
                this.sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
                this.colorPixels     = new byte[921604];
                this.rwcolorPixels   = new byte[this.sensor.ColorStream.FramePixelDataLength];
                this.depthPixels     = new byte[921604];
                this.rawdepthPixels  = new DepthImagePixel[this.sensor.DepthStream.FramePixelDataLength];
                this.pointcloudbytes = new byte[3686404];
                this.cali_points     = new ColorImagePoint[640 * 480];
                this.camera_calib    = new CoordinateMapper(this.sensor);

                this.sensor.ColorFrameReady += this.SensorColorFrameReady;
                this.sensor.DepthFrameReady += this.SensorDepthFrameReady;

                try
                {
                    this.sensor.Start();
                }
                catch (IOException)
                {
                    this.sensor = null;
                    this.exit("");
                }

                Thread t = new Thread(new ThreadStart(this.updatecolor));
                t.Start();
            }
            else
            {
                this.exit("no kinect found. program ended.");
            }
        }