diff --git a/.gitignore b/.gitignore index fa57f55d..644e9c56 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,5 @@ packages *.vs *.opendb *.db -/v6.x-preview/Build/ -/v6.x-preview/Examples/lastbuild.txt \ No newline at end of file +Build/ +Examples/lastbuild.txt \ No newline at end of file diff --git a/Examples/AssemblyInfoCommon.cs b/Examples/AssemblyInfoCommon.cs index 81516338..6e2c9cfa 100644 --- a/Examples/AssemblyInfoCommon.cs +++ b/Examples/AssemblyInfoCommon.cs @@ -1,11 +1,11 @@ // ************************************************************************************* -// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved. +// SCICHARTВ® Copyright SciChart Ltd. 2011-2022. All rights reserved. // // Web: http://www.scichart.com // Support: support@scichart.com // Sales: sales@scichart.com // -// AssemblyInfoCommon.cs is part of SCICHART®, High Performance Scientific Charts +// AssemblyInfoCommon.cs is part of SCICHARTВ®, High Performance Scientific Charts // For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/ // // This source code is protected by international copyright law. Unauthorized @@ -23,8 +23,8 @@ //[assembly: Obfuscation(Feature = "msil encryption, string encryption, value encryption", Exclude = true, StripAfterObfuscation = true)] [assembly: AssemblyCompany("SciChart Ltd")] -[assembly: AssemblyCopyright("Copyright © SciChart Ltd 2011-2019, www.scichart.com")] -[assembly: AssemblyTrademark("SCICHART™")] +[assembly: AssemblyCopyright("Copyright В© SciChart Ltd 2011-2022, www.scichart.com")] +[assembly: AssemblyTrademark("SCICHARTв„ў")] //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("PublicPrivateKeyFile.snk")] @@ -39,4 +39,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("6.0.0.12343")] + +// NOTE: MASTER SHOULD KEEP THIS AS V7.x WHEN MERGING. +// This is to prevent conflicts in teamcity when tests are run on both master & v6 branch at the same time. +[assembly: AssemblyVersion("6.6.0.26595")] diff --git a/Examples/Libs/Interactivity/System.Windows.Interactivity.dll b/Examples/Libs/Interactivity/System.Windows.Interactivity.dll deleted file mode 100644 index 0419e95f..00000000 Binary files a/Examples/Libs/Interactivity/System.Windows.Interactivity.dll and /dev/null differ diff --git a/Examples/Libs/WPFToolkit/System.Windows.Controls.Input.Toolkit.dll b/Examples/Libs/WPFToolkit/System.Windows.Controls.Input.Toolkit.dll deleted file mode 100644 index 2e924faa..00000000 Binary files a/Examples/Libs/WPFToolkit/System.Windows.Controls.Input.Toolkit.dll and /dev/null differ diff --git a/Examples/Libs/WPFToolkit/WPFToolkit.dll b/Examples/Libs/WPFToolkit/WPFToolkit.dll deleted file mode 100644 index c4b89ed5..00000000 Binary files a/Examples/Libs/WPFToolkit/WPFToolkit.dll and /dev/null differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/AutomationTestBase.cs b/Examples/SciChart.Examples.Demo.SmokeTests/AutomationTestBase.cs new file mode 100644 index 00000000..716863a3 --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/AutomationTestBase.cs @@ -0,0 +1,286 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Media.Imaging; +using FlaUI.Core.AutomationElements; +using FlaUI.Core.Tools; +using NUnit.Framework; + +namespace SciChart.Examples.Demo.SmokeTests +{ + public class AutomationTestBase + { + public const double DefaultDpiX = 96.0; + public const double DefaultDpiY = 96.0; + public const int BigWaitTimeout = 5000; + public const int SmallWaitTimeout = 1000; + + public static string ResourcesPath = @"SciChart\Examples\Demo\SmokeTests\Resources\Expectations\"; + public static string ExportActualPath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + "SciChart", + "SciChartAutomationTests_v6", // NOTE FOR MERGES: Master/v6 branch must have different folders here to avoid conflict in teamcity + "Actuals"); + + static AutomationTestBase() + { + // Delete export actuals before test run + if (Directory.Exists(ExportActualPath)) + { + Console.WriteLine("Deleting AutomationTestBase.ExportActualPath: " + ExportActualPath); + Directory.Delete(ExportActualPath, true); + + Console.WriteLine("Creating AutomationTestBase.ExportActualPath: " + ExportActualPath); + Directory.CreateDirectory(ExportActualPath); + } + } + + public void ExportActual(WriteableBitmap actualBitmap, string fileName) + { + if (!Directory.Exists(ExportActualPath)) + { + Directory.CreateDirectory(ExportActualPath); + } + + var pathString = Path.Combine(ExportActualPath, fileName); + + if (Path.GetExtension(fileName).ToUpper() == ".BMP") + { + SaveToBmp(pathString, actualBitmap); + } + else + { + SaveToPng(pathString, actualBitmap); + } + + ProcessStartInfo startInfo = new ProcessStartInfo(pathString); + Process.Start(startInfo); + } + + public bool CompareBitmaps(string resourceName, WriteableBitmap actual, WriteableBitmap expected, double allowableErrorPercent = 1) + { + try + { + double averageError = 0.0, maxError = double.MinValue; + + Assert.That(new Size(actual.PixelWidth, actual.PixelHeight), Is.EqualTo(new Size(expected.PixelWidth, expected.PixelHeight)), "Image sizes are different!"); + + var px1 = actual.ToByteArray(); + var px2 = expected.ToByteArray(); + + Assert.That(px1.Length, Is.EqualTo(px2.Length), "Image pixel counts are different sizes!"); + + var areEqual = true; + + for (int i = 0; i < px1.Length; i += 4) + { + var b1 = px1[i]; + var g1 = px1[i + 1]; + var r1 = px1[i + 2]; + var a1 = px1[i + 3]; + + var b2 = px2[i]; + var g2 = px2[i + 1]; + var r2 = px2[i + 2]; + var a2 = px2[i + 3]; + + // Use Euclidean distance to find the difference + var error = Math.Sqrt((a1 - a2) * (a1 - a2) + (r1 - r2) * (r1 - r2) + (g1 - g2) * (g1 - g2) + (b1 - b2) * (b1 - b2)); + + averageError += error; + maxError = Math.Max(error, maxError); + } + + // Compute average Euclidean distance + averageError /= (actual.PixelWidth * actual.PixelHeight * 5.10); + maxError /= 5.10; + if (averageError > allowableErrorPercent) + { + // Error threshold exceeded + areEqual = false; + } + + /* + * Image comparison by comparing hash-codes. Taken from + * http://www.codeproject.com/Articles/9299/Comparing-Images-using-GDI + * + SHA256Managed shaM = new SHA256Managed(); + byte[] hash1 = shaM.ComputeHash(px1); + byte[] hash2 = shaM.ComputeHash(px2); + + //Compare the hash values + for (int i = 0; i < hash1.Length && i < hash2.Length + && cr == CompareResult.ciCompareOk; i++) + { + if (hash1[i] != hash2[i]) + cr = CompareResult.ciPixelMismatch; + } + */ + string message = $"Resource: {resourceName}, Image AveError: {averageError}%, Allowable AveError: {allowableErrorPercent}%, MaxError: {maxError}%"; + Assert.That(areEqual, message); + Console.WriteLine(message); + + return true; + } + catch + { + // Output diff file + SaveDiffImages(resourceName, expected, actual); + + throw; + } + } + + public void SaveToPng(string fileName, WriteableBitmap bmp) + { + var path = Path.GetDirectoryName(fileName); + + if (!string.IsNullOrEmpty(path)) + { + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); + //pngEncoder.Palette = new BitmapPalette(bmp, int.MaxValue); + pngEncoder.Frames.Add(BitmapFrame.Create(bmp)); + + using (var fileStream = File.Create(fileName)) + { + pngEncoder.Save(fileStream); + } + } + } + + public void SaveDiffImages(string resourceName, WriteableBitmap expectedBitmap, WriteableBitmap actualBitmap) + { + string expectedPath = Path.Combine(ExportActualPath, + Path.GetFileNameWithoutExtension(resourceName) + "-expected.png"); + + string actualPath = Path.Combine(ExportActualPath, + Path.GetFileNameWithoutExtension(resourceName) + "-actual.png"); + + SaveToPng(expectedPath, expectedBitmap); + Console.WriteLine(@"Expected bitmap saved to " + expectedPath); + + SaveToPng(actualPath, actualBitmap); + Console.WriteLine(@"Actual bitmap saved to " + actualPath); + + var byteExpected = expectedBitmap.ToByteArray(); + var byteActual = actualBitmap.ToByteArray(); + if (byteExpected.Length == byteActual.Length) + { + var byteDiff = new byte[byteExpected.Length]; + for (int i = 0; i < byteExpected.Length; i++) + { + // For alpha use the average of both images (otherwise pixels with the same alpha won't be visible) + if ((i + 1) % 4 == 0) + byteDiff[i] = (byte)((byteActual[i] + byteExpected[i]) / 2); + else + byteDiff[i] = (byte)Math.Abs(byteActual[i] - byteExpected[i]); + } + var diffBmp = new WriteableBitmap(expectedBitmap.PixelWidth, expectedBitmap.PixelHeight, expectedBitmap.DpiX, + expectedBitmap.DpiY, expectedBitmap.Format, expectedBitmap.Palette); + diffBmp.WritePixels(new Int32Rect(0, 0, expectedBitmap.PixelWidth, expectedBitmap.PixelHeight), byteDiff, + expectedBitmap.BackBufferStride, 0); + + string diffPath = Path.Combine(ExportActualPath, Path.GetFileNameWithoutExtension(resourceName) + "-diff.png"); + + SaveToPng(diffPath, diffBmp); + Console.WriteLine(@"Difference bitmap saved to " + diffPath); + } + } + + public void SaveToBmp(string fileName, WriteableBitmap bmp) + { + BmpBitmapEncoder bmpEncoder = new BmpBitmapEncoder(); + //pngEncoder.Palette = new BitmapPalette(bmp, int.MaxValue); + bmpEncoder.Frames.Add(BitmapFrame.Create(bmp)); + + using (var fileStream = File.Create(fileName)) + { + bmpEncoder.Save(fileStream); + } + } + + public WriteableBitmap LoadResource(string resourceName) + { + resourceName = resourceName.Replace("/", "."); + WriteableBitmap expectedBitmap = null; + var assembly = GetType().Assembly; + + // For testing purposes, to see all the resources available + var resourcePath = assembly.GetManifestResourceNames().FirstOrDefault(x => x.ToUpper().Contains(resourceName.ToUpper())); + + using (var resourceStream = assembly.GetManifestResourceStream(resourcePath)) + { + expectedBitmap = Path.GetExtension(resourceName).ToUpper() == ".BMP" + ? DecodeBmpStream(resourceStream) + : DecodePngStream(resourceStream); + } + + return expectedBitmap; + } + + public WriteableBitmap LoadFromPng(string fileName) + { + WriteableBitmap bmp; + + using (var fileStream = File.OpenRead(fileName)) + { + bmp = DecodePngStream(fileStream); + } + + return bmp; + } + + public T WaitForElement(Func getter) + { + var retry = Retry.WhileNull( + getter, + TimeSpan.FromMilliseconds(BigWaitTimeout)); + + if (!retry.Success) + { + Assert.Fail($"Failed to get an element within a {BigWaitTimeout}ms"); + } + + return retry.Result; + } + + public void WaitUntilClosed(AutomationElement element) + { + var result = Retry.WhileFalse(() => element.IsOffscreen, TimeSpan.FromMilliseconds(BigWaitTimeout)); + if (!result.Success) + { + Assert.Fail($"Element failed to go offscreen within {BigWaitTimeout}ms"); + } + } + + public string GetTemporaryDirectory() + { + string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + Directory.CreateDirectory(tempDirectory); + return tempDirectory; + } + + private WriteableBitmap DecodePngStream(Stream pngStream) + { + var decoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); + BitmapSource bitmapSource = decoder.Frames[0]; + + return new WriteableBitmap(bitmapSource); + } + + private WriteableBitmap DecodeBmpStream(Stream bmpStream) + { + var decoder = new BmpBitmapDecoder(bmpStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); + BitmapSource bitmapSource = decoder.Frames[0]; + + return new WriteableBitmap(bitmapSource); + } + } +} diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Properties/AssemblyInfo.cs b/Examples/SciChart.Examples.Demo.SmokeTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..776c6e32 --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/Properties/AssemblyInfo.cs @@ -0,0 +1,21 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SciChart.Examples.Demo.SmokeTests")] +[assembly: AssemblyDescription("Smoke tests using UIAutomation for SciChart.Examples.Demo")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("SciChart.Examples.Demo.SmokeTests")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d84afec6-7942-4c57-ad80-96e7d33e7e34")] + diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/AnnotationsAreEasy.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/AnnotationsAreEasy.png new file mode 100644 index 00000000..2cd55d86 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/AnnotationsAreEasy.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CompositeAnnotations.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CompositeAnnotations.png new file mode 100644 index 00000000..bc34e23b Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CompositeAnnotations.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CreateAnnotationsDynamically.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CreateAnnotationsDynamically.png new file mode 100644 index 00000000..aea5372d Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/CreateAnnotationsDynamically.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DatapointMarkers.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DatapointMarkers.png new file mode 100644 index 00000000..c640e970 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DatapointMarkers.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DragHorizontalThreshold.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DragHorizontalThreshold.png new file mode 100644 index 00000000..f0893f20 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/DragHorizontalThreshold.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/InteractionWithAnnotations.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/InteractionWithAnnotations.png new file mode 100644 index 00000000..ac01199a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/InteractionWithAnnotations.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/PolarChartAnnotations.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/PolarChartAnnotations.png new file mode 100644 index 00000000..f0b991cb Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/PolarChartAnnotations.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeAnnotations.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeAnnotations.png new file mode 100644 index 00000000..186c957f Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeAnnotations.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeMarkers.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeMarkers.png new file mode 100644 index 00000000..f3b4f0dd Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ChartAnnotations/TradeMarkers.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingDonutChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingDonutChart.png new file mode 100644 index 00000000..c489f98b Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingDonutChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingPieChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingPieChart.png new file mode 100644 index 00000000..cfd007f5 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateGaugeChart/UsingPieChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BandSeriesChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BandSeriesChart.png new file mode 100644 index 00000000..39d27e75 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BandSeriesChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BoxPlot.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BoxPlot.png new file mode 100644 index 00000000..0444c5dd Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BoxPlot.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BubbleChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BubbleChart.png new file mode 100644 index 00000000..4c1a1a6a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/BubbleChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/CandlestickChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/CandlestickChart.png new file mode 100644 index 00000000..a2a598e0 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/CandlestickChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ColumnChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ColumnChart.png new file mode 100644 index 00000000..c8f84b9c Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ColumnChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalBandSeriesChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalBandSeriesChart.png new file mode 100644 index 00000000..ae3427ec Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalBandSeriesChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalLineChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalLineChart.png new file mode 100644 index 00000000..ddad1f49 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalLineChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalMountainChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalMountainChart.png new file mode 100644 index 00000000..457c473a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/DigitalMountainChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ImpulseStemChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ImpulseStemChart.png new file mode 100644 index 00000000..d665bd5e Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ImpulseStemChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/LineChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/LineChart.png new file mode 100644 index 00000000..2ff78195 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/LineChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/MountainChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/MountainChart.png new file mode 100644 index 00000000..32d8d6cc Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/MountainChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/PolarChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/PolarChart.png new file mode 100644 index 00000000..b36c7860 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/PolarChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ScatterChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ScatterChart.png new file mode 100644 index 00000000..b281ed95 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CreateSimpleChart/ScatterChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CustomCharts/SplineScatterChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CustomCharts/SplineScatterChart.png new file mode 100644 index 00000000..30fea3bb Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/CustomCharts/SplineScatterChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ExportCharts/ExportChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ExportCharts/ExportChart.png new file mode 100644 index 00000000..f432b57a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ExportCharts/ExportChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Filters/FiltersApiExample.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Filters/FiltersApiExample.png new file mode 100644 index 00000000..0b7c57cf Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Filters/FiltersApiExample.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapAndPaletteProvider.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapAndPaletteProvider.png new file mode 100644 index 00000000..807631a0 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapAndPaletteProvider.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapMetaData.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapMetaData.png new file mode 100644 index 00000000..ed472aec Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapMetaData.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapRealTime.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapRealTime.png new file mode 100644 index 00000000..26d9f5e2 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapRealTime.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapWithText.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapWithText.png new file mode 100644 index 00000000..df9f4370 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/HeatmapWithText.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/NonUniformHeatmap.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/NonUniformHeatmap.png new file mode 100644 index 00000000..4eab8680 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Heatmaps/NonUniformHeatmap.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Legends/LegendsAPI.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Legends/LegendsAPI.png new file mode 100644 index 00000000..26c029a1 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/Legends/LegendsAPI.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/AxisAnnotationBinding.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/AxisAnnotationBinding.png new file mode 100644 index 00000000..e2068d87 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/AxisAnnotationBinding.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindMultipleCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindMultipleCharts.png new file mode 100644 index 00000000..89629e8c Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindMultipleCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindSciChartToData.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindSciChartToData.png new file mode 100644 index 00000000..ec64d9bf Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/BindSciChartToData.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/ManipulateSeriesMvvm.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/ManipulateSeriesMvvm.png new file mode 100644 index 00000000..f837c475 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/ManipulateSeriesMvvm.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SeriesBinding.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SeriesBinding.png new file mode 100644 index 00000000..a8522a79 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SeriesBinding.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SyncCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SyncCharts.png new file mode 100644 index 00000000..18101d34 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MVVMExamples/SyncCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/AddRemoveSeries.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/AddRemoveSeries.png new file mode 100644 index 00000000..b5add736 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/AddRemoveSeries.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeRenderableSeriesType.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeRenderableSeriesType.png new file mode 100644 index 00000000..74ad8233 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeRenderableSeriesType.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeSeriesType.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeSeriesType.png new file mode 100644 index 00000000..18997902 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ManipulateSeries/ChangeSeriesType.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CategoryVsValueAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CategoryVsValueAxis.png new file mode 100644 index 00000000..d660e545 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CategoryVsValueAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CentralXYAxes.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CentralXYAxes.png new file mode 100644 index 00000000..953fcc44 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/CentralXYAxes.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/LogarithmicAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/LogarithmicAxis.png new file mode 100644 index 00000000..f299effa Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/LogarithmicAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/ModifyAxisProperties.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/ModifyAxisProperties.png new file mode 100644 index 00000000..ff51c80e Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/ModifyAxisProperties.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleXAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleXAxis.png new file mode 100644 index 00000000..ef8cfa0b Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleXAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleYAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleYAxis.png new file mode 100644 index 00000000..eb8df7e8 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/MultipleYAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/PolarChartManyAxes.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/PolarChartManyAxes.png new file mode 100644 index 00000000..d66699d5 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/PolarChartManyAxes.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SecondaryYAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SecondaryYAxis.png new file mode 100644 index 00000000..f7e8bd43 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SecondaryYAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SwitchAxisTypeRuntime.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SwitchAxisTypeRuntime.png new file mode 100644 index 00000000..bb91c262 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/SwitchAxisTypeRuntime.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticalCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticalCharts.png new file mode 100644 index 00000000..f6a4d28c Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticalCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticallyStackedYAxis.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticallyStackedYAxis.png new file mode 100644 index 00000000..5498a3ce Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ModifyAxisBehavior/VerticallyStackedYAxis.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/CandlestickAndLines.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/CandlestickAndLines.png new file mode 100644 index 00000000..50185424 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/CandlestickAndLines.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ContoursWithHeatmap.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ContoursWithHeatmap.png new file mode 100644 index 00000000..1a8ccab1 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ContoursWithHeatmap.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardPolarCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardPolarCharts.png new file mode 100644 index 00000000..f62e5dd4 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardPolarCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardStyleCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardStyleCharts.png new file mode 100644 index 00000000..699f3c6f Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/DashboardStyleCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ErrorBars.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ErrorBars.png new file mode 100644 index 00000000..fae93c85 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/ErrorBars.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/FanChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/FanChart.png new file mode 100644 index 00000000..696c8104 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/FanChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/GapsInSeries.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/GapsInSeries.png new file mode 100644 index 00000000..9f2ba932 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/GapsInSeries.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/LineAndScatterChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/LineAndScatterChart.png new file mode 100644 index 00000000..e7db552e Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/LineAndScatterChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedBarChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedBarChart.png new file mode 100644 index 00000000..e0fbbcf4 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedBarChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnChart.png new file mode 100644 index 00000000..7be2182f Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnSideBySide.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnSideBySide.png new file mode 100644 index 00000000..1f730231 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedColumnSideBySide.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedMountainChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedMountainChart.png new file mode 100644 index 00000000..d640df86 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/MultiseriesCharts/StackedMountainChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChart.png new file mode 100644 index 00000000..9eb13770 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChartCustomization.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChartCustomization.png new file mode 100644 index 00000000..5bcfb359 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/RadarCharts/RadarChartCustomization.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/MultiPaneStockChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/MultiPaneStockChart.png new file mode 100644 index 00000000..a87fbca8 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/MultiPaneStockChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/RealtimeTickingCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/RealtimeTickingCharts.png new file mode 100644 index 00000000..feefab70 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/RealtimeTickingCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/UsingSciStockChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/UsingSciStockChart.png new file mode 100644 index 00000000..a2e2c60d Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StockCharts/UsingSciStockChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/CustomTheme.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/CustomTheme.png new file mode 100644 index 00000000..2512d889 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/CustomTheme.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/DashedLineStyling.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/DashedLineStyling.png new file mode 100644 index 00000000..ff3b9544 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/DashedLineStyling.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UseHQRendering.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UseHQRendering.png new file mode 100644 index 00000000..111f8ca2 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UseHQRendering.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPaletteProvider.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPaletteProvider.png new file mode 100644 index 00000000..7db3d8c2 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPaletteProvider.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPointMarkers.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPointMarkers.png new file mode 100644 index 00000000..dd0766cd Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingPointMarkers.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingThemeManager.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingThemeManager.png new file mode 100644 index 00000000..2c9655ea Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/UsingThemeManager.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/Xaml Styling.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/Xaml Styling.png new file mode 100644 index 00000000..539ce65d Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/StylingTheming/Xaml Styling.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/SyncCharts/SyncCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/SyncCharts/SyncCharts.png new file mode 100644 index 00000000..d3a9768e Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/SyncCharts/SyncCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ErrorBarTernaryChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ErrorBarTernaryChart.png new file mode 100644 index 00000000..501fb626 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ErrorBarTernaryChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/PolygonTernaryChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/PolygonTernaryChart.png new file mode 100644 index 00000000..4a5bfb43 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/PolygonTernaryChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ScatterTernaryChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ScatterTernaryChart.png new file mode 100644 index 00000000..8286852b Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TernaryCharts/ScatterTernaryChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/CustomPointMarker.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/CustomPointMarker.png new file mode 100644 index 00000000..7a84f021 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/CustomPointMarker.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/HitTestAPI.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/HitTestAPI.png new file mode 100644 index 00000000..9fcc4e48 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/HitTestAPI.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/PointMarkersSelection.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/PointMarkersSelection.png new file mode 100644 index 00000000..3d967a7e Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/PointMarkersSelection.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesSelection.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesSelection.png new file mode 100644 index 00000000..09e4f21a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesSelection.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesWithMetadata.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesWithMetadata.png new file mode 100644 index 00000000..dc6a50f8 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/SeriesWithMetadata.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/TooltipsAndModifiers.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/TooltipsAndModifiers.png new file mode 100644 index 00000000..c73dfcb3 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/TooltipsAndModifiers.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/Using TooltipModifier.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/Using TooltipModifier.png new file mode 100644 index 00000000..cfbcdfa5 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/Using TooltipModifier.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingCursorModifier.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingCursorModifier.png new file mode 100644 index 00000000..e8a5cd22 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingCursorModifier.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingRolloverModifier.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingRolloverModifier.png new file mode 100644 index 00000000..464ce4ff Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingRolloverModifier.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingVerticalSlice.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingVerticalSlice.png new file mode 100644 index 00000000..176392cd Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/TooltipsAndHitTests/UsingVerticalSlice.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/UndoRedo.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/UndoRedo.png new file mode 100644 index 00000000..0b4ae82a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/UndoRedo.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/ZoomHistoryMVVM.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/ZoomHistoryMVVM.png new file mode 100644 index 00000000..567bfcb4 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomHistory/ZoomHistoryMVVM.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/CustomOverviewControl.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/CustomOverviewControl.png new file mode 100644 index 00000000..123c4bcf Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/CustomOverviewControl.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAreaToZoom.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAreaToZoom.png new file mode 100644 index 00000000..d98fd70c Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAreaToZoom.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAxisToScale.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAxisToScale.png new file mode 100644 index 00000000..127b79f0 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/DragAxisToScale.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/MousewheelZoomScroll.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/MousewheelZoomScroll.png new file mode 100644 index 00000000..982b6432 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/MousewheelZoomScroll.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/OverviewControl.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/OverviewControl.png new file mode 100644 index 00000000..c1d6a88a Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/OverviewControl.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanOnMouseDrag.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanOnMouseDrag.png new file mode 100644 index 00000000..bb283050 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanOnMouseDrag.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanYXDirection.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanYXDirection.png new file mode 100644 index 00000000..562440bd Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PanYXDirection.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PerAxisScrollbars.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PerAxisScrollbars.png new file mode 100644 index 00000000..f220b8dc Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts2D/ZoomPan/PerAxisScrollbars.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/ClosedSurfaceMesh3D.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/ClosedSurfaceMesh3D.png new file mode 100644 index 00000000..8e672e5d Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/ClosedSurfaceMesh3D.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleBubble3DChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleBubble3DChart.png new file mode 100644 index 00000000..31f9cb57 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleBubble3DChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleCylindroid3DChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleCylindroid3DChart.png new file mode 100644 index 00000000..1e896740 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleCylindroid3DChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleEllipsoid3DChart.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleEllipsoid3DChart.png new file mode 100644 index 00000000..9c2b564b Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/BasicChartTypes/SimpleEllipsoid3DChart.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/SurfaceMesh/NonUniformSurfaceMesh.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/SurfaceMesh/NonUniformSurfaceMesh.png new file mode 100644 index 00000000..83c80822 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/Charts3D/SurfaceMesh/NonUniformSurfaceMesh.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/FastPalettedScatterCharts.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/FastPalettedScatterCharts.png new file mode 100644 index 00000000..fdfc7732 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/FastPalettedScatterCharts.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/Fifo1BillionPoints.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/Fifo1BillionPoints.png new file mode 100644 index 00000000..91e772b9 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/Fifo1BillionPoints.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/ScatterChartPerformanceDemo.png b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/ScatterChartPerformanceDemo.png new file mode 100644 index 00000000..9a7c8782 Binary files /dev/null and b/Examples/SciChart.Examples.Demo.SmokeTests/Resources/FeaturedApps/PerformanceDemos/ScatterChartPerformanceDemo.png differ diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/SciChart.Examples.Demo.SmokeTests.csproj b/Examples/SciChart.Examples.Demo.SmokeTests/SciChart.Examples.Demo.SmokeTests.csproj new file mode 100644 index 00000000..fc34146c --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/SciChart.Examples.Demo.SmokeTests.csproj @@ -0,0 +1,230 @@ + + + + + Debug + AnyCPU + {D84AFEC6-7942-4C57-AD80-96E7D33E7E34} + Library + Properties + SciChart.Examples.Demo.SmokeTests + SciChart.Examples.Demo.SmokeTests + v4.5.2 + 512 + true + + + true + full + false + ..\..\Build\Debug\net452\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Build\Release\net452\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + 3.2.0 + + + 3.13.2 + + + 3.17.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_ExampleWalkUsingBreadcrumbView.cs b/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_ExampleWalkUsingBreadcrumbView.cs new file mode 100644 index 00000000..5a687dde --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_ExampleWalkUsingBreadcrumbView.cs @@ -0,0 +1,466 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Windows.Media.Imaging; +using FlaUI.Core; +using FlaUI.Core.AutomationElements; +using FlaUI.Core.Capturing; +using FlaUI.Core.Definitions; +using FlaUI.Core.Input; +using FlaUI.Core.WindowsAPI; +using FlaUI.UIA3; +using FlaUI.UIA3.Patterns; +using NUnit.Framework; + +namespace SciChart.Examples.Demo.SmokeTests +{ + /// + /// Smoke tests which start/stop the application once per ntire fixture. In this test fixture we create a new SciChart.Examples.Demo application + /// once, then walk through all the examples by clicking programmatically the Examples Breadcrumb View. + /// + /// These tests are much faster, however one failure mid-way through the test run will cause all subsequent examples to fail. + /// + /// We pass the argument /quickStart to the SciChart.Examples.Demo.exe. This sets the flag App.QuickStart = true, which + /// disables startup delays, series animations and usage service HTTP comms. This makes the application faster to get in and less + /// waiting for transitions to complete + /// + [TestFixture] + public class SmokeTests_ExampleWalkUsingBreadcrumbView : AutomationTestBase + { + private Application _theApp; + private UIA3Automation _automation; + private Window _mainWindow; + private Stopwatch _stopwatch; + const double DefaultTolerance = 0.5; + private const bool DefaultExportActualForTest = false; + + // Top level example categories + private const string Category_2DCharts = "2D Charts"; + private const string Category_3DCharts = "3D Charts"; + private const string Category_FeaturedApps = "Featured Apps"; + + // 2D Chart Example Groups + private const string Group_2D_CreateSimpleCharts = "Basic Chart Types"; + private const string Group_2D_Annotations = "Chart Annotations"; + private const string Group_2D_Gauge = "Create a Gauge Charts"; + private const string Group_2D_MultiSeries = "Create a Multiseries Chart"; + private const string Group_2D_Radar = "Create a Radar Chart"; + private const string Group_2D_Ternary = "Create a Ternary Chart"; + private const string Group_2D_Custom = "Create Custom Charts"; + private const string Group_2D_RealtimeCharts = "Create Realtime Charts"; + private const string Group_2D_StockCharts = "Create Stock Charts"; + private const string Group_2D_ExportAChart = "Export a Chart"; + private const string Group_2D_FiltersApi = "Filters API"; + private const string Group_2D_Heatmap = "HeatmapChartTypes"; + private const string Group_2D_Legends = "Legends"; + private const string Group_2D_LinkMultipleCharts = "Link Multiple Charts"; + private const string Group_2D_ManipulateSeries = "Manipulate Series"; + private const string Group_2D_ModifyAxisBehavior = "Modify Axis Behavior"; + private const string Group_2D_MVVMExamples = "MVVM Examples"; + private const string Group_2D_StylingTheming = "Styling and Theming"; + private const string Group_2D_TooltipsAndHitTest = "Tooltips and Hit Test"; + private const string Group_2D_ZoomPan = "Zoom and Pan a Chart"; + private const string Group_2D_ZoomHistory = "Zoom History Manager"; + + // 3D Chart Example Groups + private const string Group_3D_BasicChartTypes = "Basic Chart Types"; + private const string Group_3D_SurfaceMesh = "Create A Surface Mesh Chart"; + + // Featured Apps example groups + private const string Group_Featured_PerformanceDemos = "Performance Demos"; + private const string Group_Featured_ScientificCharts = "Scientific Charts"; + private const string Group_Featured_MedicalCharts = "Medical Charts"; + private const string Group_Featured_FinancialCharts = "Financial Charts"; + + // Todo ... more groups... + + [OneTimeSetUp] + public void FixtureSetup() + { + var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + Directory.SetCurrentDirectory(dir); + _theApp = FlaUI.Core.Application.Launch(new ProcessStartInfo("SciChart.Examples.Demo.exe", "/uiautomationTestMode")); + _automation = new UIA3Automation(); + _mainWindow = _theApp.GetMainWindow(_automation); + + // Get any example button and click it + var examplesWrapPanel = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("ExamplesWrapPanel"))); + var exampleButton = WaitForElement(() => examplesWrapPanel?.FindFirstDescendant(cf => cf.ByAutomationId("Band Series Chart")).AsButton()); + exampleButton?.WaitUntilClickable(); + exampleButton?.Invoke(); + + // Click the 'Got it!' help button + var tipsView = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("TipsView"))); + var gotItButton = WaitForElement(() => tipsView.FindFirstDescendant(cf => cf.ByAutomationId("TipsView.GotItButton"))?.AsButton()); + gotItButton?.WaitUntilClickable(); + gotItButton?.Invoke(); + + // Now application state should be in the example view + } + + [OneTimeTearDown] + public void FixtureTeardown() + { + // Kill the app + _automation?.Dispose(); + _theApp?.Close(); + } + + [SetUp] + public void Setup() + { + _stopwatch = Stopwatch.StartNew(); + + // Move mouse into top left corner of screen + Mouse.Position = new System.Drawing.Point(0, 0); + } + + [TearDown] + public void TearDown() + { + // report time elapsed per test + _stopwatch.Stop(); + Console.WriteLine("Time elapsed: " + _stopwatch.ElapsedMilliseconds); + } + + public class ExampleStartTestCase + { + public int TestNumber { get; } + public string Category { get; } + public string Group { get; } + public string Example { get; } + public string ResourceName { get; } + public Action BeforeFunc { get; } + public double Tolerance { get; } + public bool ExportActual { get; } + + public ExampleStartTestCase(string category, string group, string example, string resourceName, double tolerance = DefaultTolerance, bool exportActual = DefaultExportActualForTest) + : this(category, group, example, resourceName, null, tolerance, exportActual) + { + } + + public ExampleStartTestCase(string category, string group, string example, string resourceName, Action beforeFunc, double tolerance = DefaultTolerance, bool exportActual = DefaultExportActualForTest) + { + Category = category; + Group = @group; + Example = example; + ResourceName = resourceName; + BeforeFunc = beforeFunc; + Tolerance = tolerance; + ExportActual = exportActual; + } + + public override string ToString() + { + return $"{TestNumber}, {Category}/{Group}/{Example}"; + } + } + + + public static ExampleStartTestCase[] FastAssertExampleStartsTestCases = new[] + { + // 2D Charts, Create Simple Charts + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Band Series Chart", "Charts2D/CreateSimpleChart/BandSeriesChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Box Plot", "Charts2D/CreateSimpleChart/BoxPlot.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Bubble Chart", "Charts2D/CreateSimpleChart/BubbleChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Candlestick Chart", "Charts2D/CreateSimpleChart/CandlestickChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Column Chart", "Charts2D/CreateSimpleChart/ColumnChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Digital Band Series Chart", "Charts2D/CreateSimpleChart/DigitalBandSeriesChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Digital Line Chart", "Charts2D/CreateSimpleChart/DigitalLineChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Digital Mountain Chart", "Charts2D/CreateSimpleChart/DigitalMountainChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Impulse (Stem) Chart", "Charts2D/CreateSimpleChart/ImpulseStemChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Line Chart", "Charts2D/CreateSimpleChart/LineChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Mountain Chart", "Charts2D/CreateSimpleChart/MountainChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Polar Chart", "Charts2D/CreateSimpleChart/PolarChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_CreateSimpleCharts, "Scatter Chart", "Charts2D/CreateSimpleChart/ScatterChart.png"), + // 2D Charts, Annotations + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Annotations are Easy!", "Charts2D/ChartAnnotations/AnnotationsAreEasy.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Composite Annotations", "Charts2D/ChartAnnotations/CompositeAnnotations.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Create Annotations Dynamically", "Charts2D/ChartAnnotations/CreateAnnotationsDynamically.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Datapoint Markers", "Charts2D/ChartAnnotations/DatapointMarkers.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Drag Horizontal Threshold", "Charts2D/ChartAnnotations/DragHorizontalThreshold.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Interaction with Annotations", "Charts2D/ChartAnnotations/InteractionWithAnnotations.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Polar Chart Annotations", "Charts2D/ChartAnnotations/PolarChartAnnotations.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Trade Annotations", "Charts2D/ChartAnnotations/TradeAnnotations.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Annotations, "Trade Markers", "Charts2D/ChartAnnotations/TradeMarkers.png"), + // 2D Charts, Gauge Charts + new ExampleStartTestCase(Category_2DCharts, Group_2D_Gauge, "Using Donut Chart", "Charts2D/CreateGaugeChart/UsingDonutChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Gauge, "Using Pie Chart", "Charts2D/CreateGaugeChart/UsingPieChart.png"), + // 2D Charts, MultiSeries Chart + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Candlestick and Lines", "Charts2D/MultiseriesCharts/CandlestickAndLines.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Contours With Heatmap Chart", "Charts2D/MultiseriesCharts/ContoursWithHeatmap.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Dashboard Style Charts", "Charts2D/MultiseriesCharts/DashboardStyleCharts.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Dashboard Style Polar Charts", "Charts2D/MultiseriesCharts/DashboardPolarCharts.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Error Bars", "Charts2D/MultiseriesCharts/ErrorBars.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Fan Chart", "Charts2D/MultiseriesCharts/FanChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Gaps In Series", "Charts2D/MultiseriesCharts/GapsInSeries.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Line and Scatter Chart", "Charts2D/MultiseriesCharts/LineAndScatterChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Stacked Bar Chart", "Charts2D/MultiseriesCharts/StackedBarChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Stacked Column Chart", "Charts2D/MultiseriesCharts/StackedColumnChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Stacked Column Side By Side", "Charts2D/MultiseriesCharts/StackedColumnSideBySide.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MultiSeries, "Stacked Mountain Chart", "Charts2D/MultiseriesCharts/StackedMountainChart.png"), + // 2D Charts, Create a Radar Chart + new ExampleStartTestCase(Category_2DCharts, Group_2D_Radar, "Radar Chart Customization Example", "Charts2D/RadarCharts/RadarChartCustomization.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Radar, "Using Radar Chart", "Charts2D/RadarCharts/RadarChart.png"), + // 2D Charts, Create a Ternary Chart + new ExampleStartTestCase(Category_2DCharts, Group_2D_Ternary, "ErrorBar Series TernaryChart", "Charts2D/TernaryCharts/ErrorBarTernaryChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Ternary, "Polygon Series TernaryChart", "Charts2D/TernaryCharts/PolygonTernaryChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Ternary, "Scatter Series TernaryChart", "Charts2D/TernaryCharts/ScatterTernaryChart.png"), + // 2D Charts, Create Custom Charts + new ExampleStartTestCase(Category_2DCharts, Group_2D_Custom, "Spline Scatter Line Chart", "Charts2D/CustomCharts/SplineScatterChart.png"), + // 2D Charts, Create Realtime Charts + // TODO: add later, stop timer for some of them, use fixed data for other or leave them + + // 2D Charts, Create Stock Charts + new ExampleStartTestCase(Category_2DCharts, Group_2D_StockCharts, "Multi-Pane Stock Charts", "Charts2D/StockCharts/MultiPaneStockChart.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StockCharts, "Realtime Ticking Stock Charts", "Charts2D/StockCharts/RealtimeTickingCharts.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StockCharts, "Using SciStockChart", "Charts2D/StockCharts/UsingSciStockChart.png"), + // 2D Charts, Export a Chart + new ExampleStartTestCase(Category_2DCharts, Group_2D_ExportAChart, "Export and Screenshot Options in Chart", "Charts2D/ExportCharts/ExportChart.png"), + // 2D Charts, Filters API + new ExampleStartTestCase(Category_2DCharts, Group_2D_FiltersApi, "Filters API Example", "Charts2D/Filters/FiltersApiExample.png"), + // 2D Charts, HeatmapChartType + new ExampleStartTestCase(Category_2DCharts, Group_2D_Heatmap, "Heatmap Chart", "Charts2D/Heatmaps/HeatmapRealTime.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Heatmap, "Heatmap Chart with Text", "Charts2D/Heatmaps/HeatmapWithText.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Heatmap, "HeatmapMetaData", "Charts2D/Heatmaps/HeatmapMetaData.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Heatmap, "NonUniformHeatmap", "Charts2D/Heatmaps/NonUniformHeatmap.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_Heatmap, "UniformHeatmap and CustomPaletteProvider", "Charts2D/Heatmaps/HeatmapAndPaletteProvider.png"), + // 2D Charts, Legends + new ExampleStartTestCase(Category_2DCharts, Group_2D_Legends, "Chart Legends API", "Charts2D/Legends/LegendsAPI.png"), + // 2D Charts, Link Multiple Charts + new ExampleStartTestCase(Category_2DCharts, Group_2D_LinkMultipleCharts, "Sync Multi Chart Mouse", "Charts2D/SyncCharts/SyncCharts.png", + (mw) => Thread.Sleep(1500)), + // 2D Charts, Manipulate Series: + new ExampleStartTestCase(Category_2DCharts, Group_2D_ManipulateSeries, "Add or Remove Data Series In Code", "Charts2D/ManipulateSeries/AddRemoveSeries.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ManipulateSeries, "Change Renderable Series Type In Code", "Charts2D/ManipulateSeries/ChangeRenderableSeriesType.png"), + // 2D Charts, Modify Axis Behavior + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Category vs Value Axis", "Charts2D/ModifyAxisBehavior/CategoryVsValueAxis.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Central XAxis and YAxis", "Charts2D/ModifyAxisBehavior/CentralXYAxes.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Logarithmic Axis", "Charts2D/ModifyAxisBehavior/LogarithmicAxis.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Modify Axis Properties", "Charts2D/ModifyAxisBehavior/ModifyAxisProperties.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Multiple YAxis", "Charts2D/ModifyAxisBehavior/MultipleYAxis.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Multiple-XAxis", "Charts2D/ModifyAxisBehavior/MultipleXAxis.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Polar Chart with Multiple Axis", "Charts2D/ModifyAxisBehavior/PolarChartManyAxes.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Secondary Y-Axis", "Charts2D/ModifyAxisBehavior/SecondaryYAxis.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Switch Axis Type At Runtime", "Charts2D/ModifyAxisBehavior/SwitchAxisTypeRuntime.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Vertical Charts", "Charts2D/ModifyAxisBehavior/VerticalCharts.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ModifyAxisBehavior, "Vertically Stacked YAxis", "Charts2D/ModifyAxisBehavior/VerticallyStackedYAxis.png", (window) => Thread.Sleep(1500)), + // 2D Charts, MVVM Examples + new ExampleStartTestCase(Category_2DCharts, Group_2D_MVVMExamples, "Axis Binding and Annotation Binding", "Charts2D/MVVMExamples/AxisAnnotationBinding.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MVVMExamples, "Bind Multiple Charts", "Charts2D/MVVMExamples/BindMultipleCharts.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MVVMExamples, "Bind SciChart to Data", "Charts2D/MVVMExamples/BindSciChartToData.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MVVMExamples, "Manipulate Series Mvvm", "Charts2D/MVVMExamples/ManipulateSeriesMvvm.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_MVVMExamples, "Series Binding", "Charts2D/MVVMExamples/SeriesBinding.png", (window) => Thread.Sleep(1500)), + // 2D Charts, Styling and Theming + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Create a Custom Theme", "Charts2D/StylingTheming/CustomTheme.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Dashed Line Styling", "Charts2D/StylingTheming/DashedLineStyling.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Use High Quality Rendering", "Charts2D/StylingTheming/UseHQRendering.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Using PaletteProvider", "Charts2D/StylingTheming/UsingPaletteProvider.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Using PointMarkers", "Charts2D/StylingTheming/UsingPointMarkers.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Using ThemeManager", "Charts2D/StylingTheming/UsingThemeManager.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_StylingTheming, "Xaml Styling", "Charts2D/StylingTheming/Xaml Styling.png"), + // 2D Charts, Tooltips and Hit Test + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Custom Point Marker", "Charts2D/TooltipsAndHitTests/CustomPointMarker.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Custom Tooltips With Modifiers", "Charts2D/TooltipsAndHitTests/TooltipsAndModifiers.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Hit-Test API", "Charts2D/TooltipsAndHitTests/HitTestAPI.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "PointMarkers Selection", "Charts2D/TooltipsAndHitTests/PointMarkersSelection.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Series Selection", "Charts2D/TooltipsAndHitTests/SeriesSelection.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Series With Metadata", "Charts2D/TooltipsAndHitTests/SeriesWithMetadata.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Using CursorModifier Tooltips", "Charts2D/TooltipsAndHitTests/UsingCursorModifier.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Using RolloverModifier Tooltips", "Charts2D/TooltipsAndHitTests/UsingRolloverModifier.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Using TooltipModifier Tooltips", "Charts2D/TooltipsAndHitTests/Using TooltipModifier.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_TooltipsAndHitTest, "Using Vertical Slice Tooltips", "Charts2D/TooltipsAndHitTests/UsingVerticalSlice.png"), + // 2D Charts, Zoom and Pan a Chart + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Custom Overview Control", "Charts2D/ZoomPan/CustomOverviewControl.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Drag Area to Zoom", "Charts2D/ZoomPan/DragAreaToZoom.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Drag Axis to Scale", "Charts2D/ZoomPan/DragAxisToScale.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Mousewheel Zoom and Scroll", "Charts2D/ZoomPan/MousewheelZoomScroll.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Pan on Mouse-Drag", "Charts2D/ZoomPan/PanOnMouseDrag.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Pan Y or X Direction", "Charts2D/ZoomPan/PanYXDirection.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Per-Axis Scrollbars", "Charts2D/ZoomPan/PerAxisScrollbars.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomPan, "Scroll Chart using Overview Control", "Charts2D/ZoomPan/OverviewControl.png"), + // 2D Charts, Zoom History Manager + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomHistory, "Simple Undo Redo", "Charts2D/ZoomHistory/UndoRedo.png"), + new ExampleStartTestCase(Category_2DCharts, Group_2D_ZoomHistory, "Zoom History MVVM", "Charts2D/ZoomHistory/ZoomHistoryMVVM.png"), + // 3D Charts, Create Simple Charts + new ExampleStartTestCase(Category_3DCharts, Group_3D_BasicChartTypes, "Closed Mesh 3D Chart", "Charts3D/BasicChartTypes/ClosedSurfaceMesh3D.png"), + new ExampleStartTestCase(Category_3DCharts, Group_3D_BasicChartTypes, "Simple Bubble 3D Chart", "Charts3D/BasicChartTypes/SimpleBubble3DChart.png"), + new ExampleStartTestCase(Category_3DCharts, Group_3D_BasicChartTypes, "Simple Cylindroid 3D Chart", "Charts3D/BasicChartTypes/SimpleCylindroid3DChart.png"), + new ExampleStartTestCase(Category_3DCharts, Group_3D_BasicChartTypes, "Simple Ellipsoid 3D Chart", "Charts3D/BasicChartTypes/SimpleEllipsoid3DChart.png"), + // 3D Charts, Surface Mesh Charts + new ExampleStartTestCase(Category_3DCharts, Group_3D_SurfaceMesh, "Surface Mesh 3D Non-Uniform Data", "Charts3D/SurfaceMesh/NonUniformSurfaceMesh.png"), + // Featured Apps, Performance Demos + new ExampleStartTestCase(Category_FeaturedApps, Group_Featured_PerformanceDemos, "Fifo 1Billion Points Demo", "FeaturedApps/PerformanceDemos/Fifo1BillionPoints.png"), + new ExampleStartTestCase(Category_FeaturedApps, Group_Featured_PerformanceDemos, "Fast Paletted Scatter Charts", "FeaturedApps/PerformanceDemos/FastPalettedScatterCharts.png"), + new ExampleStartTestCase(Category_FeaturedApps, Group_Featured_PerformanceDemos, "Scatter Chart Performance Demo", "FeaturedApps/PerformanceDemos/ScatterChartPerformanceDemo.png", + (mw) => Thread.Sleep(1500)), // bit of a delay to allow example to show + }; + + [Test] + [TestCaseSource(nameof(FastAssertExampleStartsTestCases))] + public void WhenStartExample_ShouldHaveExpectedScreenshot_AndExportSource(ExampleStartTestCase testCase) + { + // Switch to example + SwitchToExampleViaBreadCrumb(testCase.Category, testCase.Group, testCase.Example); + + // Any custom operations before test? + testCase.BeforeFunc?.Invoke(_mainWindow); + + // 1. Run the screenshot test + RunScreenshotTest(testCase); + + // 2. Run the export test + RunExportExampleTest(testCase); + } + + private void SwitchToExampleViaBreadCrumb(string category, string group, string example) + { + // Click breadcrumb home + var breadcrumbHome = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("Breadcrumb.Home")))?.AsButton(); + if (breadcrumbHome == null) + { + Assert.Fail("Unable to get Breadcrumb Home button"); + } + breadcrumbHome?.Invoke(); + + // wait for navigation popup + var exampleNavView = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("ExampleNavigationView"))); + if (exampleNavView == null) + { + Assert.Fail("Unable to get exampleNavView"); + } + + // Select the category, group and example + var categoryListBox = exampleNavView.FindFirstDescendant(cf => cf.ByAutomationId("CategoryListBox")).AsListBox(); + var groupListBox = exampleNavView.FindFirstDescendant(cf => cf.ByAutomationId("GroupsListBox")).AsListBox(); + var exampleListBox = exampleNavView.FindFirstDescendant(cf => cf.ByAutomationId("ExamplesListBox")).AsListBox(); + + // 1. select category + var categoryItem = categoryListBox.FindFirstChild(category).AsListBoxItem(); + categoryItem.Select(); + + // 2. select group + var groupListBoxItem = WaitForElement(() => groupListBox.FindFirstChild(group).AsListBoxItem()); + groupListBoxItem.Select(); + + // 3. select item + var exampleListBoxItem = WaitForElement(() => exampleListBox.Items.FirstOrDefault(x => x.AutomationId == example).AsListBoxItem()); + if (exampleListBoxItem.IsSelected) + { + // already selected? Close the example navigation view + exampleNavView.FindFirstDescendant("ExampleNavigationView.CloseButton").AsButton().Invoke(); + } + else + { + // else select it + exampleListBoxItem.ScrollIntoView(); + exampleListBoxItem.Select(); + } + + // Wait for nav view to close + WaitUntilClosed(exampleNavView); + } + + private void RunExportExampleTest(ExampleStartTestCase testCase) + { + return; + + // Useful UIAutomation Ids + + // ExportExampleView + // ExportExampleView.ExportPathTextBox + // ExportExampleView.ExportButton + // ExportExampleView.CloseButton + // ExampleView.Export + + // Toggle the export button, this shows ExportExampleView + var exportButton = _mainWindow.FindFirstDescendant("ExampleView.Export").AsToggleButton(); + exportButton?.Toggle(); + + string exportPath = base.GetTemporaryDirectory(); + try + { + var exampleExportView = WaitForElement(() => _mainWindow.FindFirstDescendant("ExportExampleView")); + var exampleExportTextBox = exampleExportView.FindFirstDescendant("ExportExampleView.ExportPathTextBox") + .AsTextBox(); + var exampleExportButton = + exampleExportView.FindFirstDescendant("ExportExampleView.ExportButton").AsButton(); + var exampleExportCloseButton = + exampleExportView.FindFirstDescendant("ExportExampleView.CloseButton").AsButton(); + + // Set output path and export + exampleExportTextBox.Text = exportPath; + exampleExportButton.Invoke(); + + // Get the messagebox, close it + var msg = WaitForElement(() => _mainWindow.ModalWindows.FirstOrDefault().AsWindow()); + var yesButton = msg.FindFirstChild(cf => cf.ByName("OK")).AsButton(); + yesButton.Invoke(); + + // Close example export view + exampleExportCloseButton?.Invoke(); + + // Now check the example + var subDir = Directory.GetDirectories(exportPath).First(); + var projectFile = Directory.GetFiles(subDir, "*.sln").FirstOrDefault(); + + // MSBuild + //fs.WriteLine("@echo Building " + projectName); + //fs.WriteLine(@"call ""C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe"" /ToolsVersion:12.0 /p:Configuration=""Debug"" ""{0}/{0}.csproj"" /p:WarningLevel=0", projectName); + string msBuildPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe"; + var msBuildProcess = Process.Start(new ProcessStartInfo(msBuildPath, + $"/ToolsVersion:Current /p:Configuration=\"Debug\" \"{projectFile}\" /t:Restore;Build /p:WarningLevel=0")); + msBuildProcess.WaitForExit(10000); + Assert.That(msBuildProcess.ExitCode, Is.EqualTo(0), $"Failed to build example {testCase.Category}/{testCase.Group}/{testCase.Example}"); + } + finally + { + Directory.Delete(exportPath, true); + } + } + + private void RunScreenshotTest(ExampleStartTestCase testCase) + { + var exampleView = WaitForElement(() => _mainWindow.FindFirstDescendant("ExampleView.TransitioningFrame")); + if (exampleView == null) + { + Assert.Fail("Unable to get ExampleView"); + } + var userControlNotFrame = exampleView.FindFirstByXPath($"Custom"); + + // Capture a screenshot & compare + using (var capture = Capture.Element(userControlNotFrame)) + { + var actualBitmap = new WriteableBitmap(capture.BitmapImage); + + //#if DEBUG + // When true, we export the image and open in Paint for test purposes. + // Save this image in resources, as embedded resource, then set flag exportActualForTest=false for the actual test + if (testCase.ExportActual) + { + var pathString = Path.Combine(ExportActualPath, testCase.ResourceName); + base.SaveToPng(pathString, actualBitmap); + + // Export the actual + ProcessStartInfo startInfo = new ProcessStartInfo(pathString); + Process.Start(startInfo); + } + //#endif + + WriteableBitmap expectedBitmap = null; + try + { + expectedBitmap = this.LoadResource(testCase.ResourceName); + } + catch (Exception caught) + { + throw new Exception("Unable to load image from resource " + testCase.ResourceName, caught); + } + Assert.True(CompareBitmaps(testCase.ResourceName, actualBitmap, expectedBitmap, testCase.Tolerance)); + } + } + } +} diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_NewAppPerTest.cs b/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_NewAppPerTest.cs new file mode 100644 index 00000000..6816789a --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/SmokeTests_NewAppPerTest.cs @@ -0,0 +1,126 @@ +//using System; +//using System.Diagnostics; +//using System.IO; +//using System.Windows.Media.Imaging; +//using FlaUI.Core; +//using FlaUI.Core.AutomationElements; +//using FlaUI.Core.Capturing; +//using FlaUI.Core.Tools; +//using FlaUI.UIA3; +//using NUnit.Framework; +// +//namespace SciChart.Examples.Demo.SmokeTests +//{ +// /// +// /// Smoke tests which start/stop the application once per test. In this test fixture we create a new SciChart.Examples.Demo application +// /// per test. Theese are slow (about 5 seconds per test) but each test is completely isolated from the previous test. +// /// +// /// We pass the argument /quickStart to the SciChart.Examples.Demo.exe. This sets the flag App.QuickStart = true, which +// /// disables startup delays, series animations and usage service HTTP comms. This makes the application faster to get in and less +// /// waiting for transitions to complete +// /// +// [TestFixture] +// [Category("UIAutomationTests")] +// [Ignore("Superceded by SmokeTests_ExampleWalkUsingBreadcrumbView")] +// public class SmokeTests_NewAppPerTest : AutomationTestBase +// { +// private Application _theApp; +// private UIA3Automation _automation; +// private Window _mainWindow; +// private Stopwatch _stopwatch; +// const double DefaultTolerance = 0.5; +// private const bool ExportActualForTest = false; +// +// [SetUp] +// public void Setup() +// { +// // Create the app +// _theApp = FlaUI.Core.Application.Launch(new ProcessStartInfo("SciChart.Examples.Demo.exe", "/uiautomationTestMode")); +// _automation = new UIA3Automation(); +// _mainWindow = _theApp.GetMainWindow(_automation); +// _stopwatch = Stopwatch.StartNew(); +// +// // TODO: click AutomationProperties.AutomationId="ShellControl.Home" +// // ShellControl.ShowSettings +// // Breadcrumb.Home +// // ExampleNavigationView.CloseButton +// } +// +// [TearDown] +// public void Teardown() +// { +// // Shutdown the app +// _automation?.Dispose(); +// _theApp?.Close(); +// _stopwatch.Stop(); +// Console.WriteLine("Time elapsed: " + _stopwatch.ElapsedMilliseconds); +// } +// +// [Test] +// [TestCase("Band Series Chart", "Charts2D/CreateSimpleChart/BandSeriesChart.png", DefaultTolerance)] +// //[TestCase("Box Plot", "Charts2D/CreateSimpleChart/BoxPlot.png", DefaultTolerance)] +// //[TestCase("Bubble Chart", "Charts2D/CreateSimpleChart/BubbleChart.png", DefaultTolerance)] +// //[TestCase("Candlestick Chart", "Charts2D/CreateSimpleChart/CandlestickChart.png", DefaultTolerance)] +// //[TestCase("Digital Band Series Chart", "Charts2D/CreateSimpleChart/DigitalBandSeriesChart.png", DefaultTolerance)] +// //[TestCase("Digital Line Chart", "Charts2D/CreateSimpleChart/DigitalLineChart.png", DefaultTolerance)] +// //[TestCase("Impulse (Stem) Chart", "Charts2D/CreateSimpleChart/ImpulseStemChart.png", DefaultTolerance)] +// //[TestCase("Line Chart", "Charts2D/CreateSimpleChart/LineChart.png", DefaultTolerance)] +// //[TestCase("Mountain Chart", "Charts2D/CreateSimpleChart/MountainChart.png", DefaultTolerance)] +// //[TestCase("Polar Chart", "Charts2D/CreateSimpleChart/PolarChart.png", DefaultTolerance)] +// //[TestCase("Scatter Chart", "Charts2D/CreateSimpleChart/ScatterChart.png", DefaultTolerance)] +// public void AssertExampleStarts(string exampleName, string resourceName, double tolerance) +// { +// // Get the example button and click it +// var examplesWrapPanel = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("ExamplesWrapPanel"))); +// var exampleButton = WaitForElement(() => examplesWrapPanel?.FindFirstDescendant(cf => cf.ByAutomationId(exampleName)).AsButton()); +// exampleButton?.WaitUntilClickable(); +// exampleButton?.Invoke(); +// +// // Click the 'Got it!' help button +// var tipsView = WaitForElement(() => _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("TipsView"))); +// var gotItButton = WaitForElement(() => tipsView.FindFirstDescendant(cf => cf.ByAutomationId("TipsView.GotItButton"))?.AsButton()); +// gotItButton?.WaitUntilClickable(); +// gotItButton?.Invoke(); +// +// WaitUntilClosed(tipsView); +// +// var exampleView = _mainWindow.FindFirstDescendant(cf => cf.ByAutomationId("ExampleView.TransitioningFrame")); +// if (exampleView == null) +// { +// Assert.Fail("Unable to get ExampleView"); +// } +// +// // Capture a screenshot & compare +// using (var capture = Capture.Element(exampleView)) +// { +// var actualBitmap = new WriteableBitmap(capture.BitmapImage); +// +//#if DEBUG +// // When true, we export the image and open in Paint for test purposes. +// // Save this image in resources, as embedded resource, then set flag exportActualForTest=false for the actual test +// if (ExportActualForTest) +// { +// var pathString = Path.Combine(ExportActualPath, resourceName); +// base.SaveToPng(pathString, actualBitmap); +// +// // Export the actual +// ProcessStartInfo startInfo = new ProcessStartInfo(pathString); +// startInfo.Verb = "edit"; +// Process.Start(startInfo); +// } +//#endif +// +// WriteableBitmap expectedBitmap = null; +// try +// { +// expectedBitmap = this.LoadResource(resourceName); +// } +// catch (Exception caught) +// { +// throw new Exception("Unable to load image from resource " + resourceName, caught); +// } +// Assert.True(CompareBitmaps(resourceName, actualBitmap, expectedBitmap, tolerance)); +// } +// } +// } +//} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo.SmokeTests/WriteableBitmapExtensions.cs b/Examples/SciChart.Examples.Demo.SmokeTests/WriteableBitmapExtensions.cs new file mode 100644 index 00000000..0f2eb96f --- /dev/null +++ b/Examples/SciChart.Examples.Demo.SmokeTests/WriteableBitmapExtensions.cs @@ -0,0 +1,27 @@ +using System.Windows.Media; +using System.Windows.Media.Imaging; +using FlaUI.Core.Capturing; + +namespace SciChart.Examples.Demo.SmokeTests +{ + public static class WriteableBitmapExtensions + { + /// + /// Copies all the Pixels from the WriteableBitmap into a ARGB byte array. + /// + /// The WriteableBitmap. + /// The color buffer as byte ARGB values. + public static byte[] ToByteArray(this WriteableBitmap bmp) + { + + var width = bmp.PixelWidth; + var height = bmp.PixelHeight; + var stride = width * ((bmp.Format.BitsPerPixel + 7) / 8); + + var bitmapData = new byte[height * stride]; + + bmp.CopyPixels(bitmapData, stride, 0); + return bitmapData; + } + } +} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/App.xaml b/Examples/SciChart.Examples.Demo/App.xaml index cb160292..bd43448d 100644 --- a/Examples/SciChart.Examples.Demo/App.xaml +++ b/Examples/SciChart.Examples.Demo/App.xaml @@ -1,8 +1,6 @@  @@ -28,6 +26,7 @@ + diff --git a/Examples/SciChart.Examples.Demo/App.xaml.cs b/Examples/SciChart.Examples.Demo/App.xaml.cs index 96cd927b..70955b04 100644 --- a/Examples/SciChart.Examples.Demo/App.xaml.cs +++ b/Examples/SciChart.Examples.Demo/App.xaml.cs @@ -1,15 +1,18 @@ using System; using System.Linq; using System.Threading; +using System.Threading.Tasks; using System.Windows; +using System.Windows.Threading; +using SciChart.Charting.Visuals.RenderableSeries.Animations; using SciChart.Examples.Demo.Helpers.UsageTracking; -using Unity; using SciChart.Examples.ExternalDependencies.Common; using SciChart.Examples.ExternalDependencies.Controls.ExceptionView; using SciChart.UI.Bootstrap; using SciChart.UI.Bootstrap.Utility; using SciChart.UI.Reactive.Async; using SciChart.UI.Reactive.Traits; +using Unity; namespace SciChart.Examples.Demo { @@ -18,41 +21,67 @@ namespace SciChart.Examples.Demo /// public partial class App : Application { - private static readonly ILogFacade Log = LogManagerFacade.GetLogger(typeof(App)); + private static ILogFacade _log; private Bootstrapper _bootStrapper; - private const string _devMode = "/devmode"; + + private const string _devMode = "/DEVMODE"; + private const string _quickStart = "/UIAUTOMATIONTESTMODE"; public App() - { - Startup += Application_Startup; + { + Startup += OnStartup; Exit += OnExit; - DispatcherUnhandledException += App_DispatcherUnhandledException; - - InitializeComponent(); + DispatcherUnhandledException += OnDispatcherUnhandledException; + + InitializeComponent(); + } + + public ILogFacade Log + { + get + { + if (UIAutomationTestMode) return new ConsoleLogger(); + _log ??= LogManagerFacade.GetLogger(typeof(App)); + return _log; + } } - private void App_DispatcherUnhandledException(object sender, - System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + /// + /// UIAutomationTestMode is enabled when /uiautomationTestMode is passed as command argument, and enables as fast as possible startup without animations, delays or unnecessary services. Used by UIAutomationTests + /// + public static bool UIAutomationTestMode { get; private set; } + + private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { Log.Error("An unhandled exception occurred. Showing view to user...", e.Exception); var exceptionView = new ExceptionView(e.Exception) { - Owner = Application.Current != null ? Application.Current.MainWindow : null, - WindowStartupLocation = Application.Current != null ? WindowStartupLocation.CenterOwner : WindowStartupLocation.CenterScreen, + Owner = Current?.MainWindow, + WindowStartupLocation = Current != null + ? WindowStartupLocation.CenterOwner + : WindowStartupLocation.CenterScreen }; + exceptionView.ShowDialog(); e.Handled = true; } - private void Application_Startup(object sender, StartupEventArgs e) + private void OnStartup(object sender, StartupEventArgs e) { - if (e.Args.Contains(_devMode)) + if (e.Args.Contains(_devMode, StringComparer.InvariantCultureIgnoreCase)) { DeveloperModManager.Manage.IsDeveloperMode = true; } + if (e.Args.Contains(_quickStart, StringComparer.InvariantCultureIgnoreCase)) + { + // Used in automation testing, disable animations and delays in transitions + UIAutomationTestMode = true; + SeriesAnimationBase.GlobalEnableAnimations = false; + } + try { Thread.CurrentThread.Name = "UI Thread"; @@ -64,24 +93,32 @@ private void Application_Startup(object sender, StartupEventArgs e) var assembliesToSearch = new[] { - typeof (MainWindowViewModel).Assembly, - typeof (AbtBootstrapper).Assembly, // SciChart.UI.Bootstrap - typeof (IViewModelTrait).Assembly, // SciChart.UI.Reactive + typeof(MainWindowViewModel).Assembly, + typeof(AbtBootstrapper).Assembly, // SciChart.UI.Bootstrap + typeof(IViewModelTrait).Assembly, // SciChart.UI.Reactive }; _bootStrapper = new Bootstrapper(ServiceLocator.Container, new AttributedTypeDiscoveryService(new ExplicitAssemblyDiscovery(assembliesToSearch))); _bootStrapper.InitializeAsync().Then(() => { - //Syncing usages - var syncHelper = ServiceLocator.Container.Resolve(); - syncHelper.LoadFromIsolatedStorage(); + if (!UIAutomationTestMode) + { + // Do this on background thread + Task.Run(() => + { + //Syncing usages + var syncHelper = ServiceLocator.Container.Resolve(); + syncHelper.LoadFromIsolatedStorage(); - //Try sync with service - syncHelper.GetRatingsFromServer(); - syncHelper.SendUsagesToServer(); - syncHelper.SetUsageOnExamples(); + //Try sync with service + syncHelper.GetRatingsFromServer(); + syncHelper.SendUsagesToServer(); + syncHelper.SetUsageOnExamples(); + }); + } _bootStrapper.OnInitComplete(); + }).Catch(ex => { Log.Error("Exception:\n\n{0}", ex); @@ -97,14 +134,19 @@ private void Application_Startup(object sender, StartupEventArgs e) private void OnExit(object sender, ExitEventArgs exitEventArgs) { - var usageCalc = ServiceLocator.Container.Resolve(); - usageCalc.UpdateUsage(null); + if (!UIAutomationTestMode) + { + var usageCalc = ServiceLocator.Container.Resolve(); - var syncHelper = ServiceLocator.Container.Resolve(); + usageCalc.UpdateUsage(null); - // Consider doing this a bit more often. - syncHelper.SendUsagesToServer(); - syncHelper.WriteToIsolatedStorage(); + var syncHelper = ServiceLocator.Container.Resolve(); + + // Consider doing this a bit more often. + // And not on close as it generates server errors. + //syncHelper.SendUsagesToServer(); + syncHelper.WriteToIsolatedStorage(); + } } } } \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Behaviors/DiscoverCoreAssembliesBehavior.cs b/Examples/SciChart.Examples.Demo/Behaviors/DiscoverCoreAssembliesBehavior.cs deleted file mode 100644 index fc3e1bb4..00000000 --- a/Examples/SciChart.Examples.Demo/Behaviors/DiscoverCoreAssembliesBehavior.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Reactive.Linq; -using SciChart.Examples.Demo.ViewModels; -using SciChart.UI.Reactive; -using SciChart.UI.Reactive.Async; -using SciChart.UI.Reactive.Observability; -using SciChart.UI.Reactive.Traits; - -namespace SciChart.Examples.Demo.Behaviors -{ - public class DiscoverCoreAssembliesBehavior : ViewModelTrait - { - - - public DiscoverCoreAssembliesBehavior(ExportExampleViewModel target, ISchedulerContext schedulerContext) - : base(target) - { - Target.LibrariesPath = ExportExampleHelper.TryAutomaticallyFindAssemblies(); - - Target.WhenPropertyChanged(x => x.LibrariesPath) - .Where(x => !string.IsNullOrEmpty(x)) - .Select(ExportExampleHelper.SearchForCoreAssemblies) - .ObserveOn(schedulerContext.Dispatcher) - .Subscribe(b => Target.IsAssemblyOk = b) - .DisposeWith(this); - } - } -} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Bootstrapper.cs b/Examples/SciChart.Examples.Demo/Bootstrapper.cs index d906d58e..ac4f8b5e 100644 --- a/Examples/SciChart.Examples.Demo/Bootstrapper.cs +++ b/Examples/SciChart.Examples.Demo/Bootstrapper.cs @@ -2,7 +2,7 @@ using System.Reactive.Concurrency; using System.Threading; using System.Threading.Tasks; -using SciChart.Drawing.DirectX.Context.D3D11; +using SciChart.Charting; using SciChart.Examples.Demo.Common; using SciChart.Examples.Demo.Helpers; using SciChart.UI.Bootstrap; @@ -44,7 +44,7 @@ public Task InitializeAsync() throw; } - return Task.Factory.StartNew(() => + return Task.Factory.StartNew(async () => { try { @@ -62,10 +62,17 @@ public Task InitializeAsync() // Bootstrap D3D to save time on startup _logger.InfoFormat("... 4of4 D3D11.Initialize()"); - Direct3D11RenderSurface.InitEngineAsync().Then(r => + if (App.UIAutomationTestMode) { - vm.InitReady = true; - }); + VisualXcceleratorEngine.UseAlternativeFillSource = true; + VisualXcceleratorEngine.EnableForceWaitForGPU = true; + } + else + { + // Force delay to show splash + await Task.Delay(3000); + } + vm.InitReady = true; } catch (Exception e) { diff --git a/Examples/SciChart.Examples.Demo/Common/Converters/EnumDescriptionConverter.cs b/Examples/SciChart.Examples.Demo/Common/Converters/EnumDescriptionConverter.cs index c9c26e9d..3af5bacf 100644 --- a/Examples/SciChart.Examples.Demo/Common/Converters/EnumDescriptionConverter.cs +++ b/Examples/SciChart.Examples.Demo/Common/Converters/EnumDescriptionConverter.cs @@ -1,5 +1,5 @@ // ************************************************************************************** -// SCICHART © Copyright SciChart Ltd. 2011-2012. All rights reserved. +// SCICHART © Copyright SciChart Ltd. 2011-2021. All rights reserved. // Examples Suite source code provided as-is to assist in creation of applications using SciChart. // At no time may this source be be copied, transferred, sold, distributed or made available // ************************************************************************************** diff --git a/Examples/SciChart.Examples.Demo/Common/Converters/RendererTypeToDisplayNameConverter.cs b/Examples/SciChart.Examples.Demo/Common/Converters/RendererTypeToDisplayNameConverter.cs index 10ee95d5..aa64536e 100644 --- a/Examples/SciChart.Examples.Demo/Common/Converters/RendererTypeToDisplayNameConverter.cs +++ b/Examples/SciChart.Examples.Demo/Common/Converters/RendererTypeToDisplayNameConverter.cs @@ -1,12 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Windows.Data; -using SciChart.Drawing.Common; -using SciChart.Drawing.DirectX.Context.D3D11; -using SciChart.Drawing.HighQualityRasterizer; -using SciChart.Drawing.HighSpeedRasterizer; namespace SciChart.Examples.Demo.Common.Converters { diff --git a/Examples/SciChart.Examples.Demo/Controls/Breadcrumb/BreadcrumbControl.cs b/Examples/SciChart.Examples.Demo/Controls/Breadcrumb/BreadcrumbControl.cs index 5499408c..d97e17d1 100644 --- a/Examples/SciChart.Examples.Demo/Controls/Breadcrumb/BreadcrumbControl.cs +++ b/Examples/SciChart.Examples.Demo/Controls/Breadcrumb/BreadcrumbControl.cs @@ -57,11 +57,5 @@ public DataTemplate SeparatorTemplate get { return (DataTemplate)GetValue(SeparatorTemplateProperty); } set { SetValue(SeparatorTemplateProperty, value); } } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - int i = 0; - } } } diff --git a/Examples/SciChart.Examples.Demo/Controls/ItemsControlWithUIAutomation.cs b/Examples/SciChart.Examples.Demo/Controls/ItemsControlWithUIAutomation.cs new file mode 100644 index 00000000..9c04d743 --- /dev/null +++ b/Examples/SciChart.Examples.Demo/Controls/ItemsControlWithUIAutomation.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Automation.Peers; +using System.Windows.Controls; +using SciChart.Examples.Demo.Helpers; + +namespace SciChart.Examples.Demo.Controls +{ + public class ItemsControlWithUIAutomation : ItemsControl + { + protected override AutomationPeer OnCreateAutomationPeer() + { + return new GenericAutomationPeer(this); + } + } +} diff --git a/Examples/SciChart.Examples.Demo/Controls/TileControl/Tile.cs b/Examples/SciChart.Examples.Demo/Controls/TileControl/Tile.cs index 4fd459ef..18770723 100644 --- a/Examples/SciChart.Examples.Demo/Controls/TileControl/Tile.cs +++ b/Examples/SciChart.Examples.Demo/Controls/TileControl/Tile.cs @@ -1,15 +1,18 @@ using System; using System.Windows; +using System.Windows.Automation; +using System.Windows.Automation.Peers; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media.Animation; using System.Windows.Shapes; +using SciChart.Examples.Demo.Helpers; namespace SciChart.Examples.Demo.Controls.TileControl { [TemplatePart(Name = "PART_PaintArea", Type = typeof(Shape)), TemplatePart(Name = "PART_MainContent", Type = typeof(ContentPresenter))] - public class Tile : ButtonBase + public class Tile : Button { public static readonly DependencyProperty DetailedContentProperty = DependencyProperty.Register("DetailedContent", typeof(object), typeof(Tile), new PropertyMetadata(default(object))); diff --git a/Examples/SciChart.Examples.Demo/Helpers/ApplicationPage.cs b/Examples/SciChart.Examples.Demo/Helpers/ApplicationPage.cs index 6f6a41be..549f583b 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ApplicationPage.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/ApplicationPage.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Text.RegularExpressions; using SciChart.Examples.ExternalDependencies.Common; @@ -30,7 +31,16 @@ public BaseViewModel ViewModel return _viewModel; } - internal set { _viewModel = value; } + internal set + { + // Disposes the viewmodel if it implements IDisposable + if (_viewModel != null) + { + // Trace.Write("Disposing viewmodel " + _viewModel.GetType()); + _viewModel.Dispose(); + } + _viewModel = value; + } } public void NewViewModel() diff --git a/Examples/SciChart.Examples.Demo/Helpers/Example.cs b/Examples/SciChart.Examples.Demo/Helpers/Example.cs index 81d18f5a..89f6a60f 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/Example.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/Example.cs @@ -1,5 +1,5 @@ // ************************************************************************************* -// SCICHART © Copyright SciChart Ltd. 2011-2012. All rights reserved. +// SCICHART © Copyright SciChart Ltd. 2011-2021. All rights reserved. // // Web: http://www.scichart.com // Support: support@scichart.com @@ -19,7 +19,6 @@ using System.Text.RegularExpressions; using System.Windows.Input; using SciChart.Examples.Demo.Common; -using SciChart.UI.Reactive.Services; namespace SciChart.Examples.Demo.Helpers { @@ -43,6 +42,7 @@ public Example(AppPage page, ExampleDefinition exDefinition) TopLevelCategory = exDefinition.ExampleCategory; IconPath = exDefinition.IconPath; Features = exDefinition.Features; + GithubExampleUrl = exDefinition.GithubUrl; _sourceFilePaths = exDefinition.CodeFiles; } @@ -61,7 +61,9 @@ private string ParseHtmlDescription(string description) .Replace("[/b][/i]", "") .Replace("[/i][/b]", "") .Replace("[/b]", "") - .Replace("[/i]", ""); + .Replace("[/i]", "") + .Replace("[gt]", ">") + .Replace("[lt]", "<"); const string replace = "$2"; @@ -85,37 +87,11 @@ private string ParseFormattedDescription(string formattedDescription) .Replace("[/b][/i]", "") .Replace("[/i][/b]", "") .Replace("[/b]", "") - .Replace("[/i]", ""); - -#if SILVERLIGHT - const string replace = "" + - "$2" + - ""; -#else + .Replace("[/i]", "") + .Replace("[gt]", ">") + .Replace("[lt]", "<"); + const string replace = "$2"; -#endif - - // TO dump all links out to console, uncomment - // - -// Regex urlRegexShort = new Regex(@"\[url='(.*?)'?\]"); -// var allLinks = urlRegexShort.Matches(formatted) -// .Cast() -// .Select(x => x.ToString().Replace("url=[", "").Replace("]", "")) -// .Distinct() -// .Select(y => string.Format("{0}\t{1}", this.Title, y)) -// .OrderBy(x => x) -// .ToList(); -// -// foreach (var match in allLinks) -// { -// Trace.WriteLine(match); -// } - formatted = _urlRegex.Replace(formatted, replace); @@ -137,6 +113,8 @@ private string SimplifyDescription(string formattedDescription) .Replace("[/b]", string.Empty) .Replace("[i]", string.Empty) .Replace("[i]", string.Empty) + .Replace("[gt]", ">") + .Replace("[lt]", "<") .Trim(); formatted = _urlRegex.Replace(formatted, "$2"); @@ -160,6 +138,8 @@ private string SimplifyDescription(string formattedDescription) public string TopLevelCategory { get; set; } + public string GithubExampleUrl { get; set; } + public string Group { get; set; } public string ExampleImagePath { get; set; } @@ -194,6 +174,7 @@ private void LoadCode() { var index = file.LastIndexOf('/') + 1; var fileName = file.Substring(index).Replace(".txt", String.Empty); + _sourceFiles[fileName] = ExampleLoader.LoadSourceFile(file); }); } @@ -209,4 +190,4 @@ public override string ToString() return Title; } } -} +} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/GenericAutomationPeer.cs b/Examples/SciChart.Examples.Demo/Helpers/GenericAutomationPeer.cs new file mode 100644 index 00000000..298aa0bd --- /dev/null +++ b/Examples/SciChart.Examples.Demo/Helpers/GenericAutomationPeer.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Windows; +using System.Windows.Automation.Peers; +using System.Windows.Controls; +using System.Windows.Media; + +namespace SciChart.Examples.Demo.Helpers +{ + /// + /// Used to assist automation peers for ItemsControl. See also + /// + public class GenericAutomationPeer : UIElementAutomationPeer + { + public GenericAutomationPeer(UIElement owner) : base(owner) + { + } + + protected override List GetChildrenCore() + { + var list = base.GetChildrenCore(); + list?.AddRange(GetChildPeers(Owner)); + return list; + } + + private List GetChildPeers(UIElement element) + { + var list = new List(); + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++) + { + var child = VisualTreeHelper.GetChild(element, i) as UIElement; + if (child != null) + { + AutomationPeer childPeer; + if (child is GroupItem) + { + childPeer = new GenericAutomationPeer(child); + } + else + { + childPeer = UIElementAutomationPeer.CreatePeerForElement(child); + } + if (childPeer != null) + { + list.Add(childPeer); + } + else + { + list.AddRange(GetChildPeers(child)); + } + } + } + return list; + } + } +} diff --git a/Examples/SciChart.Examples.Demo/Helpers/Module.cs b/Examples/SciChart.Examples.Demo/Helpers/Module.cs index b72a83d3..0d191dfa 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/Module.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/Module.cs @@ -3,11 +3,11 @@ using System.Collections.ObjectModel; using System.Linq; using System.Windows.Input; -using Unity; using SciChart.Charting.Common.Helpers; using SciChart.Examples.Demo.Helpers.Navigation; using SciChart.Examples.Demo.ViewModels; using SciChart.UI.Bootstrap; +using Unity; namespace SciChart.Examples.Demo.Helpers { @@ -25,40 +25,34 @@ public interface IModule [ExportType(typeof(IModule), CreateAs.Singleton)] public class Module : IModule { - public IDictionary _examples = new Dictionary(); - - public static readonly Dictionary ChartingPages = new Dictionary(); - - private readonly ActionCommand _navigateToExampleCommand; - private IDictionary> _groupsByCategory; - private ReadOnlyCollection _allCategories; private Example _currentExample; public Module() { - _navigateToExampleCommand = new ActionCommand(example => + NavigateToExampleCommand = new ActionCommand(example => { var lastExamplePage = CurrentExample != null ? CurrentExample.Page as ExampleAppPage : null; CurrentExample = example; + Navigator.Instance.Navigate(example); Navigator.Instance.Push(example); if (lastExamplePage != null) { // Required to release memory on example switch - lastExamplePage.ViewModel = null; + lastExamplePage.ViewModel = null; } - GC.Collect(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); //NOSONAR GC.WaitForPendingFinalizers(); - GC.Collect(); + GC.Collect(); //NOSONAR }); } public Example CurrentExample { - get { return _currentExample; } + get => _currentExample; set { _currentExample = value; @@ -66,19 +60,20 @@ public Example CurrentExample } } - public IDictionary Examples { get { return _examples; } } + public ICommand NavigateToExampleCommand { get; } - public ReadOnlyCollection AllCategories { get { return _allCategories; } } - public IDictionary> GroupsByCategory { get { return _groupsByCategory; } } + public static Dictionary ChartingPages { get; } = new Dictionary(); - private ICommand NavigateToExample - { - get { return _navigateToExampleCommand; } - } + public IDictionary Examples { get; } = new Dictionary(); + + public ReadOnlyCollection AllCategories { get; private set; } + + public IDictionary> GroupsByCategory { get; private set; } public void Initialize() { var exampleDefinitions = LoadExampleDefinitions(); + InitializeExamplesAndPages(exampleDefinitions); InitializeNewNavigator(); @@ -86,14 +81,14 @@ public void Initialize() public IEnumerable ExamplesByCategoryAndGroup(string category, string @group) { - return _examples.Where(x => x.Value.Group == @group && x.Value.TopLevelCategory == category).Select(x => x.Value).ToList(); + return Examples.Where(x => x.Value.Group == @group && x.Value.TopLevelCategory == category).Select(x => x.Value).ToList(); } private static IEnumerable LoadExampleDefinitions() { var loader = new ExampleLoader(); - var xmlExamples = loader.DiscoverAllXmlFiles(); + IEnumerable exampleDefinitions = xmlExamples.Select(e => loader.Parse(e)); return exampleDefinitions; @@ -108,18 +103,19 @@ private void InitializeExamplesAndPages(IEnumerable exampleDe appPage = new ExampleAppPage(definition.Title ,definition.ViewModel, definition.View); ChartingPages.Add(appPage.PageId, appPage); - var example = new Example(appPage, definition) {SelectCommand = NavigateToExample}; + var example = new Example(appPage, definition) {SelectCommand = NavigateToExampleCommand}; - _examples.Add(appPage.PageId, example); + Examples.Add(appPage.PageId, example); categories.Add(example.TopLevelCategory); } - _allCategories = new ReadOnlyCollection(categories.ToList()); - _groupsByCategory = new Dictionary>(); - foreach (var category in _allCategories) + AllCategories = new ReadOnlyCollection(categories.ToList()); + GroupsByCategory = new Dictionary>(); + + foreach (var category in AllCategories) { - var groups = _examples.Where(ex => ex.Value.TopLevelCategory == category).Select(y => y.Value.Group).Distinct().ToList(); - _groupsByCategory.Add(category, new ReadOnlyCollection(groups)); + var groups = Examples.Where(ex => ex.Value.TopLevelCategory == category).Select(y => y.Value.Group).Distinct().ToList(); + GroupsByCategory.Add(category, new ReadOnlyCollection(groups)); } appPage = new HomeAppPage(); @@ -152,7 +148,8 @@ public void ReloadCurrentExample() { Navigator.Instance.NavigateToHomeCommand.Execute(null); } - _navigateToExampleCommand.Execute(currentExample); + + NavigateToExampleCommand.Execute(currentExample); } } } \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/Navigation/Navigator.cs b/Examples/SciChart.Examples.Demo/Helpers/Navigation/Navigator.cs index 1b051634..6984ea8c 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/Navigation/Navigator.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/Navigation/Navigator.cs @@ -23,8 +23,22 @@ public class Navigator { private class ApplicationPageWrapper { + private UserControl _view; public AppPage AppPage { get; set; } - public UserControl View { get; set; } + public UserControl View + { + get { return _view; } + set + { + var dView = _view as IDisposable; + if (dView != null) + { + // Disposes the view if it implements IDisposable + dView.Dispose(); + } + _view = value; + } + } } #region AttachedProperties @@ -139,7 +153,6 @@ public void GoBack() GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); NavigateToHomeCommand.RaiseCanExecuteChanged(); - if (CurrentExample is ExampleAppPage lastExamplePage) { // Required to release memory from last example @@ -151,7 +164,7 @@ public void GoBack() lastExampleView.View = null; } - GC.Collect(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(); } @@ -177,7 +190,6 @@ public void GoForward() GoBackCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); NavigateToHomeCommand.RaiseCanExecuteChanged(); - if (CurrentExample is ExampleAppPage lastExamplePage) { // Required to release memory from last example @@ -189,7 +201,7 @@ public void GoForward() lastExampleView.View = null; } - GC.Collect(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(); } @@ -200,7 +212,7 @@ private void OnExamplesFrameBeforeNavigation() { _currentExample.View = null; - GC.Collect(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(); } @@ -328,7 +340,6 @@ private void GoToHome() // Clears memory on going to home ((TransitioningFrame)_examplesFrame.Frame).SetContentNull(); - if (CurrentExample is ExampleAppPage lastExamplePage) { // Required to release memory from last example @@ -340,7 +351,7 @@ private void GoToHome() lastExampleView.View = null; } - GC.Collect(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(); } diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/DirectoryHelper.cs b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/DirectoryHelper.cs index 408401b2..a7c506b0 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/DirectoryHelper.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/DirectoryHelper.cs @@ -23,14 +23,11 @@ public static string GetFileNameFromPath(string path) public static bool IsValidPath(string path, out string error) { error = null; - switch (path) + + if (string.IsNullOrEmpty(path)) { - case null: - error = "Path can't be null"; - return false; - case "": - error = ""; - return false; + error = "Path cannot be empty"; + return false; } if (path.Length < 3) @@ -39,7 +36,7 @@ public static bool IsValidPath(string path, out string error) return false; } - string drive = path.Substring(0, 3); // e.g. K:\ + string drive = path.Substring(0, 3); // e.g. C:\ var driveCheck = new Regex(@"^[a-zA-Z]:\\$"); if (!driveCheck.IsMatch(drive)) diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/ProjectWriter.cs b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/ProjectWriter.cs index bfb133e7..4f43e5e6 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/ProjectWriter.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/ProjectWriter.cs @@ -5,7 +5,6 @@ using System.Windows; using System.Xml.Linq; using SciChart.Charting.Common.Extensions; -using SciChart.Core.Extensions; namespace SciChart.Examples.Demo.Helpers.ProjectExport { @@ -13,36 +12,39 @@ public static class ProjectWriter { public static readonly string[] AssembliesNames = { - @"SciChart.Core.dll", - @"SciChart.Data.dll", - @"SciChart.Charting.dll", - @"SciChart.Charting3D.dll", - @"SciChart.Drawing.dll", - @"SciChart.Drawing.DirectX.dll", - @"SciChart.Charting.DrawingTools.dll", + "SciChart.Core.dll", + "SciChart.Data.dll", + "SciChart.Charting.dll", + "SciChart.Charting3D.dll", + "SciChart.Drawing.dll", + "SciChart.Charting.DrawingTools.dll" }; - public static readonly string Interactivity = @"System.Windows.Interactivity.dll"; - public static readonly string ExternalDependencies = @"SciChart.Examples.ExternalDependencies.dll"; - + public static readonly string[] NuGetPackages = + { + //ExampleTitle;PackageName;PackageVersion + "AudioAnalyzerDemo;NAudio;1.10.0", + "VitalSignsMonitorDemo;System.Reactive;3.1.1" + }; + + public static readonly string ExternalDependencies = "SciChart.Examples.ExternalDependencies.dll"; + public static readonly string ProjectFileName = "ProjectFile.csproj"; + public static readonly string SolutionFileName = "SolutionFile.sln"; public static readonly string MainWindowFileName = "MainWindow.xaml"; public static readonly string AssemblyInfoFileName = "AssemblyInfo.cs"; public static readonly string ClrNamespace = "clr-namespace:"; public static readonly string ViewModelKey = "ViewModel"; - public static readonly XNamespace DefaultXmlns = "http://schemas.microsoft.com/developer/msbuild/2003"; + public static readonly XNamespace PresentationXmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"; public static readonly XNamespace XXmlns = "http://schemas.microsoft.com/winfx/2006/xaml"; - private static readonly string[] SharpDxLibs = { "sharpdx_direct3d11_1_effects_x64.dll", "sharpdx_direct3d11_1_effects_x86.dll" }; - public static string WriteProject(Example example, string selectedPath, string assembliesPath, bool showMessageBox = true) { var files = new Dictionary(); + var assembly = typeof(ProjectWriter).Assembly; - var assembly = typeof (ProjectWriter).Assembly; - - string[] names = assembly.GetManifestResourceNames(); + var names = assembly.GetManifestResourceNames(); var templateFiles = names.Where(x => x.Contains("Templates")).ToList(); foreach (var templateFile in templateFiles) @@ -50,15 +52,23 @@ public static string WriteProject(Example example, string selectedPath, string a var fileName = GetFileNameFromNs(templateFile); using (var s = assembly.GetManifestResourceStream(templateFile)) - using (var sr = new StreamReader(s)) { - files.Add(fileName, sr.ReadToEnd()); + if (s == null) break; + + using (var sr = new StreamReader(s)) + { + files.Add(fileName, sr.ReadToEnd()); + } } } string projectName = "SciChart_" + Regex.Replace(example.Title, @"[^A-Za-z0-9]+", string.Empty); - files[ProjectFileName] = GenerateProjectFile(files[ProjectFileName], example, projectName, assembliesPath + @"\"); + + files[ProjectFileName] = GenerateProjectFile(files[ProjectFileName], example, assembliesPath); + files[SolutionFileName] = GenerateSolutionFile(files[SolutionFileName], projectName); + files.RenameKey(ProjectFileName, projectName + ".csproj"); + files.RenameKey(SolutionFileName, projectName + ".sln"); files[MainWindowFileName] = GenerateShellFile(files[MainWindowFileName], example).Replace("[ExampleTitle]", example.Title); @@ -67,19 +77,14 @@ public static string WriteProject(Example example, string selectedPath, string a files.Add(codeFile.Key, codeFile.Value); } - WriteProjectFiles(files, selectedPath + projectName + @"\"); + string exportPath = Path.Combine(selectedPath, projectName); - foreach (var sharpDxLib in SharpDxLibs) - { - var sourceFilePath = Path.Combine(assembliesPath, sharpDxLib); - var destFilePath = Path.Combine(selectedPath + projectName, sharpDxLib); - File.Copy(sourceFilePath, destFilePath); - } + WriteProjectFiles(files, exportPath); - if (showMessageBox) + if (showMessageBox && Application.Current.MainWindow != null) { - MessageBox.Show(string.Format("The {0} example was succesfully exported to {1}", example.Title, selectedPath + projectName), - "Success!"); + var message = $"The {example.Title} example was successfully exported to {exportPath}"; + MessageBox.Show(Application.Current.MainWindow, message, "Success!"); } return projectName; @@ -90,74 +95,67 @@ private static string GetFileNameFromNs(string fullName) return fullName .Replace("SciChart.Examples.Demo.Helpers.ProjectExport.Templates.", string.Empty) .Replace(".c.", ".cs.") - .Replace(@".txt", string.Empty); + .Replace(".txt", string.Empty); + } + + private static string GenerateSolutionFile(string file, string projectName) + { + return file.Replace("[PROJECTNAME]", projectName); } - private static string GenerateProjectFile(string projFileSource, Example example, string projectName, string assembliesPath) + private static string GenerateProjectFile(string projFileSource, Example example, string assembliesPath) { var projXml = XDocument.Parse(projFileSource); - if (projXml.Root != null) { - //Change RootNamespace and AssemblyName for actual one, in our case - example title. - foreach (XElement element in projXml.Root.Descendants().Where(x => x.Name.LocalName == "RootNamespace" || x.Name.LocalName == "AssemblyName")) - { - element.SetValue(projectName); - } - var elements = projXml.Root.Elements().Where(x => x.Name.LocalName == "ItemGroup").ToList(); - - //Add appropriate References - var el = new XElement(DefaultXmlns + "Reference", new XAttribute("Include", ExternalDependencies.Replace(".dll", string.Empty))); - el.Add(new XElement(DefaultXmlns + "HintPath", Path.Combine(assembliesPath, ExternalDependencies))); - elements[0].Add(el); - - var el2 = new XElement(DefaultXmlns + "Reference", new XAttribute("Include", Interactivity.Replace(".dll", string.Empty))); - el2.Add(new XElement(DefaultXmlns + "HintPath", Path.Combine(assembliesPath, Interactivity))); - elements[0].Add(el2); - - foreach (var asmName in AssembliesNames) + if (elements.Count == 3) { - el = new XElement(DefaultXmlns + "Reference", new XAttribute("Include", asmName.Replace(".dll", string.Empty))); - el.Add(new XElement(DefaultXmlns + "HintPath", Path.Combine(assembliesPath, asmName))); + // Add appropriate references + var el = new XElement("Reference", new XAttribute("Include", ExternalDependencies.Replace(".dll", string.Empty))); + el.Add(new XElement("HintPath", Path.Combine(assembliesPath, ExternalDependencies))); elements[0].Add(el); - } - - //Add XElement for all .cs files - var codeFiles = example.SourceFiles.Where(x => x.Key.EndsWith(".cs")); - foreach (var codeFile in codeFiles) - { - el = new XElement(DefaultXmlns + "Compile", new XAttribute("Include", codeFile.Key)); - el.Add(new XElement(DefaultXmlns + "DependentUpon", codeFile.Key.Replace(".cs", string.Empty))); - elements[1].Add(el); - } - //Add XElement for all .xaml files - var uiCodeFiles = example.SourceFiles.Where(x => x.Key.EndsWith(".xaml")); - foreach (var uiFile in uiCodeFiles) - { - el = new XElement(DefaultXmlns + "Page", new XAttribute("Include", uiFile.Key)); - el.Add(new XElement(DefaultXmlns + "Generator", "MSBuild:Compile")); - el.Add(new XElement(DefaultXmlns + "SubType", "Designer")); - elements[1].Add(el); - } + // Add assembly references + foreach (var asmName in AssembliesNames) + { + el = new XElement("Reference", new XAttribute("Include", asmName.Replace(".dll", string.Empty))); + el.Add(new XElement("HintPath", Path.Combine(assembliesPath, asmName))); + elements[0].Add(el); + } - foreach (var sharpDxLib in SharpDxLibs) - { - var sharpDll64element = new XElement(DefaultXmlns + "Content", new XAttribute("Include", sharpDxLib)); - var xElementChild = new XElement(DefaultXmlns + "CopyToOutputDirectory"); - xElementChild.Add("Always"); - sharpDll64element.Add(xElementChild); + // Add package references for specific example NuGet packages + var exampleTitle = Regex.Replace(example.Title, @"\s", string.Empty); + var examplePackages = NuGetPackages.Where(p => p.StartsWith(exampleTitle)); + if (examplePackages.Any()) + { + foreach (var package in examplePackages) + { + // ExampleTitle;PackageName;PackageVersion + var packageAttr = package.Split(';'); + if (packageAttr.Length == 3) + { + el = new XElement("PackageReference", + new XAttribute("Include", packageAttr[1]), + new XAttribute("Version", packageAttr[2])); + + elements[1].Add(el); + } + } + } +#if NET452 + return projXml.ToString().Replace("[PROJECTTARGET]", "net452"); +#else + elements[2].Remove(); // Remove 'net452' references - elements[1].Add(sharpDll64element); + return projXml.ToString().Replace("[PROJECTTARGET]", "netcoreapp3.1"); +#endif } - } - return projXml.ToString(); + return projFileSource; } - //InjectExampleIntoShell private static string GenerateShellFile(string shellFileSource, Example example) { var sourceFiles = example.SourceFiles; @@ -165,10 +163,9 @@ private static string GenerateShellFile(string shellFileSource, Example example) var view = DirectoryHelper.GetFileNameFromPath(example.Page.Uri); var xamlFile = sourceFiles.Where(pair => pair.Key.EndsWith(".xaml")).FirstOrDefault(x => x.Key == view); - string fileName; - var ns = GetExampleNamespace(xamlFile.Value, out fileName); - + var ns = GetExampleNamespace(xamlFile.Value, out string fileName); var xml = XDocument.Parse(shellFileSource); + if (xml.Root != null) { //xmlns @@ -223,23 +220,15 @@ private static string GetStaticResource(string resourceKey) private static void WriteProjectFiles(Dictionary files, string selectedPath) { - Directory.CreateDirectory(selectedPath + @"\"); - Directory.CreateDirectory(selectedPath + @"\Properties\"); - - var assemblyInfo = files[AssemblyInfoFileName]; - using (var f = new StreamWriter(selectedPath + @"Properties\" + AssemblyInfoFileName)) - { - f.Write(assemblyInfo); - } - files.Remove(AssemblyInfoFileName); + Directory.CreateDirectory(selectedPath); foreach (var file in files) { - using (var f = new StreamWriter(selectedPath + file.Key)) + using (var f = new StreamWriter(Path.Combine(selectedPath, file.Key))) { f.Write(file.Value); } } } } -} +} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.config.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.config.txt deleted file mode 100644 index 1f6eeef1..00000000 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.config.txt +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.c.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.c.txt index b1ecedae..54b7b428 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.c.txt +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.c.txt @@ -13,6 +13,9 @@ namespace SciChartExport DispatcherUnhandledException += App_DispatcherUnhandledException; InitializeComponent(); + + // TODO: Put your SciChart License Key here if needed + // SciChartSurface.SetRuntimeLicenseKey(@"{YOUR SCICHART WPF v6 LICENSE KEY}"); } private void App_DispatcherUnhandledException(object sender, diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.txt index 718b871a..d268ee7a 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.txt +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/App.xaml.txt @@ -1,13 +1,22 @@  + + + + \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/AssemblyInfo.c.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/AssemblyInfo.c.txt deleted file mode 100644 index 32797f88..00000000 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/AssemblyInfo.c.txt +++ /dev/null @@ -1,48 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, app, or any theme specific resource dictionaries) -)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/MainWindow.xaml.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/MainWindow.xaml.txt index ba88ca25..976e901f 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/MainWindow.xaml.txt +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/MainWindow.xaml.txt @@ -2,5 +2,5 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="SciChart | [ExampleTitle]"> - + diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/ProjectFile.csproj.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/ProjectFile.csproj.txt index ec3875a6..9a9d56f5 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/ProjectFile.csproj.txt +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/ProjectFile.csproj.txt @@ -1,86 +1,32 @@ - - - + - Debug - AnyCPU - {984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6} + [PROJECTTARGET] WinExe - Properties - ProjectFile - ProjectFile - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 + true - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + Copyright © 2011-2021 + 1.0.0.0 + 1.0.0.0 - - - + + + + + + + + - + - 4.5 + 4.5.2 + + - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - Code - - - - - - - \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/SolutionFile.sln.txt b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/SolutionFile.sln.txt new file mode 100644 index 00000000..aac7da3a --- /dev/null +++ b/Examples/SciChart.Examples.Demo/Helpers/ProjectExport/Templates/SolutionFile.sln.txt @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29509.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[PROJECTNAME]", "[PROJECTNAME].csproj", "{984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {984E36A0-D1F4-4ECC-9415-0A3BE0EBF9D6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9107D8D4-D5A8-45E0-BDC5-6727F250C9BE} + EndGlobalSection +EndGlobal diff --git a/Examples/SciChart.Examples.Demo/Helpers/RichTextBoxHelper.cs b/Examples/SciChart.Examples.Demo/Helpers/RichTextBoxHelper.cs index f079a49c..31cbefbb 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/RichTextBoxHelper.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/RichTextBoxHelper.cs @@ -100,7 +100,7 @@ private static void SubscribeToAllHyperlinks(FlowDocument doc) private static void LinkOnClick(object sender, RequestNavigateEventArgs e) { - Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); + Process.Start("explorer.exe", e.Uri.AbsoluteUri); e.Handled = true; } diff --git a/Examples/SciChart.Examples.Demo/Helpers/TransitioningFrame.cs b/Examples/SciChart.Examples.Demo/Helpers/TransitioningFrame.cs index bc30ef4d..a9f0f7c2 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/TransitioningFrame.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/TransitioningFrame.cs @@ -50,8 +50,11 @@ protected override void OnContentChanged(object oldContent, object newContent) //_previousContentPresentationSite.Content = oldContent; //_previousContentPresentationSite.IsHitTestVisible = false; - VisualStateManager.GoToState(this, "Normal", false); - VisualStateManager.GoToState(this, "Transition", true); + if (!App.UIAutomationTestMode) + { + VisualStateManager.GoToState(this, "Normal", false); + VisualStateManager.GoToState(this, "Transition", true); + } } } } diff --git a/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/SyncUsageHelper.cs b/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/SyncUsageHelper.cs index 8a7f3cd8..285c83a0 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/SyncUsageHelper.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/SyncUsageHelper.cs @@ -1,42 +1,88 @@ -using System.IO; +using SciChart.UI.Bootstrap; +using System; +using System.IO; using System.IO.IsolatedStorage; using System.Linq; +using System.Reflection; using System.Xml.Linq; using Unity; -using System; -using SciChart.UI.Bootstrap; namespace SciChart.Examples.Demo.Helpers.UsageTracking { [ExportType(typeof(ISyncUsageHelper), CreateAs.Singleton)] public class SyncUsageHelper : ISyncUsageHelper { + private class DataEncryptionHelper + { + string _namespace = "Abt.Licensing.New"; + string _class = "SodiumSymmetricEncryption"; + string _decodingMethod = "Decrypt"; + string _encodingMethod = "Encrypt"; + + public string Decrypt(string encrypted) + { + var decrypted = String.Empty; + var decodingMethod = GetEncoderType()? + .GetMethod(_decodingMethod); + if (decodingMethod != null) + { + decrypted = decodingMethod.Invoke(null, new object[] { encrypted }) as string; + } + + return decrypted; + } + + private Type GetEncoderType() + { + var type = AppDomain.CurrentDomain + .GetAssemblies() + .SelectMany(assembly => assembly.GetTypes()) + .FirstOrDefault(assemblyType => assemblyType.Name == _class && + assemblyType.Namespace == _namespace); + + return type; + } + + public string Encrypt(string raw) + { + var encrypted = String.Empty; + var encodingMethod = GetEncoderType()? + .GetMethod(_encodingMethod); + if (encodingMethod != null) + { + encrypted = encodingMethod.Invoke(null, new object[] { raw }) as string; + } + + return encrypted; + } + } + private string userId; private DateTime lastSent = DateTime.MinValue; private readonly IUsageCalculator _usageCalculator; private readonly IUsageServiceClient _client; + private readonly DataEncryptionHelper _encryptionHelper; private bool _enabled = true; public event EventHandler EnabledChanged; - private readonly string _password = "vankNBVDavigfuakbvja"; - public SyncUsageHelper(IUsageCalculator usageCalculator, IUsageServiceClient client) { + _encryptionHelper = new DataEncryptionHelper(); _usageCalculator = usageCalculator; _client = client; userId = System.Guid.NewGuid().ToString(); } - public bool Enabled { get { return _enabled; } set { _enabled = value; } } + public bool Enabled + { + get => _enabled; + set => _enabled = value; + } public void LoadFromIsolatedStorage() { -#if !SILVERLIGHT using (IsolatedStorageFile isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) -#else - using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForSite()) -#endif { if (isf.FileExists("Usage.xml")) { @@ -44,11 +90,18 @@ public void LoadFromIsolatedStorage() { using (var stream = new IsolatedStorageFileStream("Usage.xml", FileMode.Open, isf)) { - string usageXml = ""; + var usageXml = ""; using (StreamReader reader = new StreamReader(stream)) { var encryptedUsage = reader.ReadToEnd(); - usageXml = Abt.Licensing.Core.EncryptionUtil.Decrypt(encryptedUsage, _password); + try + { + usageXml = _encryptionHelper.Decrypt(encryptedUsage); + } + catch + { + // Old file contents will not decrypt due to encryption changes. We don't care. + } } using (var textReader = new StringReader(usageXml)) @@ -74,50 +127,53 @@ public void LoadFromIsolatedStorage() } } - var handler = EnabledChanged; - if (handler != null) - { - handler(this, EventArgs.Empty); - } + EnabledChanged?.Invoke(this, EventArgs.Empty); } catch { // If something goes wrong, delete the local file try { isf.DeleteFile("Usage.xml"); } catch { } - } } - + else + { + // Default on. + _enabled = true; + EnabledChanged?.Invoke(this, EventArgs.Empty); + } } } public void WriteToIsolatedStorage() { -#if !SILVERLIGHT - using (IsolatedStorageFile isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) -#else - using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForSite()) -#endif + try { - using (var stream = new IsolatedStorageFileStream("Usage.xml", FileMode.Create, isf)) + using (var isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, + null, null)) { - XDocument xml = SerializationUtil.Serialize(_usageCalculator.Usages.Values.Where(e => e.VisitCount > 0)); - xml.Root.Add(new XAttribute("UserId", userId)); - xml.Root.Add(new XAttribute("Enabled", Enabled)); - xml.Root.Add(new XAttribute("LastSent", lastSent.ToString("o"))); - - using (var stringWriter = new StringWriter()) + using (var stream = new IsolatedStorageFileStream("Usage.xml", FileMode.Create, isf)) { - xml.Save(stringWriter); - var encryptedUsage = Abt.Licensing.Core.EncryptionUtil.Encrypt(stringWriter.ToString(), _password); - using (StreamWriter writer = new StreamWriter(stream)) + var xml = SerializationUtil.Serialize( + _usageCalculator.Usages.Values.Where(e => e.VisitCount > 0)); + xml.Root.Add(new XAttribute("UserId", userId)); + xml.Root.Add(new XAttribute("Enabled", Enabled)); + xml.Root.Add(new XAttribute("LastSent", lastSent.ToString("o"))); + + using (var stringWriter = new StringWriter()) { - writer.Write(encryptedUsage); + xml.Save(stringWriter); + + var encryptedUsage = _encryptionHelper.Encrypt(stringWriter.ToString()); + using (StreamWriter writer = new StreamWriter(stream)) + { + writer.Write(encryptedUsage); + } } } } } + catch { } } public void SendUsagesToServer() @@ -133,29 +189,18 @@ public void GetRatingsFromServer() { if (!_enabled) return; -#if !SILVERLIGHT + //var ratings = _client.GetGlobalUsage(); //ratings.ContinueWith(r => //{ //if (r.Result != null) // _usageCalculator.Ratings = r.Result.ToDictionary(x => x.ExampleID); //}); -#else - //_client.GetGlobalUsageAsync(); - - //_client.GetGlobalUsageCompleted += (sender, args) => - //{ - // if (args.Result.Any()) - // { - // _usageCalculator.Ratings = args.Result; - // } - //}; -#endif } public void SetUsageOnExamples() { - IModule module = ServiceLocator.Container.Resolve(); + var module = ServiceLocator.Container.Resolve(); foreach (var example in module.Examples.Values) { example.Usage = _usageCalculator.GetUsage(example); diff --git a/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/UsageServiceClient.cs b/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/UsageServiceClient.cs index de8e6687..d5b23290 100644 --- a/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/UsageServiceClient.cs +++ b/Examples/SciChart.Examples.Demo/Helpers/UsageTracking/UsageServiceClient.cs @@ -1,14 +1,12 @@ using System; +using System.Collections.Generic; using System.Net; +using System.Security.Cryptography; using System.Threading.Tasks; using RestSharp; -using System.Collections.Generic; -using System.Security.Cryptography; using SciChart.Examples.Demo.Common; using SciChart.UI.Bootstrap; using SciChart.UI.Reactive; -using SciChart.UI.Reactive.Services; - namespace SciChart.Examples.Demo.Helpers.UsageTracking { @@ -17,8 +15,6 @@ public interface IUsageServiceClient Task SendLocalUsage(string userId, List usage); Task> GetGlobalUsage(); - - } [ExportType(typeof(IUsageServiceClient), CreateAs.Singleton)] @@ -31,20 +27,16 @@ public UsageServiceClient(IUsageClientConfiguration config) { Validate.NotNull(config, "config"); Validate.NotNull(config.Address, "config.Address"); - _config = config; + _config = config; } public Task SendLocalUsage(string userId, List usage) { - // Should be working now. - //return TaskEx.FromResult(true); - - UsageData request = new UsageData() { UserId = userId, Usage = usage }; - return Post(request, "Submit"); + UsageData request = new UsageData { UserId = userId, Usage = usage }; + return Post(request, "Submit"); } - public Task> GetGlobalUsage() { var requestTask = Get>("Ratings"); @@ -63,27 +55,19 @@ internal class BoolResponse return Task.Factory.StartNew(() => { var client = new RestClient(_config.Address); - var getRequest = new RestRequest("api/usage/" + action, Method.GET); + getRequest.AddHeader("Authorization", GetAuthHeader(null)); + client.Timeout = 30000; client.Proxy = proxy ?? GetProxyService(); IRestResponse response = client.Execute(getRequest); - if (response.StatusCode == 0) - { - return default(TResponse); - //throw new Exception("We were unable to reach the Server at scichart.com. Please try again later"); - } - if (response.StatusCode != HttpStatusCode.OK) + if (response.StatusCode == 0 || response.StatusCode != HttpStatusCode.OK) { return default(TResponse); - - //string responseBody = response.Content; - //throw new Exception(string.IsNullOrEmpty(responseBody) ? "An unknown error occurred sending the request" : responseBody); } - return response.Data; }); } @@ -93,31 +77,21 @@ private Task Post(TRequest request, string action) return Task.Factory.StartNew(() => { var client = new RestClient(_config.Address); + var restRequest = new RestRequest("api/usage/" + action, Method.POST) {RequestFormat = DataFormat.Json}; - var restRequest = new RestRequest("api/usage/" + action, Method.POST); - restRequest.RequestFormat = DataFormat.Json; restRequest.AddHeader("Authorization", GetAuthHeader(null)); - restRequest.AddBody(request); + restRequest.AddJsonBody(request); + client.Timeout = 30000; client.Proxy = GetProxyService(); var response = client.Execute(restRequest); - if (response.StatusCode == 0) + if (response.StatusCode == 0 || response.StatusCode != HttpStatusCode.OK) { - return default(bool); - - //throw new Exception("We were unable to reach the Server at scichart.com. Please try again later"); - } - if (response.StatusCode != HttpStatusCode.OK) - { - return default(bool); - - //string responseBody = response.Content; - //throw new Exception(string.IsNullOrEmpty(responseBody) ? "An unknown error occurred sending the request" : responseBody); + return false; } - - return response.Data.Result; + return response.Data?.Result ?? false; }); } @@ -190,15 +164,13 @@ private string GetAuthHeader(string username) byte[] messageBytes = encoding.GetBytes(rawSig); string signature; // hash and base64 encode - using (var hmacsha256 = new HMACSHA256(keyByte)) + using (var sha256 = new HMACSHA256(keyByte)) { - byte[] hashmessage = hmacsha256.ComputeHash(messageBytes); - signature = Convert.ToBase64String(hashmessage); + byte[] hashMessage = sha256.ComputeHash(messageBytes); + signature = Convert.ToBase64String(hashMessage); } // build auth header return timestamp + "," + salt + "," + signature; } - - } -} +} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/MainWindow.xaml b/Examples/SciChart.Examples.Demo/MainWindow.xaml index 50a28418..2602e82d 100644 --- a/Examples/SciChart.Examples.Demo/MainWindow.xaml +++ b/Examples/SciChart.Examples.Demo/MainWindow.xaml @@ -3,30 +3,21 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:demo="clr-namespace:SciChart.Examples.Demo" xmlns:s="http://schemas.abtsoftware.co.uk/scichart" - xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals" Title="SciChart > Examples" Width="1380" Height="860" + MinWidth="1024" + MinHeight="768" WindowStartupLocation="CenterScreen" s:Device.SnapsToDevicePixels="True" Background="#222"> - - - - - - - - + + + - diff --git a/Examples/SciChart.Examples.Demo/MainWindow.xaml.cs b/Examples/SciChart.Examples.Demo/MainWindow.xaml.cs index 5341ecee..6e977710 100644 --- a/Examples/SciChart.Examples.Demo/MainWindow.xaml.cs +++ b/Examples/SciChart.Examples.Demo/MainWindow.xaml.cs @@ -1,5 +1,7 @@ using System; +using System.Diagnostics; using System.Windows; +using System.Windows.Input; using Unity; using SciChart.UI.Bootstrap; @@ -25,6 +27,17 @@ public MainWindow() { this.WindowState = WindowState.Maximized; } + + // Always topmost if /quickstart mode used by UIAutomationTests + if (App.UIAutomationTestMode) + { + this.Topmost = true; + } + } + + private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e) + { + Process.Start("explorer.exe", "https://www.scichart.com/scichart-wpf-v6-the-worlds-fastest-wpf-charts/"); } } } diff --git a/Examples/SciChart.Examples.Demo/NullLogger.cs b/Examples/SciChart.Examples.Demo/NullLogger.cs new file mode 100644 index 00000000..861f3bfa --- /dev/null +++ b/Examples/SciChart.Examples.Demo/NullLogger.cs @@ -0,0 +1,33 @@ +using System; +using SciChart.UI.Bootstrap.Utility; + +namespace SciChart.Examples.Demo +{ + public class ConsoleLogger : ILogFacade + { + public void DebugFormat(string format, params object[] args) + { + Console.WriteLine("DEBUG: " + string.Format(format, args)); + } + + public void InfoFormat(string format, params object[] args) + { + Console.WriteLine("INFO: " + string.Format(format, args)); + } + + public void Error(Exception ex) + { + Console.WriteLine("ERROR: " + ex.Message); + } + + public void Debug(string str) + { + Console.WriteLine("DEBUG: " + str); + } + + public void Error(string message, Exception ex) + { + Console.WriteLine("ERROR: " + message + ", " + ex.Message); + } + } +} \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Properties/AssemblyInfo.cs b/Examples/SciChart.Examples.Demo/Properties/AssemblyInfo.cs index 2b413b73..0d4711dc 100644 --- a/Examples/SciChart.Examples.Demo/Properties/AssemblyInfo.cs +++ b/Examples/SciChart.Examples.Demo/Properties/AssemblyInfo.cs @@ -1,18 +1,24 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; +// ************************************************************************************* +// SCICHART® Copyright SciChart Ltd. 2011-2022. All rights reserved. +// +// Web: http://www.scichart.com +// Support: support@scichart.com +// Sales: sales@scichart.com +// +// AssemblyInfo.cs is part of SCICHART®, High Performance Scientific Charts +// For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/ +// +// This source code is protected by international copyright law. Unauthorized +// reproduction, reverse-engineering, or distribution of all or any portion of +// this source code is strictly prohibited. +// +// This source code contains confidential and proprietary trade secrets of +// SciChart Ltd., and should at no time be copied, transferred, sold, +// distributed or made available without express written permission. +// ************************************************************************************* using System.Runtime.InteropServices; using System.Windows; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SciChart.Examples.Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyProduct("SciChart.Examples.Demo")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. diff --git a/Examples/SciChart.Examples.Demo/Resources/Images/scichartlogo.png b/Examples/SciChart.Examples.Demo/Resources/Images/scichartlogo.png index 7a19f25d..ac47045a 100644 Binary files a/Examples/SciChart.Examples.Demo/Resources/Images/scichartlogo.png and b/Examples/SciChart.Examples.Demo/Resources/Images/scichartlogo.png differ diff --git a/Examples/SciChart.Examples.Demo/Resources/Styles/Buttons.xaml b/Examples/SciChart.Examples.Demo/Resources/Styles/Buttons.xaml index ee0a222b..654b43cf 100644 --- a/Examples/SciChart.Examples.Demo/Resources/Styles/Buttons.xaml +++ b/Examples/SciChart.Examples.Demo/Resources/Styles/Buttons.xaml @@ -1,9 +1,77 @@ - + - + + + + + + \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/Resources/Styles/EverythingListBox.xaml b/Examples/SciChart.Examples.Demo/Resources/Styles/EverythingListBox.xaml index f7a3b1c2..f0554499 100644 --- a/Examples/SciChart.Examples.Demo/Resources/Styles/EverythingListBox.xaml +++ b/Examples/SciChart.Examples.Demo/Resources/Styles/EverythingListBox.xaml @@ -3,9 +3,10 @@ xmlns:converters="clr-namespace:SciChart.Examples.Demo.Common.Converters" xmlns:helpers="clr-namespace:SciChart.Examples.Demo.Helpers" xmlns:s="http://schemas.abtsoftware.co.uk/scichart" - xmlns:t="clr-namespace:SciChart.Examples.Demo.Controls.TileControl" xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"> + + @@ -41,10 +42,11 @@ - + + + + diff --git a/Examples/SciChart.Examples.Demo/Resources/Styles/Icons.xaml b/Examples/SciChart.Examples.Demo/Resources/Styles/Icons.xaml index 074dd6d1..f09ddecd 100644 --- a/Examples/SciChart.Examples.Demo/Resources/Styles/Icons.xaml +++ b/Examples/SciChart.Examples.Demo/Resources/Styles/Icons.xaml @@ -94,6 +94,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/SciChart.Examples.Demo/Resources/codeStopwords.dat b/Examples/SciChart.Examples.Demo/Resources/codeStopwords.dat index 7d6898e1..469957e4 100644 --- a/Examples/SciChart.Examples.Demo/Resources/codeStopwords.dat +++ b/Examples/SciChart.Examples.Demo/Resources/codeStopwords.dat @@ -23,6 +23,5 @@ Slider ListBox Button Image -ToolTip ToolTipService.ToolTip ToolTipService \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/SciChart.Examples.Demo.csproj b/Examples/SciChart.Examples.Demo/SciChart.Examples.Demo.csproj index 704d39dc..829b6566 100644 --- a/Examples/SciChart.Examples.Demo/SciChart.Examples.Demo.csproj +++ b/Examples/SciChart.Examples.Demo/SciChart.Examples.Demo.csproj @@ -1,11 +1,12 @@ WinExe - net452;netcoreapp3.0 + net452;netcoreapp3.1 true - + true + SciChartDemoIcon32.ico - false + Latest ..\..\Build\Debug @@ -15,20 +16,21 @@ ..\..\Build\Release\ AnyCPU - + ..\..\Build\Debug - + ..\..\Build\Release - + + - + @@ -60,33 +62,22 @@ - - - - Properties\AssemblyInfoCommon.cs - - - - + + - + - - - - - - - - - + + + + @@ -114,21 +105,15 @@ - - False - ..\Libs\WPFToolkit\System.Windows.Controls.Input.Toolkit.dll - - - - + - + - + - + \ No newline at end of file diff --git a/Examples/SciChart.Examples.Demo/SciChartDemoIcon32.ico b/Examples/SciChart.Examples.Demo/SciChartDemoIcon32.ico index 425dc7b2..0cde364b 100644 Binary files a/Examples/SciChart.Examples.Demo/SciChartDemoIcon32.ico and b/Examples/SciChart.Examples.Demo/SciChartDemoIcon32.ico differ diff --git a/Examples/SciChart.Examples.Demo/ShellControl.xaml b/Examples/SciChart.Examples.Demo/ShellControl.xaml index 05f3c006..d51f8efe 100644 --- a/Examples/SciChart.Examples.Demo/ShellControl.xaml +++ b/Examples/SciChart.Examples.Demo/ShellControl.xaml @@ -132,6 +132,9 @@ Height="32" HorizontalAlignment="Left" VerticalAlignment="Center"> + + + - + - + + + - - - + - + - + RelativeSource={RelativeSource FindAncestor, + AncestorType=ContentPresenter}}" /> @@ -249,8 +296,7 @@ Margin="0" HorizontalAlignment="Stretch" Canvas.ZIndex="0" - tz:Transitionz.Blur="{Binding Path=BackgroundBlurParams, - Mode=OneWay}"> + tz:Transitionz.Blur="{Binding Path=BackgroundBlurParams, Mode=OneWay}"> @@ -267,14 +313,14 @@ - - @@ -341,6 +387,7 @@ HorizontalAlignment="Stretch" IsHitTestVisible="True" Style="{StaticResource transitioningFrameStyle}" + AutomationProperties.AutomationId="ExampleView.TransitioningFrame" tz:Transitionz.Opacity="{tz:OpacityParams From=0, To=1, Duration=100, @@ -392,6 +439,7 @@ @@ -409,7 +457,7 @@ - - + xmlns:b="clr-namespace:SciChart.Examples.Demo.Behaviors"> + - + @@ -37,80 +24,87 @@ + - + - + + + + + + diff --git a/Examples/SciChart.Examples.Demo/Views/SourceTipsView.xaml.cs b/Examples/SciChart.Examples.Demo/Views/SourceTipsView.xaml.cs new file mode 100644 index 00000000..36cd8f5b --- /dev/null +++ b/Examples/SciChart.Examples.Demo/Views/SourceTipsView.xaml.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace SciChart.Examples.Demo.Views +{ + /// + /// Interaction logic for TipsView.xaml + /// + public partial class SourceTipsView : UserControl + { + public SourceTipsView() + { + InitializeComponent(); + } + + private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e) + { + Process.Start("explorer.exe", Urls.GithubRootUrl); + } + } +} diff --git a/Examples/SciChart.Examples.Demo/Views/TipsView.xaml b/Examples/SciChart.Examples.Demo/Views/TipsView.xaml index a419d861..c4f55855 100644 --- a/Examples/SciChart.Examples.Demo/Views/TipsView.xaml +++ b/Examples/SciChart.Examples.Demo/Views/TipsView.xaml @@ -5,7 +5,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals" mc:Ignorable="d" - d:DesignHeight="600" d:DesignWidth="850"> + d:DesignHeight="600" d:DesignWidth="850" + AutomationProperties.AutomationId="TipsView"> @@ -117,9 +118,8 @@ - - - + + @@ -160,7 +160,8 @@ -