Skip to content

Commit 116bb98

Browse files
committed
Update new interface and add more than 1 data provider
1 parent 5fe1256 commit 116bb98

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

Analogy.LogViewer.Example.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>Analogy.LogViewer.Example</id>
5-
<version>1.0.5.0</version>
5+
<version>1.0.6.0</version>
66
<title>Analogy Log Viewer - Example</title>
77
<authors>Lior Banai</authors>
88
<owners>Lior Banai</owners>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using Analogy.Interfaces;
34
using Analogy.Interfaces.Factories;
45

@@ -8,6 +9,10 @@ public class AnalogyDataProviderFactory : IAnalogyDataProvidersFactory
89
{
910
public string Title => "Analogy Online example";
1011

11-
public IEnumerable<IAnalogyDataProvider> Items => new List<IAnalogyDataProvider> { new AnalogyOnlineExampleDataProvider() };
12+
public IEnumerable<IAnalogyDataProvider> Items => new List<IAnalogyDataProvider>
13+
{
14+
new AnalogyOnlineExampleDataProvider("Data Provider 1", new Guid("6642B160-F992-4120-B688-B02DE2E83256")),
15+
new AnalogyOnlineExampleDataProvider("Data Provider 2", new Guid("5AB690DC-545B-4150-B2CD-2534B2ACBF82"))
16+
};
1217
}
1318
}

Analogy.LogViewer.Example/AnalogyExampleFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public class AnalogyExampleFactory : IAnalogyFactory
1919
{
2020
new AnalogyChangeLog("Create example implementation",AnalogChangeLogType.None, "Lior Banai",new DateTime(2019, 08, 15)),
2121
new AnalogyChangeLog("Add Thread ID",AnalogChangeLogType.None, "Lior Banai",new DateTime(2019, 08, 20)),
22-
new AnalogyChangeLog("Add File handler for online data source (aligned with new interface)",AnalogChangeLogType.None, "Lior Banai",new DateTime(2019, 09, 09))
22+
new AnalogyChangeLog("Add File handler for online data source (aligned with new interface)",AnalogChangeLogType.None, "Lior Banai",new DateTime(2019, 09, 09)),
23+
new AnalogyChangeLog("Update new interface and add more than 1 data provider",AnalogChangeLogType.None, "Lior Banai",new DateTime(2019, 12, 01))
2324
};
2425
public IEnumerable<string> Contributors { get; } = new List<string> { "Lior Banai" };
2526
public string About { get; } = "Analogy Example Data Source";

Analogy.LogViewer.Example/AnalogyOnlineExampleDataProvider.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace Analogy.LogViewer.Example
1010
{
1111
class AnalogyOnlineExampleDataProvider : IAnalogyRealTimeDataProvider
1212
{
13-
public string OptionalTitle { get; } = "Analogy Example: Real time Data Provider";
14-
public Guid ID => new Guid("6642B160-F992-4120-B688-B02DE2E83256");
13+
public string OptionalTitle { get; }
14+
public Guid ID {get;}
1515

1616
public bool AutoStartAtLaunch => true;
1717
public bool IsConnected => true;
@@ -27,7 +27,13 @@ class AnalogyOnlineExampleDataProvider : IAnalogyRealTimeDataProvider
2727
readonly Random random = new Random();
2828
readonly Array values = Enum.GetValues(typeof(AnalogyLogLevel));
2929
private readonly List<string> processes = Process.GetProcesses().Select(p => p.ProcessName).ToList();
30-
30+
private readonly string prefixMessage;
31+
public AnalogyOnlineExampleDataProvider(string prefix,Guid guid)
32+
{
33+
prefixMessage = prefix;
34+
ID = guid;
35+
OptionalTitle = $"Analogy Example: Real time Data Provider {prefix}";
36+
}
3137
public Task InitializeDataProviderAsync()
3238
{
3339
SimulateOnlineMessages = new Timer(100);
@@ -43,14 +49,14 @@ public Task InitializeDataProviderAsync()
4349
string randomProcess = processes[random.Next(processes.Count)];
4450
AnalogyLogMessage m = new AnalogyLogMessage
4551
{
46-
Text = $"Generated message #{messageCount++}",
52+
Text = $"{prefixMessage}: Generated message #{messageCount++}",
4753
Level = randomLevel,
4854
Class = AnalogyLogClass.General,
4955
Source = "Example",
5056
Module = randomProcess
5157
};
5258

53-
OnMessageReady(this, new AnalogyLogMessageArgs(m, Environment.MachineName, "Example", ID));
59+
OnMessageReady?.Invoke(this, new AnalogyLogMessageArgs(m, Environment.MachineName, "Example", ID));
5460
}
5561
};
5662
return Task.CompletedTask;

Analogy.LogViewer.Example/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.0.5.0")]
35-
[assembly: AssemblyFileVersion("1.0.5.0")]
34+
[assembly: AssemblyVersion("1.0.6.0")]
35+
[assembly: AssemblyFileVersion("1.0.6.0")]

0 commit comments

Comments
 (0)