Esempio n. 1
0
        private void UpdateVillageType(Village vill, CellCollection cells, int column)
        {
            var acc  = GetSelectedAcc();
            var type = (VillType)Enum.Parse(typeof(VillType), cells[column].Text);

            if (type == vill.Settings.Type)
            {
                return;
            }
            vill.Settings.Type = type;

            if (acc.Wb == null)
            {
                return;
            }
            //User just selected different Village Type
            switch (type)
            {
            case VillType.Farm:
                DefaultConfigurations.FarmVillagePlan(acc, vill);
                return;

            case VillType.Support:
                DefaultConfigurations.SupplyVillagePlan(acc, vill);
                return;

            case VillType.Deff:
                DefaultConfigurations.DeffVillagePlan(acc, vill);
                return;

            case VillType.Off:
                DefaultConfigurations.OffVillagePlan(acc, vill);
                return;
            }
        }
Esempio n. 2
0
        private void button6_Click(object sender, EventArgs e) //deff vill button
        {
            var acc  = GetSelectedAcc();
            var vill = GetSelectedVillage();

            DefaultConfigurations.DeffVillagePlan(acc, vill);
            BuildingHelper.RemoveCompletedTasks(vill, acc);
            UpdateUc();
        }
Esempio n. 3
0
        private void button20_Click(object sender, EventArgs e) //support vill button
        {
            var acc  = getSelectedAcc();
            var vill = getSelectedVillage();

            DefaultConfigurations.SupplyVillagePlan(acc, vill);
            BuildingHelper.RemoveCompletedTasks(vill, acc);
            UpdateBuildTab();
        }
Esempio n. 4
0
        private void button4_Click(object sender, EventArgs e) //all villages off tasks
        {
            var acc = getSelectedAcc();

            foreach (var vill in acc.Villages)
            {
                DefaultConfigurations.OffVillagePlan(acc, vill);
                BuildingHelper.RemoveCompletedTasks(vill, acc);
            }
        }
        private static void PersistDefaultApiScopes(this IServiceProvider provider)
        {
            var context = provider.GetRequiredService <ConfigurationDbContext>();

            if (!context.ApiScopes.Any())
            {
                foreach (var apiScope in DefaultConfigurations.GetApiScopes())
                {
                    context.ApiScopes.Add(apiScope.ToEntity());
                }
                context.SaveChanges();
            }
        }
        private static void PersistDefaultIdentityResources(this IServiceProvider provider)
        {
            var context = provider.GetRequiredService <ConfigurationDbContext>();

            if (!context.IdentityResources.Any())
            {
                foreach (var resource in DefaultConfigurations.GetIdentityResources())
                {
                    context.IdentityResources.Add(resource.ToEntity());
                }
                context.SaveChanges();
            }
        }
        private static void PersistDefaultIdentityUser(this IServiceProvider provider)
        {
            var context    = provider.GetRequiredService <ApplicationDbContext>();
            var userManger = provider.GetRequiredService <UserManager <IdentityUser> >();

            if (!context.Users.Any())
            {
                var user          = new IdentityUser("admin");
                var defaultClaims = DefaultConfigurations.GetPrimaryClaims();
                user.Email = defaultClaims.FirstOrDefault(x => x.Type == JwtClaimTypes.Email)?.Value;

                userManger.CreateAsync(user).GetAwaiter().GetResult();
                userManger.AddClaimsAsync(user, defaultClaims).GetAwaiter().GetResult();
                userManger.AddPasswordAsync(user, "password").GetAwaiter().GetResult();
            }
        }
Esempio n. 8
0
        protected void SetDefaultEmulatorSettings()
        {
            EmulatorConfiguration defaultConfiguration;

            if (!DefaultConfigurations.TryMatch(PathBrowser.ChoosenResourcePathDisplayName, out defaultConfiguration))
            {
                Name = DosPathHelper.GetFileNameWithoutExtension(PathBrowser.ChoosenResourcePathDisplayName);
                return;
            }
            Name                   = defaultConfiguration.Name;
            Arguments              = defaultConfiguration.Arguments;
            WorkingDirectory       = defaultConfiguration.WorkingDirectory;
            UseQuotes              = defaultConfiguration.UseQuotes;
            ExitsOnEscapeKey       = defaultConfiguration.ExitsOnEscapeKey;
            FileExtensions         = new HashSet <string>(defaultConfiguration.FileExtensions);
            SelectedGameCategories = new List <string>(defaultConfiguration.Platforms);
            UpdateIsGameCategoriesSelected();
        }
Esempio n. 9
0
        private static void Main(string[] args)
        {
            // Quick and dirty example of generating graph images for debugging
            // This assumes you have Graphviz 2.28 installed

            var meter_to_feet = new ConversionGraph();

            var meter = new Unit("meter");
            var feet  = new Unit("foot");

            meter_to_feet.AddConversion(Conversions.One(meter).In(feet).Is(3.28084M));

            meter_to_feet.ToDotFile("meter_feet.dot", VisualizationOptions.None);

            Process.Start(@"C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe", "-Tpng meter_feet.dot -o meter_feet.png");

            var more_complex = new ConversionGraph();

            var kilometer = new Unit("kilometer");
            var inches    = new Unit("inch");

            more_complex.AddConversion(
                Conversions.From(kilometer).To(meter).MultiplyBy(1000M),
                Conversions.From(meter).To(feet).MultiplyBy(3.28084M),
                Conversions.From(feet).To(inches).MultiplyBy(12M)
                );

            more_complex.ToDotFile("more_complex.dot", VisualizationOptions.NumberEdges);

            Process.Start(@"C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe",
                          "-Tpng more_complex.dot -o more_complex.png");

            DefaultConfigurations.Length().ToDotFile("length.dot", VisualizationOptions.NumberEdges | VisualizationOptions.ShowSystem);

            Process.Start(@"C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe",
                          "-Tpng length.dot -o length.png");
        }
Esempio n. 10
0
 private void FrmLogin_Load(object sender, EventArgs e)
 {
     txtUsername.Text = "admin";
     txtPassword.Text = "admin";
     DefaultConfigurations.Starter();
 }