This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace View | |
{ | |
public partial class Form1 : Form | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connect to the service | |
var hubConnection = new HubConnection("http://localhost:8080"); | |
// Create a proxy to the chat service | |
IHubProxy collectionHub = hubConnection.CreateHubProxy("CollectionHub"); | |
IHubProxy collectionHub2 = hubConnection.CreateHubProxy("CollectionHub"); | |
/* VERSUS */ | |
//Connect to the service, this would be on one instance of a client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void FindAndConvertParameter<R, T>(IList<R> parameters, string name, out T value) where R : ApplicationParameterDto | |
{ | |
value = default(T); | |
ApplicationParameterDto parameter = ((List<R>) parameters).Find(dto => dto.Name.Trim().ToUpper() == name.Trim().ToUpper()); | |
if (parameter != null && !String.IsNullOrWhiteSpace(parameter.Value)) | |
{ | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ABEthernetDriver | |
{ | |
/* Some other methods and properties, constructor */ | |
private ITcpClient _client; | |
private INetworkStream _nstream; | |
public void Connect() | |
{ | |
_nstream = _client.GetStream(); | |
byte[] numArray = new byte[] {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IStream | |
{ | |
void Write(byte[] buffer, int offset, int count); | |
void Close(); | |
int EndRead(IAsyncResult asyncResult); | |
IAsyncResult BeginRead([In,Out] byte[] buffer, int offset, int size, AsyncCallback callback, object state); | |
} | |
public class NetworkStreamStub : IStream | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class ABEthernetDriverTest | |
{ | |
[Test] | |
public void ShouldConnectToABEthernetDriver() | |
{ | |
//Arrange | |
byte[] readBuffer = new byte[] { 2, 1, 0, 0, 0, 35, 1, 2, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
NEW STRUCTURE OF THE FACTORY | |
- No longer static | |
- Uses interface so we can mock response | |
*/ | |
public interface IDriverFactory { IDriver CreateDriver(DriverType driverType, string ip); } | |
public class DriverFactory : IDriverFactory | |
{ | |
public IDriver CreateDriver(DriverType driverType, string ip) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProjectBuilder() | |
{ | |
private int id; | |
private string title; | |
private string description; | |
private int teamId; | |
private string location; | |
private User user; | |
private Priority priority; | |
private Category category; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.SignalR.Client; | |
/* Requires Microsoft.AspNet.SignalR.Client */ | |
/* Requires Microsoft.Bcl.Async if running on .NET 4.0 */ | |
namespace HubConnectionManager | |
{ | |
public interface IHubConnectionManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DialogBehavior : Behavior<MetroWindow> | |
{ | |
public MetroWindow Window { get; set; } | |
protected override void OnAttached() | |
{ | |
base.OnAttached(); | |
Window = base.AssociatedObject; |
OlderNewer