Exemplo n.º 1
0
        private void SetUpDisconnectedState()
        {
            ConnectionInfo = null;
            ActiveChats.Clear();
            SessionID = null;

            while (SearchRequests.Count > 1)
            {
                SearchRequests.Pop();
            }

            _clientEventId = 1;

            KeepAliveTimer.Stop();
        }
        private void handleSolutionsMessage(SolutionsMessage solutionsMessage)
        {
            bool isOnGoing = false;

            if (solutionsMessage.Solutions[0].Type == SolutionsSolutionType.Ongoing)
            {
                SmartConsole.PrintLine("Ongoing computations. Waiting for full solution", SmartConsole.DebugLevel.Basic);
            }
            else
            {
                for (int i = 0; i < solutionsMessage.Solutions.Count(); i++)
                {
                    if (solutionsMessage.Solutions[i].Type == SolutionsSolutionType.Ongoing)
                    {
                        isOnGoing = true;
                        break;
                    }
                }
                if (isOnGoing)
                {
                    SmartConsole.PrintLine("Ongoing computations. Waiting for full solution", SmartConsole.DebugLevel.Basic);
                }
                else
                {
                    DateTime nowTime = DateTime.Now;

                    int deltaSecs = nowTime.Second - Program.COMP_TIME.Second;
                    int deltaMs   = nowTime.Millisecond - Program.COMP_TIME.Millisecond;

                    string timeStr = "Seconds = " + deltaSecs + ", Milliseconds = " + deltaMs;

                    SmartConsole.PrintLine("Complete solution has been received", SmartConsole.DebugLevel.Advanced);

                    finalSolutionHelper(solutionsMessage);

                    SmartConsole.PrintLine("Computation Time: \n" + timeStr, SmartConsole.DebugLevel.Advanced);

                    // TODO print solution
                    keepAliveTimer.Stop();
                }
            }
        }