DataStreamInterfaceTest and DataStreamMeter projects added
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition.Hosting;
|
||||
using System.Windows.Forms;
|
||||
using DataStreamInterface;
|
||||
|
||||
namespace DataStreamInterfaceTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
#if DEBUG
|
||||
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Debug";
|
||||
#else
|
||||
const string CatalogDir = "..\\..\\..\\DataStreamMeter\\bin\\Release";
|
||||
#endif
|
||||
|
||||
[Import(typeof(IDataStreamMeter))]
|
||||
IDataStreamMeter dataStreamMeter;
|
||||
|
||||
private Program()
|
||||
{
|
||||
Console.WriteLine("Components found:");
|
||||
foreach (var file in Directory.EnumerateFiles(CatalogDir))
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var catalog = new AggregateCatalog();
|
||||
catalog.Catalogs.Add(new AssemblyCatalog(typeof(DataStreamInterface.IDataStreamMeter).Assembly));
|
||||
catalog.Catalogs.Add(new DirectoryCatalog(CatalogDir));
|
||||
(new CompositionContainer(catalog)).ComposeParts(this);
|
||||
}
|
||||
catch (CompositionException compositionException)
|
||||
{
|
||||
Console.WriteLine(compositionException.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Program p = new Program();
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DemoMainWnd(p.dataStreamMeter));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user