Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Examples/IExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Examples
{
public interface IExample
{
void Run(string pythonExePath, string dasPlotPyPath);
}
}
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExampleArс.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExampleArс
class ExampleArс : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
#region create test data

Expand Down
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExampleHistogram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExampleHistogram
class ExampleHistogram : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
#region create test data

Expand Down
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExamplePoint2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExamplePoint2D
class ExamplePoint2D : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
// init engine with right paths
var matplotlibCs = new MatplotlibCS.MatplotlibCS(pythonExePath, dasPlotPyPath);
Expand Down
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExampleSin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExampleSin
class ExampleSin : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
#region create test data

Expand Down
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExampleTimeAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExampleTimeAxis
class ExampleTimeAxis : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
#region create test data

Expand Down
4 changes: 2 additions & 2 deletions Examples/Plot2D/ExampleVisibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace Examples.Plot2D
{
class ExampleVisibility
class ExampleVisibility : IExample
{
/// <summary>
/// Chart of sin
/// </summary>
public static void Run(string pythonExePath, string dasPlotPyPath)
public void Run(string pythonExePath, string dasPlotPyPath)
{
// init engine with right paths
var matplotlibCs = new MatplotlibCS.MatplotlibCS(pythonExePath, dasPlotPyPath);
Expand Down
37 changes: 28 additions & 9 deletions Examples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Examples.Plot2D;
using System;
using System.Linq;
using System.Reflection;

namespace Examples
{
Expand All @@ -20,22 +22,39 @@ class Program

static void Main(string[] args)
{
if (args.Length != 2)
if (args.Length != 3)
{
Console.WriteLine("You must specify path to python.exe and to matplotlib_cs.py in command line arguments");
Console.ReadKey();
return;
}

_pythonExePath = args[0];
_matplotlibPyPath = args[1];
_pythonExePath = args[1];
_matplotlibPyPath = args[2];

var assembly = Assembly.GetEntryAssembly();
foreach (Type type in assembly.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(IExample))))
{
if (args.Length > 0 && !args.Contains(type.Name))
continue;

Console.WriteLine($"{DateTime.UtcNow} Starting {type.Name}");

var example = (IExample)Activator.CreateInstance(type);

try
{
example.Run(_pythonExePath, _matplotlibPyPath);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}

Console.WriteLine($"{DateTime.UtcNow} Completed {type.Name}");
}

//ExampleSin.Run(_pythonExePath, _matplotlibPyPath);
ExampleArс.Run(_pythonExePath, _matplotlibPyPath);
//ExampleVisibility.Run(_pythonExePath, _matplotlibPyPath);
//ExampleHistogram.Run(_pythonExePath, _matplotlibPyPath);
//ExampleTimeAxis.Run(_pythonExePath, _matplotlibPyPath);
//ExamplePoint2D.Run(_pythonExePath, _matplotlibPyPath);
Console.ReadLine();
}
}
}
3 changes: 2 additions & 1 deletion Examples/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"profiles": {
"Examples": {
"commandName": "Project"
"commandName": "Project",
"commandLineArgs": "ExamplePoint2D python.exe tmp"
}
}
}