Revert "Changed Model namespace to Connection, moved bits out to Infrastructure"
This reverts commit ccfde19d2d
.
This commit is contained in:
parent
ccfde19d2d
commit
5cdf8903d4
@ -5,8 +5,7 @@ using System.Reflection;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Markup;
|
using System.Windows.Markup;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PettingZoo.Connection;
|
using PettingZoo.Model;
|
||||||
using PettingZoo.Infrastructure;
|
|
||||||
using PettingZoo.View;
|
using PettingZoo.View;
|
||||||
using PettingZoo.ViewModel;
|
using PettingZoo.ViewModel;
|
||||||
using SimpleInjector;
|
using SimpleInjector;
|
||||||
@ -35,10 +34,6 @@ namespace PettingZoo
|
|||||||
container.Register<IConnectionFactory, RabbitMQClientConnectionFactory>();
|
container.Register<IConnectionFactory, RabbitMQClientConnectionFactory>();
|
||||||
container.Register<IConnectionInfoBuilder, WindowConnectionInfoBuilder>();
|
container.Register<IConnectionInfoBuilder, WindowConnectionInfoBuilder>();
|
||||||
|
|
||||||
//container.Register<IConnectionFactory>(() => new MockConnectionFactory(10));
|
|
||||||
//container.Register<IConnectionInfoBuilder, MockConnectionInfoBuilder>();
|
|
||||||
|
|
||||||
|
|
||||||
container.Register<MainWindow>();
|
container.Register<MainWindow>();
|
||||||
container.Register<MainViewModel>();
|
container.Register<MainViewModel>();
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace PettingZoo.Connection
|
|
||||||
{
|
|
||||||
public class MockConnectionInfoBuilder : IConnectionInfoBuilder
|
|
||||||
{
|
|
||||||
public ConnectionInfo Build()
|
|
||||||
{
|
|
||||||
return new ConnectionInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -109,7 +109,7 @@ namespace PettingZoo.Infrastructure
|
|||||||
return;
|
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]);
|
target.ScrollIntoView(e.NewItems[e.NewItems.Count - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public class ConnectionInfo
|
public class ConnectionInfo
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public enum ConnectionStatus
|
public enum ConnectionStatus
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public interface IConnectionFactory
|
public interface IConnectionFactory
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public interface IConnectionInfoBuilder
|
public interface IConnectionInfoBuilder
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PettingZoo.Infrastructure
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public class MessageBodyRenderer
|
public class MessageBodyRenderer
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public class MessageInfo
|
public class MessageInfo
|
||||||
{
|
{
|
@ -8,7 +8,7 @@ using PettingZoo.Properties;
|
|||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
|
|
||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public class RabbitMQClientConnection : IConnection
|
public class RabbitMQClientConnection : IConnection
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public class RabbitMQClientConnectionFactory : IConnectionFactory
|
public class RabbitMQClientConnectionFactory : IConnectionFactory
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Connection
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
static class RabbitMQProperties
|
static class RabbitMQProperties
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
namespace PettingZoo.Infrastructure
|
namespace PettingZoo.Model
|
||||||
{
|
{
|
||||||
public interface IUserSettingsSerializer
|
public interface IUserSettingsSerializer
|
||||||
{
|
{
|
@ -113,24 +113,21 @@
|
|||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Connection\MockConnection.cs" />
|
|
||||||
<Compile Include="Connection\MockConnectionFactory.cs" />
|
|
||||||
<Compile Include="Connection\MockConnectionInfoBuilder.cs" />
|
|
||||||
<Compile Include="Infrastructure\DelegateCommand.cs" />
|
<Compile Include="Infrastructure\DelegateCommand.cs" />
|
||||||
<Compile Include="Infrastructure\BaseViewModel.cs" />
|
<Compile Include="Infrastructure\BaseViewModel.cs" />
|
||||||
<Compile Include="Infrastructure\GridLayout.cs" />
|
<Compile Include="Infrastructure\GridLayout.cs" />
|
||||||
<Compile Include="Infrastructure\ListBoxAutoScroll.cs" />
|
<Compile Include="Infrastructure\ListBoxAutoScroll.cs" />
|
||||||
<Compile Include="Infrastructure\PasswordBoxAssistant.cs" />
|
<Compile Include="Infrastructure\PasswordBoxAssistant.cs" />
|
||||||
<Compile Include="Infrastructure\UserSettings.cs" />
|
<Compile Include="Model\UserSettings.cs" />
|
||||||
<Compile Include="Connection\IConnection.cs" />
|
<Compile Include="Model\IConnection.cs" />
|
||||||
<Compile Include="Connection\IConnectionFactory.cs" />
|
<Compile Include="Model\IConnectionFactory.cs" />
|
||||||
<Compile Include="Connection\IConnectionInfoBuilder.cs" />
|
<Compile Include="Model\IConnectionInfoBuilder.cs" />
|
||||||
<Compile Include="Connection\ConnectionInfo.cs" />
|
<Compile Include="Model\ConnectionInfo.cs" />
|
||||||
<Compile Include="Infrastructure\MessageBodyRenderer.cs" />
|
<Compile Include="Model\MessageBodyRenderer.cs" />
|
||||||
<Compile Include="Connection\MessageInfo.cs" />
|
<Compile Include="Model\MessageInfo.cs" />
|
||||||
<Compile Include="Connection\RabbitMQClientConnection.cs" />
|
<Compile Include="Model\RabbitMQClientConnection.cs" />
|
||||||
<Compile Include="Connection\RabbitMQClientConnectionFactory.cs" />
|
<Compile Include="Model\RabbitMQClientConnectionFactory.cs" />
|
||||||
<Compile Include="Connection\RabbitMQProperties.cs" />
|
<Compile Include="Model\RabbitMQProperties.cs" />
|
||||||
<Compile Include="ViewModel\ConnectionViewModel.cs" />
|
<Compile Include="ViewModel\ConnectionViewModel.cs" />
|
||||||
<Compile Include="ViewModel\MainViewModel.cs" />
|
<Compile Include="ViewModel\MainViewModel.cs" />
|
||||||
<Compile Include="View\ConnectionWindow.xaml.cs">
|
<Compile Include="View\ConnectionWindow.xaml.cs">
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using PettingZoo.Connection;
|
using PettingZoo.Model;
|
||||||
using PettingZoo.Infrastructure;
|
|
||||||
using PettingZoo.ViewModel;
|
using PettingZoo.ViewModel;
|
||||||
|
|
||||||
namespace PettingZoo.View
|
namespace PettingZoo.View
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using PettingZoo.Connection;
|
|
||||||
using PettingZoo.Infrastructure;
|
using PettingZoo.Infrastructure;
|
||||||
|
using PettingZoo.Model;
|
||||||
|
|
||||||
namespace PettingZoo.ViewModel
|
namespace PettingZoo.ViewModel
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,8 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using PettingZoo.Connection;
|
|
||||||
using PettingZoo.Infrastructure;
|
using PettingZoo.Infrastructure;
|
||||||
|
using PettingZoo.Model;
|
||||||
using PettingZoo.Properties;
|
using PettingZoo.Properties;
|
||||||
|
|
||||||
namespace PettingZoo.ViewModel
|
namespace PettingZoo.ViewModel
|
||||||
@ -188,13 +188,13 @@ namespace PettingZoo.ViewModel
|
|||||||
if (args != null)
|
if (args != null)
|
||||||
switch (args.Status)
|
switch (args.Status)
|
||||||
{
|
{
|
||||||
case Connection.ConnectionStatus.Connecting:
|
case Model.ConnectionStatus.Connecting:
|
||||||
return String.Format(Resources.StatusConnecting, args.Context);
|
return String.Format(Resources.StatusConnecting, args.Context);
|
||||||
|
|
||||||
case Connection.ConnectionStatus.Connected:
|
case Model.ConnectionStatus.Connected:
|
||||||
return String.Format(Resources.StatusConnected, args.Context);
|
return String.Format(Resources.StatusConnected, args.Context);
|
||||||
|
|
||||||
case Connection.ConnectionStatus.Error:
|
case Model.ConnectionStatus.Error:
|
||||||
return String.Format(Resources.StatusError, args.Context);
|
return String.Format(Resources.StatusError, args.Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user