Пример #1
0
        public override void Init()
        {
            base.Init();

            //const string weightFileName = "edges2cats_AtoB.pict";
            const string weightFileName = "edges2pikachu_AtoB.pict";

            var filePath = System.IO.Path.Combine
                               (Application.streamingAssetsPath, weightFileName);

            _shader = Shader.Find("Hidden/Pix2Pix/PostProcessing");

            _weightTable = WeightReader.ReadFromFile(filePath);
            _generator   = new Generator(_weightTable);

            _sourceRT = new RenderTexture(256, 256, 0);
            _resultRT = new RenderTexture(256, 256, 0);
            _resultRT.enableRandomWrite = true;

            _sourceRT.hideFlags = HideFlags.DontSave;
            _resultRT.hideFlags = HideFlags.DontSave;

            _sourceRT.Create();
            _resultRT.Create();
        }
Пример #2
0
        private void btnWeight2_Click(object sender, RoutedEventArgs e)
        {
            WeightReader reader = new WeightReader();

            reader.ShowDialog();
            CurrentWeightTicket.ExitWeightKg = reader.Weight;
            CurrentWeightTicket.RaiseUpdateProperties();
            presenter.CalculateTotals();
        }
Пример #3
0
        private void StartWeightReaderService()
        {
            if (_wr != null)
            {
                _wr.Dispose();
            }

            if (cbPort.Text != "" && cbBot.Text != "")
            {
                _wr = new WeightReader();
                _wr.InitCom(cbPort.Text, Convert.ToInt32(cbBot.Text), 300);
                _wr.sp.ReadTimeout   = 1000;
                _wr.sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
            }
        }
Пример #4
0
        public async Task <JsonResult> GetWeihhtData()
        {
            var rest = new JsonResult();

            rest.JsonRequestBehavior = JsonRequestBehavior.AllowGet;//允许使用GET方式获取,否则用GET获取是会报错。

            Apps.IService.SCV.ISCVServiceSession scvSession = OpeCur.SCVServiceSession;
            SHIPPING_CONTAINER_MODEL             model      = new SHIPPING_CONTAINER_MODEL();

            try
            {
                //判断串口种类
                string[] portList = SerialPort.GetPortNames();

                WeightReader weRea = new WeightReader();

                //初始化串口
                isInisitil = weRea.InitCom("COM3");
                try
                {
                    WeightReader ww = new WeightReader();

                    if (!isInisitil)
                    {
                        weRea.InitCom("COM3");
                    }
                    WeightInformation info = await Task.Run(() => { return(ww.ReadInfo()); });

                    model.WEIGHT = Convert.ToDecimal(info.WData);
                }
                catch (Exception ex)
                {
                    LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, ex.ToString(), "失败", "修改", "用户设置");
                    model.WEIGHT = 0;
                }
                rest.Data = model;
            }
            catch (Exception ex)
            {
                LogHandler.WriteServiceLog(OpeCur.AccountNow.Id, ex.ToString(), "失败", "修改", "用户设置");
                model.WEIGHT = 0;
                rest.Data    = model;
                return(rest);
            }

            return(rest);
        }
        public override void Release()
        {
            if (_generator != null)
            {
                _generator.Dispose();
                _generator = null;
            }

            if (_weightTable != null)
            {
                WeightReader.DisposeTable(_weightTable);
                _weightTable = null;
            }

            RuntimeUtilities.Destroy(_sourceRT);
            RuntimeUtilities.Destroy(_resultRT);

            base.Release();
        }