public void Serialize_Unrecognized()
        {
            var test1 = new Unrecognized {
                A = 3, B = 27
            };
            var raw    = OrleansSerializationLoop(environment.Serializer, environment.DeepCopier, test1, false);
            var result = Assert.IsAssignableFrom <Unrecognized>(raw); //Type is wrong after deep copy of unrecognized

            Assert.Equal(3, result.A);                                //Property A is wrong after deep copy of unrecognized"
            Assert.Equal(27, result.B);                               //Property B is wrong after deep copy of unrecognized"

            var test2 = new Unrecognized[3];

            for (int i = 0; i < 3; i++)
            {
                test2[i] = new Unrecognized {
                    A = i, B = 2 * i
                };
            }
            raw = OrleansSerializationLoop(environment.Serializer, environment.DeepCopier, test2);
            Assert.IsAssignableFrom <Unrecognized[]>(raw); //Type is wrong after round trip of array of unrecognized
            var result2 = (Unrecognized[])raw;

            Assert.Equal(3, result2.Length); //Array length is wrong after round trip of array of unrecognized
            for (int j = 0; j < 3; j++)
            {
                Assert.Equal(j, result2[j].A);     //Property A at index " + j + "is wrong after round trip of array of unrecognized
                Assert.Equal(2 * j, result2[j].B); //Property B at index " + j + "is wrong after round trip of array of unrecognized
            }
        }
示例#2
0
        private void Update()
        {
            Capture?.Dispose();
            Capture = BitmapFactory.CreateScreenCapture(CaptureX, CaptureY, CaptureWidth, CaptureHeight, CaptureGrayScale, CaptureScale);
            using (var page = TesseractEngine.Process(Capture, PageSegMode.SingleChar | PageSegMode.SingleLine))
            {
                decimal value;
                if (decimal.TryParse(page.GetText(), NumberStyles.Number, CultureInfo.InvariantCulture, out value))
                {
                    Value = value;
                    LogBuilder.AppendLine(string.Format("[{0}] : {1}", DateTime.Now.ToString(), value));
                    SpeechMessage = new Prompt(string.Format("{0}\n{1}", Title, value));

                    Recognized?.Invoke(this, value, Capture);
                }
                else
                {
                    LogBuilder.AppendLine(string.Format("[{0}] : {1}", DateTime.Now.ToString(), Resources.Unrecognized));
                    SpeechMessage = new Prompt(string.Format("{0}\n{1}", Title, Resources.Unrecognized));
                    Unrecognized?.Invoke(this, Capture);
                }
                if (NotifyEnabled)
                {
                    SpeechSynthesizer.SpeakAsync(SpeechMessage);
                }
            }
        }
示例#3
0
 internal void RaiseUnrecognized(IModbusChannel channel, IReadOnlyList <byte> errorMessage)
 => Unrecognized?.Invoke(this, new UnrecognizedEventArgs(channel, errorMessage));