public void Initialize()
        {
            _logic = new AfiliadoLogic();

            _estadoCivil   = Initializator.EstadoCivil(CmbEstadoCivil);
            _tipoDocumento = Initializator.TipoDocumento(CmbTipo);
        }
 public void Init()
 {
     initializator = new Initializator(4);
     initializator.ExcludeTheOccupiedPoints(new Point(0, 1));
     initializator.ExcludeTheOccupiedPoints(new Point(9, 3));
     initializator.ExcludeTheOccupiedPoints(new Point(9, 1));
     initializator.ExcludeTheOccupiedPoints(new Point(9, 5));
     commandHandler = new CommandHandler(new ComputerPlayer(initializator.field, 4));
 }
        public void Initialize()
        {
            _logic = new ProfesionalLogic();

            _tipoDocumento = Initializator.TipoDocumento(CmbTipo);
            _especialidad  = Initializator.Especialidad(chkEspecialidades);

            CleanUI();
        }
        protected override void OnCreate()
        {
            base.OnCreate();

            Console.WriteLine("About to initialize SimpleImageButton");
            Initializator.Init();

            LoadApplication(new App());
        }
Exemple #5
0
        public GameInformation GetGameInformation(CommandtGame commandGame, int bet = 0)
        {
            var           StartGae = new StartGame();
            Initializator command  = _commandList.Find((commandSearch) => commandSearch.CommandGame == commandGame);

            if (commandGame == CommandtGame.Deal)
            {
                return(command.ResultInitializator(_player, _diller, bet));
            }
            return(command.ResultInitializator(_player, _diller));
        }
        public void Initialize()
        {
            _logic = new AfiliadoLogic();

            _estadoCivil   = Initializator.EstadoCivil(CmbEstadoCivil);
            _tipoDocumento = Initializator.TipoDocumento(CmbTipo);
            _planMedico    = Initializator.PlanMedico(CmbPlanMedico);

            CleanUI();
            CleanWorkflow();
        }
        private void TestServiceProvider()
        {
            string username = "******";
            string password = "******";
            IAuthenticationService authenticationService = serviceProvider.GetRequiredService <IAuthenticationService>();

            if (authenticationService.Login(username, password) == null)
            {
                bool registrationTest = authenticationService.Register(username, password, password);
                User newUser          = authenticationService.Login(username, password);
                newUser = Initializator.CreateNewUserWithAdminPrivilegesAtInitialization(newUser);
                Initializator.UpdateNewUserWithRole(newUser, serviceProvider.GetRequiredService <IRepository>());
            }
        }
Exemple #8
0
        public Linear(int input, int output, Random r, Initializator init = null)
        {
            if (init == null)
            {
                init = new GaussianRandom(0, 1, 1, r);
            }

            var w       = init.GenerateMatrix(input, output);
            var b       = init.GenerateMatrix(1, output);
            var weights = new Tensor(w, true);
            var bias    = new Tensor(b, true);

            parameters.Add(bias);
            parameters.Add(weights);
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Console.WriteLine("Я - узел!\n");

            Initializator ini      = new Initializator(args);
            string        filename = ini.txtName();

            // считываем файлы с диска
            EmployeeRepository er1 = null;

            try
            {
                er1 = new JsonWorker(filename).jsonRead();
            }
            catch
            {
                Console.WriteLine("Не удалось прочесть файл с диска!");
                Console.ReadKey();
                return;
            }

            // передаем данные серверу
            IMyWCF service = null;

            try
            {
                // подключаемся
                EndpointAddress         address = new EndpointAddress(new Uri("http://localhost:8080/"));
                BasicHttpBinding        binding = new BasicHttpBinding();
                ChannelFactory <IMyWCF> factory = new ChannelFactory <IMyWCF>(binding, address);
                service = factory.CreateChannel();

                // добавляем данные на сервер
                service.addEmployeeRepository(er1);

                // выводим подтверждение
                Console.WriteLine("Серверу были отправлены следующие данные от этого узла:\n");
                Console.WriteLine(er1.ToString());
                Console.ReadKey();
            }
            catch
            {
                Console.WriteLine("Не удалось подключиться к серверу!");
                Console.ReadKey();
                return;
            }
        }
 static MediatorConfig()
 {
     Initializator.Init();
     Mediator = Configurator.ServiceProvider.GetService <IMediator>();
 }
Exemple #11
0
        static void Main(string[] args)
        {
            Initializator init = new Initializator(args);

            Console.WriteLine(init.isMaven());
            Console.WriteLine(init.isWhite());
            Console.WriteLine(init.mavensPort());
            Console.WriteLine(init.nodesPort());
            Console.WriteLine(init.txtName());


            Task t1 = Task.Factory.StartNew(async() =>
            {
                UDPSenderReceiver udp1 = new UDPSenderReceiver();

                UdpReceiveResult res = await udp1.receiveBytesAsync(init.nodesPort());
                string str           = Encoding.UTF8.GetString(res.Buffer);
                Console.WriteLine(str);

                if (init.isMaven() == true)
                {
                    //UDP соединение с клиентом для отклика на Who is Maven?
                    Console.WriteLine("I am Maven!");
                    UDPSenderReceiver udp2 = new UDPSenderReceiver();
                    int mavensPort         = init.nodesPort();
                    byte[] bytesSended     = BitConverter.GetBytes(mavensPort);
                    await udp2.sendUnicastBytesAsync(bytesSended, 30000);

                    //Готовим данные, которые будут отправлены клиенту
                    string txtName = init.txtName();
                    int empNum     = getEmpNum(txtName);
                    EmployeeRepository empRepRes = new EmployeeRepository();
                    AvgSalary avgSal             = new AvgSalary(getEmpNum(txtName), getSalaryList(txtName));
                    float avgSalaryVal           = avgSal.getAvgSalary();
                    int avgSalaryNum             = 1;

                    //Заносим данные Maven'a
                    JsonWorker jsWorker       = new JsonWorker(txtName);
                    EmployeeRepository empRep = jsWorker.jsonRead();
                    empRepRes.employees.AddRange(empRep.employees);

                    //Получаем данные с узлов
                    int nodeNum = init.getNodeNumber();
                    Console.WriteLine();
                    Console.WriteLine("Received information:");
                    for (int i = 0; i < nodeNum; i++)
                    {
                        TCPServer connectorToNode = new TCPServer(IPAddress.Parse("127.0.0.1"), mavensPort + i + 1);
                        byte[] receivedBytes      = connectorToNode.TCPReceive();
                        BinaryWorker bw           = new BinaryWorker();
                        Message msg   = bw.bytesToMessage(receivedBytes);
                        avgSal        = msg.s;
                        avgSalaryVal += avgSal.getAvgSalary();
                        avgSalaryNum++;
                        empRep = msg.empRep;
                        empRepRes.employees.AddRange(empRep.employees);

                        Console.WriteLine(avgSal.getAvgSalary());
                        for (int j = 0; j < empRep.employees.Count(); j++)
                        {
                            Console.WriteLine(empRep.employees[j]);
                        }
                    }

                    //Обрабатываем информацию для отправки клиенту
                    AvgSalary avgSalary = new AvgSalary(avgSalaryNum, avgSalaryVal);
                    Calculator calc     = new Calculator(empRepRes);
                    List <EmployeeRepository> groupedList = calc.groupBy();
                    EmployeeRepository sortedList         = calc.sortBy();
                    EmployeeRepository filteredList       = calc.filterBy(avgSalary.getAvgSalary());

                    //Готовим данные для отправки
                    MessageCalc msgCalc    = new MessageCalc(sortedList, filteredList, groupedList);
                    BinaryWorker bwForCalc = new BinaryWorker();
                    byte[] bytesForClient  = bwForCalc.messageCalcToBytes(msgCalc);

                    //Отправляем клиенту
                    TCPClient connectorToClient = new TCPClient(IPAddress.Parse("127.0.0.1"), 30000);
                    connectorToClient.TCPSend(bytesForClient);
                }

                else if (init.isWhite() == true)
                {
                    string jsName   = init.txtName();
                    float salarySum = getSalaryList(jsName);
                    int empNum      = getEmpNum(jsName);

                    //Считываем данные с xml
                    //XMLWorker xmlWorker = new XMLWorker(xmlName);
                    //EmployeeRepository empRep = xmlWorker.readXML();

                    //Считываем данные с JSON
                    JsonWorker jsWorker       = new JsonWorker(jsName);
                    EmployeeRepository empRep = jsWorker.jsonRead();

                    //Готовим данные для отправки Maven'у
                    Message msg        = new Message(new AvgSalary(empNum, salarySum), empRep);
                    BinaryWorker bw    = new BinaryWorker();
                    byte[] bytesToSend = bw.messageToBytes(msg);

                    //Отправляем
                    TCPClient senderToMaven = new TCPClient(IPAddress.Parse("127.0.0.1"), init.nodesPort());
                    senderToMaven.TCPSend(bytesToSend);
                }

                else if (init.isWhite() == false)
                {
                    string jsName   = init.txtName();
                    float salarySum = getSalaryList(jsName);
                    int empNum      = getEmpNum(jsName);

                    //Готовим данные для отправки
                    Message msg     = new Message(new AvgSalary(empNum, salarySum), new EmployeeRepository());
                    BinaryWorker bw = new BinaryWorker();
                    byte[] bytes    = bw.messageToBytes(msg);

                    //Отправляем
                    TCPClient senderToMaven = new TCPClient(IPAddress.Parse("127.0.0.1"), init.nodesPort());
                    senderToMaven.TCPSend(bytes);
                }
            });

            t1.Wait();


            Console.ReadLine();
        }
Exemple #12
0
 //загружает словарь
 public void StartManager()
 {
     initializer = GetComponent <Initializator>();
     CreateGameModeInstanties();
 }