Skip to content

Commit 934484a

Browse files
authored
Merge pull request #49 from bingenito/main
Change channel type from string to simple enum
2 parents 958cdb0 + f227f83 commit 934484a

File tree

7 files changed

+31
-8
lines changed

7 files changed

+31
-8
lines changed

src/Examples/WpfFdc3/Fdc3/Channel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class Channel : IChannel
2626
private readonly Dictionary<string, IContext> _lastContexts = new Dictionary<string, IContext>();
2727
private IContext? _lastContext;
2828

29-
public Channel(string id, string type)
29+
public Channel(string id, ChannelType type)
3030
{
3131
this.Id = id;
3232
this.Type = type;
@@ -35,7 +35,7 @@ public Channel(string id, string type)
3535

3636
public string Id { get; }
3737

38-
public string Type { get; }
38+
public ChannelType Type { get; }
3939

4040
public IDisplayMetadata? DisplayMetadata => throw new System.NotImplementedException();
4141

src/Examples/WpfFdc3/Fdc3/DesktopAgent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal class DesktopAgent : IDesktopAgent
2828

2929
public DesktopAgent()
3030
{
31-
_channels.Add(new Channel("global", "app"));
31+
_channels.Add(new Channel("global", ChannelType.App));
3232
}
3333

3434
public Task<IListener> AddContextListener<T>(string? contextType, ContextHandler<T> handler) where T : IContext
@@ -99,7 +99,7 @@ public Task<IChannel> GetOrCreateChannel(string channelId)
9999
IChannel channel = _channels.First<IChannel>(channel => channel.Id == channelId);
100100
if (channel == null)
101101
{
102-
channel = new Channel(channelId, "app");
102+
channel = new Channel(channelId, ChannelType.App);
103103
_channels.Add(channel);
104104
}
105105

src/Fdc3.NewtonsoftJson/MorganStanley.Fdc3.NewtonsoftJson.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<RootNamespace>MorganStanley.Fdc3.NewtonsoftJson</RootNamespace>
55
<AssemblyName>MorganStanley.Fdc3.NewtonsoftJson</AssemblyName>
66
<VersionPrefix>2.0.0</VersionPrefix>
7-
<VersionSuffix>alpha.3</VersionSuffix>
7+
<VersionSuffix>alpha.4</VersionSuffix>
88
<Product>.NET FDC3 Newtonsoft JSON</Product>
99
<SignAssembly>true</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\keypair.snk</AssemblyOriginatorKeyFile>

src/Fdc3/ChannelType.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Morgan Stanley makes this available to you under the Apache License,
3+
* Version 2.0 (the "License"). You may obtain a copy of the License at
4+
*
5+
* http://www.apache.org/licenses/LICENSE-2.0.
6+
*
7+
* See the NOTICE file distributed with this work for additional information
8+
* regarding copyright ownership. Unless required by applicable law or agreed
9+
* to in writing, software distributed under the License is distributed on an
10+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11+
* or implied. See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*/
14+
15+
namespace MorganStanley.Fdc3
16+
{
17+
public enum ChannelType
18+
{
19+
User = 1,
20+
App = 2,
21+
Private = 3
22+
}
23+
}

src/Fdc3/IChannel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface IChannel: IIntentResult
3232
/// <summary>
3333
/// Uniquely defines each channel type.
3434
/// </summary>
35-
string Type { get; }
35+
ChannelType Type { get; }
3636

3737
/// <summary>
3838
/// Channels may be visualized and selectable by users. DisplayMetadata may be used to provide hints on how to see them.

src/Fdc3/MorganStanley.Fdc3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<RootNamespace>MorganStanley.Fdc3</RootNamespace>
55
<AssemblyName>MorganStanley.Fdc3</AssemblyName>
66
<VersionPrefix>2.0.0</VersionPrefix>
7-
<VersionSuffix>alpha.3</VersionSuffix>
7+
<VersionSuffix>alpha.4</VersionSuffix>
88
<Product>.NET FDC3</Product>
99
<SignAssembly>true</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\keypair.snk</AssemblyOriginatorKeyFile>

src/Tests/MorganStanley.Fdc3.Tests/IChannelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private class MockChannel : IChannel
3636

3737
public string Id => throw new NotImplementedException();
3838

39-
public string Type => throw new NotImplementedException();
39+
public ChannelType Type => throw new NotImplementedException();
4040

4141
public IDisplayMetadata? DisplayMetadata => throw new NotImplementedException();
4242

0 commit comments

Comments
 (0)