1
0
mirror of synced 2024-11-14 09:29:17 +00:00

Revert "Changed Model namespace to Connection, moved bits out to Infrastructure"

This reverts commit ccfde19d2d.
This commit is contained in:
PsychoMark 2016-07-12 16:57:24 +02:00 committed by Mark van Renswoude
parent ccfde19d2d
commit 5cdf8903d4
19 changed files with 28 additions and 114 deletions

View File

@ -5,8 +5,7 @@ using System.Reflection;
using System.Windows;
using System.Windows.Markup;
using Newtonsoft.Json;
using PettingZoo.Connection;
using PettingZoo.Infrastructure;
using PettingZoo.Model;
using PettingZoo.View;
using PettingZoo.ViewModel;
using SimpleInjector;
@ -35,10 +34,6 @@ namespace PettingZoo
container.Register<IConnectionFactory, RabbitMQClientConnectionFactory>();
container.Register<IConnectionInfoBuilder, WindowConnectionInfoBuilder>();
//container.Register<IConnectionFactory>(() => new MockConnectionFactory(10));
//container.Register<IConnectionInfoBuilder, MockConnectionInfoBuilder>();
container.Register<MainWindow>();
container.Register<MainViewModel>();

View File

@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace PettingZoo.Connection
{
public class MockConnection : IConnection
{
private Timer messageTimer;
private bool connected;
public MockConnection(int interval)
{
messageTimer = new Timer(state =>
{
if (!connected)
{
StatusChanged(this, new StatusChangedEventArgs(ConnectionStatus.Connected, "Mock"));
connected = true;
}
MessageReceived(this, new MessageReceivedEventArgs(new MessageInfo
{
Exchange = "mock",
RoutingKey = "mock.mock",
Timestamp = DateTime.Now,
Body = Encoding.UTF8.GetBytes("Mock!"),
Properties = new Dictionary<string, string>
{
{ "mock", "mock" }
}}));
}, null, interval, interval);
}
public void Dispose()
{
if (messageTimer != null)
{
messageTimer.Dispose();
messageTimer = null;
}
}
public event EventHandler<StatusChangedEventArgs> StatusChanged;
public event EventHandler<MessageReceivedEventArgs> MessageReceived;
}
}

View File

@ -1,17 +0,0 @@
namespace PettingZoo.Connection
{
public class MockConnectionFactory : IConnectionFactory
{
private readonly int interval;
public MockConnectionFactory(int interval)
{
this.interval = interval;
}
public IConnection CreateConnection(ConnectionInfo connectionInfo)
{
return new MockConnection(interval);
}
}
}

View File

@ -1,10 +0,0 @@
namespace PettingZoo.Connection
{
public class MockConnectionInfoBuilder : IConnectionInfoBuilder
{
public ConnectionInfo Build()
{
return new ConnectionInfo();
}
}
}

View File

@ -109,7 +109,7 @@ namespace PettingZoo.Infrastructure
return;
}
if (Math.Abs(scrollViewer.VerticalOffset - scrollViewer.ScrollableHeight) <= 1)
if (Math.Abs(scrollViewer.VerticalOffset - scrollViewer.ScrollableHeight) < 1)
target.ScrollIntoView(e.NewItems[e.NewItems.Count - 1]);
}

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public class ConnectionInfo
{

View File

@ -1,6 +1,6 @@
using System;
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public enum ConnectionStatus
{

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public interface IConnectionFactory
{

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public interface IConnectionInfoBuilder
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
namespace PettingZoo.Infrastructure
namespace PettingZoo.Model
{
public class MessageBodyRenderer
{

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public class MessageInfo
{

View File

@ -8,7 +8,7 @@ using PettingZoo.Properties;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public class RabbitMQClientConnection : IConnection
{

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
public class RabbitMQClientConnectionFactory : IConnectionFactory
{

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Connection
namespace PettingZoo.Model
{
static class RabbitMQProperties
{

View File

@ -1,4 +1,4 @@
namespace PettingZoo.Infrastructure
namespace PettingZoo.Model
{
public interface IUserSettingsSerializer
{

View File

@ -113,24 +113,21 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Connection\MockConnection.cs" />
<Compile Include="Connection\MockConnectionFactory.cs" />
<Compile Include="Connection\MockConnectionInfoBuilder.cs" />
<Compile Include="Infrastructure\DelegateCommand.cs" />
<Compile Include="Infrastructure\BaseViewModel.cs" />
<Compile Include="Infrastructure\GridLayout.cs" />
<Compile Include="Infrastructure\ListBoxAutoScroll.cs" />
<Compile Include="Infrastructure\PasswordBoxAssistant.cs" />
<Compile Include="Infrastructure\UserSettings.cs" />
<Compile Include="Connection\IConnection.cs" />
<Compile Include="Connection\IConnectionFactory.cs" />
<Compile Include="Connection\IConnectionInfoBuilder.cs" />
<Compile Include="Connection\ConnectionInfo.cs" />
<Compile Include="Infrastructure\MessageBodyRenderer.cs" />
<Compile Include="Connection\MessageInfo.cs" />
<Compile Include="Connection\RabbitMQClientConnection.cs" />
<Compile Include="Connection\RabbitMQClientConnectionFactory.cs" />
<Compile Include="Connection\RabbitMQProperties.cs" />
<Compile Include="Model\UserSettings.cs" />
<Compile Include="Model\IConnection.cs" />
<Compile Include="Model\IConnectionFactory.cs" />
<Compile Include="Model\IConnectionInfoBuilder.cs" />
<Compile Include="Model\ConnectionInfo.cs" />
<Compile Include="Model\MessageBodyRenderer.cs" />
<Compile Include="Model\MessageInfo.cs" />
<Compile Include="Model\RabbitMQClientConnection.cs" />
<Compile Include="Model\RabbitMQClientConnectionFactory.cs" />
<Compile Include="Model\RabbitMQProperties.cs" />
<Compile Include="ViewModel\ConnectionViewModel.cs" />
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="View\ConnectionWindow.xaml.cs">

View File

@ -1,8 +1,7 @@
using System.Windows;
using System.Windows.Input;
using AutoMapper;
using PettingZoo.Connection;
using PettingZoo.Infrastructure;
using PettingZoo.Model;
using PettingZoo.ViewModel;
namespace PettingZoo.View

View File

@ -1,8 +1,8 @@
using System;
using System.Windows.Input;
using AutoMapper;
using PettingZoo.Connection;
using PettingZoo.Infrastructure;
using PettingZoo.Model;
namespace PettingZoo.ViewModel
{

View File

@ -4,8 +4,8 @@ using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using PettingZoo.Connection;
using PettingZoo.Infrastructure;
using PettingZoo.Model;
using PettingZoo.Properties;
namespace PettingZoo.ViewModel
@ -188,13 +188,13 @@ namespace PettingZoo.ViewModel
if (args != null)
switch (args.Status)
{
case Connection.ConnectionStatus.Connecting:
case Model.ConnectionStatus.Connecting:
return String.Format(Resources.StatusConnecting, args.Context);
case Connection.ConnectionStatus.Connected:
case Model.ConnectionStatus.Connected:
return String.Format(Resources.StatusConnected, args.Context);
case Connection.ConnectionStatus.Error:
case Model.ConnectionStatus.Error:
return String.Format(Resources.StatusError, args.Context);
}