Exemplo n.º 1
0
        private void TestException(Errors value)
        {
            Foo foo = new Foo();

            try
            {
                foo.DoBar((uint)value);
            }
            catch (Exception ex)
            {
                string outputString = String.Format("0x{0:X}, {1}, {2}\r\n", (uint)value, value, ex.GetType());
                Output.Text += outputString;
            }
        }
Exemplo n.º 2
0
        private Task TestRange(uint start, uint count)
        {
            return Task.Run(() =>
            {
                Foo foo = new Foo();

                uint end = start + count;
                for (uint value = start; value < end; value++)
                {
                    try
                    {
                        foo.DoBar((uint)value);
                    }
                    catch (Exception ex)
                    {
                        if (ex.GetType() != typeof(System.Exception))
                        {
                            var asyncInfo = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                            {
                                Output.Text += String.Format("0x{0:X}, {1}\r\n", value, ex.GetType());
                            });
                        }
                    }

                    // Add a stupid delay.
                    if (value % 0x80 == 0)
                    {
                        var delayTask = Task.Delay(500);
                        delayTask.Wait();
                    }
                }
            });
        }