private void CheckDisplayedWeight()
        {
            DisplayedWeightStatus weightStatus = DisplayedWeightStatus.Invalid;
            string weight = "";

            Communication.PeripheralStatus status = ScaleSampleManager.GetScaleDisplayedWeight(port, ref weightStatus, ref weight);

            if (status == Communication.PeripheralStatus.Impossible)
            {
                OnPrinterImpossible();

                return;
            }

            switch (weightStatus)
            {
            default:
            case DisplayedWeightStatus.Zero:
                OnZeroWeight(weight);
                break;

            case DisplayedWeightStatus.NotInMotion:
                OnNotInMotionWeight(weight);
                break;

            case DisplayedWeightStatus.Motion:
                OnMotionWeight(weight);
                break;
            }
        }
Example #2
0
        public override void Execute(object parameter)
        {
            Communication.PeripheralStatus result       = Communication.PeripheralStatus.Invalid;
            DisplayedWeightStatus          weightStatus = DisplayedWeightStatus.Invalid;
            string weight = "";

            result = ScaleSampleManager.CallScaleFunctionWithProgressBar(Type, ref weightStatus, ref weight);

            if (result != Communication.PeripheralStatus.Connect ||
                Type == ScallFunctionType.CheckStatus)
            {
                Communication.ShowPeripheralStatusResultMessage("Scale", result);

                return;
            }

            switch (Type)
            {
            default:
                Util.ShowMessage("Communication Result", "Success");
                break;

            case ScallFunctionType.DisplayedWeight:
                ShowScaleDisplayedWeight(result, weightStatus, weight);
                break;
            }
        }
        private Communication.PeripheralStatus SendUnitChangeCommands()
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            lock (lockObject)
            {
                result = ScaleSampleManager.SendUnitChangeCommands(port);
            }

            return(result);
        }
        private void CheckScaleStatus()
        {
            scaleStatus = ScaleSampleManager.GetScaleStatus(port);

            switch (scaleStatus)
            {
            default:
            case Communication.PeripheralStatus.Impossible:
                OnPrinterImpossible();
                break;

            case Communication.PeripheralStatus.Connect:
                OnScaleConnect();
                break;

            case Communication.PeripheralStatus.Disconnect:
                OnScaleDisconnect();
                break;
            }
        }