Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <AppDbContext>(options =>
                                                 options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddDefaultIdentity <IdentityUser>().AddEntityFrameworkStores <AppDbContext>();

            services.Configure <CookiePolicyOptions>(options =>
            {
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddFeatureManagement();

            services.AddScoped <ICandidateRepository, CandidateRepository>();
            services.AddScoped <ISpecialisationRepository, SpecialisationRepository>();
            services.AddScoped <IOfferRepository, OfferRepository>();
            services.AddScoped <SelectedTeam>(sp => SelectedTeam.GetTeam(sp));

            services.AddHttpContextAccessor();
            services.AddSession();

            services.AddLocalization(options => options.ResourcesPath = "Resources");

            services.AddControllersWithViews().AddViewLocalization();
            services.AddRazorPages();
        }
Пример #2
0
        private async void GoToDetailsPage()
        {
            if (SelectedTeam.AreEmpty())
            {
                return;
            }
            else
            {
                var SelectedItemJson = JsonConvert.SerializeObject(SelectedTeam);
                var route            = $"{nameof(TeamDetailsPage)}?Team={SelectedItemJson}";
                await Shell.Current.GoToAsync(route);

                SelectedTeam = null;
            }
        }
 public SelectedTeamProfile(SelectedTeam selectedTeam)
 {
     _selectedTeam = selectedTeam;
 }
 public OfferController(IOfferRepository offerRepository, SelectedTeam selectedTeam)
 {
     _offerRepository = offerRepository;
     _selectedTeam    = selectedTeam;
 }
 public SelectedTeamController(SelectedTeam selectedTeam, ICandidateRepository candidateRepository)
 {
     _selectedTeam        = selectedTeam;
     _candidateRepository = candidateRepository;
 }
        /// <summary>
        /// recursive function that performs move for computer
        /// we try to write on random index and if it is taken
        /// function will be called again
        /// </summary>
        /// <param name="obj"></param>
        private void AutoInput(object obj)
        {
            int index  = rnd.Next(1, 10);
            var button = (obj as Button);

            if (!fields.ContainsKey(index))
            {
                string input;
                //we choose sign for computer ( it is oposite from player's sign)
                if (SelectedTeam.Equals("X"))
                {
                    input = "O";
                }
                else
                {
                    input = "X";
                }

                //we try to write on random index
                if (index == 1)
                {
                    Button0_0 = input;
                    fields.Add(1, input);
                    gameMoveCounter++;
                }
                else if (index == 2)
                {
                    Button0_1 = input;
                    fields.Add(2, input);
                    gameMoveCounter++;
                }
                else if (index == 3)
                {
                    Button0_2 = input;
                    fields.Add(3, input);
                    gameMoveCounter++;
                }
                else if (index == 4)
                {
                    Button1_0 = input;
                    fields.Add(4, input);
                    gameMoveCounter++;
                }
                else if (index == 5)
                {
                    Button1_1 = input;
                    fields.Add(5, input);
                    gameMoveCounter++;
                }
                else if (index == 6)
                {
                    Button1_2 = input;
                    fields.Add(6, input);
                    gameMoveCounter++;
                }
                else if (index == 7)
                {
                    Button2_0 = input;
                    fields.Add(7, input);
                    gameMoveCounter++;
                }
                else if (index == 8)
                {
                    Button2_1 = input;
                    fields.Add(8, input);
                    gameMoveCounter++;
                }
                else if (index == 9)
                {
                    Button2_2 = input;
                    fields.Add(9, input);
                    gameMoveCounter++;
                }
            }
            else
            {
                AutoInput(button);
            }
        }