protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            connectionService = Services.Forwarder.GetService<Services.ConnectionService>();
            connectionService.ServerPairSuccessful += connectionService_ServerPairSuccessful;
            connectionService.ServerPairUnsuccessful += connectionService_ServerPairUnsuccessful;
            connectionService.ServerPairCanceled += connectionService_ServerPairCanceled;
        }
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            if (!PairedSuccessfully)
                connectionService.CancelPairingRequest();

            connectionService.ServerPairSuccessful -= connectionService_ServerPairSuccessful;
            connectionService.ServerPairUnsuccessful -= connectionService_ServerPairUnsuccessful;
            connectionService.ServerPairCanceled -= connectionService_ServerPairCanceled;
            connectionService = null;
        }
        public void Connnection()
        {
            string URL              = "http://www.hogehoge.com/";
            var    logger           = new Prism.Logging.TextLogger();
            var    connection       = new Services.ConnectionService(logger);
            var    reactionHubProxy = new Services.ReactionHubProxy(logger, connection);

            int StartCount = 0;
            int StopCount  = 0;

            using (ShimsContext.Create()) {
                var mockHubProxy = new Moq.Mock <Microsoft.AspNet.SignalR.Client.IHubProxy>();

                Microsoft.AspNet.SignalR.Client.Fakes.ShimHubConnection.ConstructorString = (ins, url) =>
                {
                    Assert.AreEqual(URL, url);
                };

                Microsoft.AspNet.SignalR.Client.Fakes.ShimHubConnection.AllInstances.CreateHubProxyString = (ins, hubName) =>
                {
                    Assert.IsNotNull(hubName);
                    return(mockHubProxy.Object);
                };

                Microsoft.AspNet.SignalR.Client.Fakes.ShimConnection.AllInstances.Start = (ins) =>
                {
                    StartCount++;
                    return(System.Threading.Tasks.Task.CompletedTask);
                };

                Microsoft.AspNet.SignalR.Client.Fakes.ShimConnection.AllInstances.Stop = (ins) =>
                {
                    StopCount++;
                };

                reactionHubProxy.ServerURL = URL;
                reactionHubProxy.Open();
                connection.Dispose();
            }

            Assert.AreEqual(1, StartCount);
            Assert.AreEqual(1, StopCount);
        }