Esempio n. 1
0
        private void RiskSimulator_Click(object sender, System.EventArgs e)
        {
            mainPane.Controls.Clear();
            SimulatorWindow sw = new SimulatorWindow(mc);

            mainPane.Controls.Add(sw);
        }
Esempio n. 2
0
        private void TryLogin(object parameter)
        {
            //Sends the info to the server and tries a login
            PasswordBox psbox = (PasswordBox)parameter;

            Password = psbox.Password;
            if (ValidateFields())
            {
                UserLogin userLogin = new UserLogin(Username, Password);
                Tuple <object, HttpStatusCode> returnTuple = httpClient.PostRequest(ApiConfigs.LoginRoute, userLogin);

                switch (returnTuple.Item2)
                {
                case HttpStatusCode.OK:
                    JObject jobj     = (JObject)returnTuple.Item1;
                    User    loggedIn = jobj.ToObject <User>();
                    UpdateSessionOnUserLogin(loggedIn);
                    CheckAndSendExceptions();
                    logger.Print($"Welcome Back {loggedIn.Username}!");
                    SimulatorWindow simulatorWindow = new SimulatorWindow(loggedIn);
                    simulatorWindow.Show();
                    CloseThisWindow();
                    break;

                case HttpStatusCode.Conflict:
                    logger.Print("Username or password are unvalid.");
                    break;

                default:
                    logger.Print($"{returnTuple.Item2.ToString()} Error.");
                    break;
                }
            }
        }
Esempio n. 3
0
        public void SetSelectedTrackBlockTest1()
        {
            SimulatorWindow target = new SimulatorWindow(); // TODO: Initialize to an appropriate value
            TrackBlock      block  = null;                  // TODO: Initialize to an appropriate value

            target.SetSelectedTrackBlock(block);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Esempio n. 4
0
        private void StartSimulation()
        {
            var simulator = new SimulatorWindow();

            simulator.Show(new GameConfiguration
            {
                BotPathList   = BotInformations.Select(b => b.Path).ToList(),
                BotsPerTeam   = int.Parse(Configuration.BotsPerTeam),
                GameType      = int.Parse(Configuration.GameType),
                MapPath       = Configuration.MapPath,
                NumberOfTurns = int.Parse(Configuration.NumberOfTurns),
                Speed         = int.Parse(Configuration.Interval)
            });
        }
Esempio n. 5
0
        private void Start(object parameter)
        {
            List <Frame> frames = new List <Frame>();

            for (int i = 0; i < PacketSizeViewModel.GetSize(); i++)
            {
                frames.Add(DataGenerator.GenerateFrame(FrameSizeViewModel.GetSize(),
                                                       FrameChecksumViewModel.SelectedChecksumType, FrameChecksumViewModel.GetChecksumSize()));
            }

            Packet packet = DataGenerator.GeneratePacket(frames,
                                                         PacketChecksumViewModel.SelectedChecksumType, PacketChecksumViewModel.GetChecksumSize());

            ErrorNumbers errorNumbers = new ErrorNumbers
            {
                SizeType    = ErrorsSizeViewModel.SizeType,
                FixedSize   = ErrorsSizeViewModel.FixedSize,
                RandomEnd   = ErrorsSizeViewModel.RandomEnd,
                RandomStart = ErrorsSizeViewModel.RandomStart
            };

            SimulatorOptions options = new SimulatorOptions
            {
                Packet             = packet,
                DurationModel      = DurationViewModel,
                ErrorGenerator     = ErrorGeneratorFactory.Create(ErrorsViewModel.ErrorPositionType, errorNumbers),
                FaultyFramesNumber = ErrorsViewModel.LimitFaultyFrames ? ErrorsViewModel.FrameNumber : 0,
                FrameChecksumType  = FrameChecksumViewModel.SelectedChecksumType,
                PacketChecksumType = PacketChecksumViewModel.SelectedChecksumType
            };

            Simulator       simulator       = new Simulator(options);
            SimulatorWindow simulatorWindow = new SimulatorWindow(simulator);

            simulatorWindow.ShowDialog();
        }
Esempio n. 6
0
        public void SimulatorWindowConstructorTest()
        {
            SimulatorWindow target = new SimulatorWindow();

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Esempio n. 7
0
 private void StartSimulation()
 {
     var simulator = new SimulatorWindow();
     simulator.Show(new GameConfiguration
     {
         BotPathList = BotInformations.Select(b => b.Path).ToList(),
         BotsPerTeam = int.Parse(Configuration.BotsPerTeam),
         GameType = int.Parse(Configuration.GameType),
         MapPath = Configuration.MapPath,
         NumberOfTurns = int.Parse(Configuration.NumberOfTurns),
         Speed = int.Parse(Configuration.Interval)
     });
 }