static void Main(string[] args) { Creation.StartingObjects(); Menu.StartGame(); Console.ReadLine(); }
public DbContextCreator ThatHasOutboxMessage(OutboxMessage message) { Creation.Add(message); Creation.SaveChanges(); return(this); }
private async Task AddCreation() { try { var result = await _dialogService.ShowInputDialogAsync("Creation", "Enter a creation name", null, "Creation name", "Create", "Cancel", _disappearingTokenSource.Token); if (result.IsOk) { if (string.IsNullOrWhiteSpace(result.Result)) { await _dialogService.ShowMessageBoxAsync("Warning", "Creation name can not be empty.", "Ok", _disappearingTokenSource.Token); return; } Creation creation = null; await _dialogService.ShowProgressDialogAsync( false, async (progressDialog, token) => { creation = await _creationManager.AddCreationAsync(result.Result); await _creationManager.AddControllerProfileAsync(creation, "Default profile"); }, "Creating..."); await NavigationService.NavigateToAsync <CreationPageViewModel>(new NavigationParameters(("creation", creation))); } } catch (OperationCanceledException) { } }
public override string Xml(EtpVersion version, string indentation = "", bool embedded = false) => $@"{indentation}<ChannelSet{Namespaces(embedded)} schemaVersion=""2.0"" uuid=""{Uuid}""{DefaultNamespace(embedded)}> {indentation} <Citation xmlns=""http://www.energistics.org/energyml/data/commonv2""> {indentation} <Title>{Title}</Title> {indentation} <Originator>ETP DevKit</Originator> {indentation} <Creation>{Creation.ToUniversalTime():O}</Creation> {indentation} <Format>Energistics:ETP DevKit {typeof(IEtpSession).Assembly.GetName().Version}</Format> {indentation} <LastUpdate>{LastUpdate.ToUniversalTime():O}</LastUpdate> {indentation} </Citation> {indentation} <Index> {indentation} <IndexType>{(IsTime ? "date time" : "measured depth")}</IndexType> {indentation} <Uom>{(IsTime ? "s" : "m")}</Uom> {indentation} <Direction>increasing</Direction> {indentation} <Mnemonic>{(IsTime ? "Time" : "Depth")}</Mnemonic> {indentation} </Index> {string.Concat(Channels.Select(c => c.Xml(version, indentation = " ", embedded = true)))} {indentation} <TimeDepth>{(IsTime ? "time" : "depth")}</TimeDepth> {indentation} <StartIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}""> {indentation} <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeStartIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthStartIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}> {indentation} </StartIndex> {indentation} <EndIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}""> {indentation} <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeEndIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthEndIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}> {indentation} </EndIndex> {indentation} <LoggingCompanyName>ETP DevKit</LoggingCompanyName> {indentation} <Wellbore> {indentation} <ContentType xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.ContentType}</ContentType> {indentation} <Title xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Title}</Title> {indentation} <Uuid xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uuid}</Uuid> {indentation} <Uri xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uri(version)}</Uri> {indentation} </Wellbore> {indentation}</ChannelSet>";
private void AttackPlayer(Creation attacker, Creation defender) { var actionSubject = attacker.NextActionSubject; var defenderBonus = defender.NextAction == Action.Defend && defender.NextActionSubject == actionSubject ? 1 : 0; var attackerBonus = 1; if (actionSubject == ActionSubject.Dexterity) { if (attacker.Dexterity + attackerBonus > defender.Dexterity + defenderBonus) { defender.Health--; attacker.ExpPoints++; } else { defender.ExpPoints++; } } else if (actionSubject == ActionSubject.Strength) { if (attacker.Strength + attackerBonus > defender.Strength + defenderBonus) { defender.Health--; attacker.ExpPoints++; } else { defender.ExpPoints++; } } }
void AttachItem(int itemID) { Body body = UToolS.SelectBody(); if (body != null) { var partlist = Creation.ReadShipObject(body.gameObject); OpShip.OSIDE seldir; var selpart = OpShip.GetInsertParent(partlist, itemID, out seldir); TablePart newpart = OpShip.NewInsertItem(selpart, seldir, itemID); Item item = Creation.MakeItemObject(newpart, body.transform); item.renderer.material = MainRenderer.GetMeterial(item.gameObject, body.tone); if (newpart.posx != 0) { TablePart newpair = newpart; newpair.posx = -newpart.posx; newpair.flip = (byte)(newpart.flip == 1 ? 0 : 1); if (newpart.angle == 90 || newpart.angle == -90 || newpart.angle == 270) { newpair.angle = IMath.GetCenterDegree(newpart.angle + 180); } Item itemPair = Creation.MakeItemObject(newpair, body.transform); itemPair.renderer.material = MainRenderer.GetMeterial(itemPair.gameObject, body.tone); } Creation.DepthSort(body.transform); } }
public ActionResult <Creation> CreateCreation(Creation incomingData) { if (ModelState.IsValid) { Creation newCreation = new Creation(); newCreation.CreationEventId = incomingData.CreationEventId; newCreation.CreationCreatorId = incomingData.CreationCreatorId; newCreation.CreationCreatorFirstName = _context.Users.Where(x => x.UserId == incomingData.CreationCreatorId).FirstOrDefault().UserFirstName; newCreation.CreationCreatorLastName = _context.Users.Where(x => x.UserId == incomingData.CreationCreatorId).FirstOrDefault().UserLastName; newCreation.CreationDescription = incomingData.CreationDescription; newCreation.CreationImagePath = incomingData.CreationImagePath; newCreation.CreationIsPublic = incomingData.CreationIsPublic; newCreation.CreationNumFavorites = 0; newCreation.CreationTitle = incomingData.CreationTitle; newCreation.CreationRating = 0; _context.Add(newCreation); _context.SaveChanges(); return(Ok(newCreation)); } else { return(BadRequest(ModelState)); } }
public static void NewGame() { Trainer trainer = new Trainer(); int index = 1; Console.Write("Please enter your nickname: "); trainer.Nickname = Console.ReadLine(); Console.WriteLine($"Hi {trainer.Nickname}!"); Console.WriteLine("Please select your first Pokemon from Professor Oak.\n"); List <Pokemon> initialPokemons = Creation.StartingPokemons(); foreach (var item in initialPokemons) { Console.WriteLine($"{index}. {item.name.english}"); index++; } Console.WriteLine("Select a Pokemon: "); Console.Write("->"); choice = Convert.ToInt32(Console.ReadLine()); Pokemon initialPokemon = initialPokemons[choice - 1]; trainer.Pokemons.Add(initialPokemon); Console.WriteLine($"Okay! {trainer.Pokemons[0].name.english} is your first Pokémon!\n"); MainActions(trainer); }
public void Cull(SpawnableObject o, int amount) { if (o.isWater) { return; } //Debug.Log(amount.ToString("0 ") + o.name + " to cull"); //Debug.Log(GameCore.CreationLookup[o.name].Count); if (GameCore.CreationLookup[o.name].Count > amount) { for (int i = 0; i < amount; i++) { int randomIndex = Random.Range(0, GameCore.CreationLookup[o.name].Count); Creation c = GameCore.CreationLookup[o.name][randomIndex]; //Debug.Log(c.name); Destroy(c.gameObject); GameCore.CreationLookup[o.name].RemoveAt(randomIndex); } } else { for (int i = 0; i < GameCore.CreationLookup[o.name].Count; i++) { Creation c = GameCore.CreationLookup[o.name][i]; Destroy(c.gameObject); } GameCore.CreationLookup[o.name] = new List <Creation>(); } uiController.UpdatePopulationDetails(); }
/// <summary> /// Render a box /// </summary> /// <param name="box">box to render</param> public void RenderControl(UXBox box) { UXTable t = new UXTable(); UXCell c = new UXCell(); foreach (IUXObject ux in box.Children) { c.Add(ux); } Marshalling.MarshallingHash hash = Marshalling.MarshallingHash.CreateMarshalling("content", () => { return(new Dictionary <string, dynamic>() { { "ColumnCount", 1 }, { "LineCount", 1 }, { "children", ChildCollection.CreateChildCollection("row", () => { return new List <IUXObject>() { Creation.CreateRow(1, null, c) }; }) } }); }); t.Bind(hash); RenderControl(t); }
private async Task PlayAsync() { string warning = null; var deviceIds = Creation.GetDeviceIds(); if (deviceIds == null || deviceIds.Count() == 0) { warning = Translate("NoControllerActions"); } else if (deviceIds.Any(di => _deviceManager.GetDeviceById(di) == null)) { warning = Translate("MissingDevices"); } if (warning == null) { await NavigationService.NavigateToAsync <PlayerPageViewModel>(new NavigationParameters(("creation", Creation))); } else { await _dialogService.ShowMessageBoxAsync( Translate("Warning"), warning, Translate("Ok"), _disappearingTokenSource.Token); } }
public void UseSelectedSpawnable(RaycastHit hit) { if (SpawnerLoader.loadProgress == 1f) { if (!selectedSpawn.isWater) { Vector3 spawnPoint = hit.point; Quaternion startRotation = Quaternion.LookRotation(hit.normal); GameObject newGo = Instantiate(selectedSpawn.Prefabs[Random.Range(0, selectedSpawn.Prefabs.Length)], spawnPoint, startRotation, hit.transform); Creation newCreation = newGo.AddComponent <Creation>(); newCreation.spawnableObject = selectedSpawn; Debug.Log(GameCore.CreationLookup.Count); ecosystem.Populate(newCreation); } // Water is a special case, should change how it is used if there's time. else { gameCore.IncreaseWater(selectedSpawn.SpawnAmount); } gameCore.UseEnergy(selectedSpawn.EnergyConsumption); uiController.UpdatePopulationDetails(); } }
/// <summary> /// Raises the collision enter event; triggers the action. /// </summary> /// <param name='collision'> /// Collision. /// </param> protected virtual void Collide(GameObject other) { if (!enabled || other.transform.root == gameObject.transform.root) { return; } GameObject obj = gameObject; bool isCreator = false; if (excludeCreator) { Creation creation = GetComponent <Creation>(); if (creation != null) { isCreator = creation.creator == other; } } if (!isCreator && (!requireOppositeTeam || Team.IsDifferentTeam(Team.GetTeam(gameObject), Team.GetTeam(other))) && (string.IsNullOrEmpty(requiredTag) || other.CompareTag(requiredTag))) { if (onOther) { obj = other; } foreach (BaseAction action in actions) { action.CheckRun(obj); } } }
private static byte[] Create(KeyProviderQueryContext ctx) { IOConnectionInfo iocPrev = GetAuxFileIoc(ctx); Info Info = Info.Load(iocPrev); if (Info == null) { Info = new Info(); } CreateFingerPrint cfp = new CreateFingerPrint(); UIUtil.ShowDialogAndDestroy(cfp); if (cfp.Access() != true) { return(null); } Creation dlge = new Creation(); dlge.InitEx(Info, ctx); UIUtil.ShowDialogAndDestroy(dlge); if (!CreateAuxFile(Info, ctx)) { return(null); } SampleKeyProvider sm = new SampleKeyProvider(); return(Info.Secret); //return Encoding.UTF8.GetBytes(sm.DeCode(Info.Secret.ToString())); }
static void Main(string[] args) { Engine E1 = new Engine(200, "chev", 1, true); FuelStorage F1 = new FuelStorage(20, 11.5, true); Wheel W1 = new Wheel(1, "Left back", true); Wheel W2 = new Wheel(1, "Left front", true); Wheel W3 = new Wheel(1, "Right front", false); Wheel W4 = new Wheel(1, "Right back", true); Wheels Car1 = new Wheels(); Car1.Add(W1); Car1.Add(W2); Car1.Add(W3); Car1.Add(W4); Car1.WheelsStatus(); E1.Start(F1); Creation C1 = new Creation("Chevrolet", "USA", 2001, 7); Machine M1 = new Machine(E1, F1, Car1, C1); M1.starting(E1, F1, Car1); Engine E2 = new Engine(500, "bwm", 1, true); FuelStorage F2 = new FuelStorage(25, 0, true); Wheel W5 = new Wheel(1, "Left back", true); Wheel W6 = new Wheel(1, "Left front", true); Wheel W7 = new Wheel(1, "Right front", true); Wheel W8 = new Wheel(1, "Right back", true); Wheels Car2 = new Wheels(); Car2.Add(W5); Car2.Add(W6); Car2.Add(W7); Car2.Add(W8); Car2.WheelsStatus(); E2.Start(F2); Creation C2 = new Creation("BMW", "USA", 2008, 12); Machine M2 = new Machine(E2, F2, Car2, C2); M2.starting(E2, F2, Car2); Engine E3 = new Engine(350, "mustang", 1, false); FuelStorage F3 = new FuelStorage(15, 5, true); Wheel W9 = new Wheel(1, "Left back", true); Wheel W10 = new Wheel(1, "Left front", true); Wheel W11 = new Wheel(1, "Right front", true); Wheel W12 = new Wheel(1, "Right back", true); Wheels Car3 = new Wheels(); Car3.Add(W9); Car3.Add(W10); Car3.Add(W11); Car3.Add(W12); Car3.WheelsStatus(); E3.Start(F3); Creation C3 = new Creation("Mustang", "USA", 1998, 4); Machine M3 = new Machine(E3, F3, Car3, C3); M3.starting(E3, F3, Car3); }
public IActionResult DeleteCreation(int id) { Creation creation = _context.Creations.Where(x => x.CreationId == id).FirstOrDefault(); _context.Creations.Remove(creation); _context.SaveChanges(); return(Ok()); }
/// <summary> /// Returns true if Name instances are equal /// </summary> /// <param name="other">Instance of Name to be compared</param> /// <returns>Boolean</returns> public bool Equals(Name other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( Alias == other.Alias || Alias != null && Alias.Equals(other.Alias) ) && ( First == other.First || First != null && First.Equals(other.First) ) && ( Family == other.Family || Family != null && Family.Equals(other.Family) ) && ( Given == other.Given || Given != null && Given.SequenceEqual(other.Given) ) && ( Prefix == other.Prefix || Prefix != null && Prefix.SequenceEqual(other.Prefix) ) && ( Suffix == other.Suffix || Suffix != null && Suffix.SequenceEqual(other.Suffix) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Uuid != null) { hashCode = hashCode * 59 + Uuid.GetHashCode(); } if (Active != null) { hashCode = hashCode * 59 + Active.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Gender != null) { hashCode = hashCode * 59 + Gender.GetHashCode(); } if (BirthDate != null) { hashCode = hashCode * 59 + BirthDate.GetHashCode(); } if (Address != null) { hashCode = hashCode * 59 + Address.GetHashCode(); } if (Qualification != null) { hashCode = hashCode * 59 + Qualification.GetHashCode(); } if (Telecom != null) { hashCode = hashCode * 59 + Telecom.GetHashCode(); } if (Photo != null) { hashCode = hashCode * 59 + Photo.GetHashCode(); } if (Cost != null) { hashCode = hashCode * 59 + Cost.GetHashCode(); } if (Creation != null) { hashCode = hashCode * 59 + Creation.GetHashCode(); } if (LastUpdated != null) { hashCode = hashCode * 59 + LastUpdated.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Uuid != null) { hashCode = hashCode * 59 + Uuid.GetHashCode(); } if (Use != null) { hashCode = hashCode * 59 + Use.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Line != null) { hashCode = hashCode * 59 + Line.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (District != null) { hashCode = hashCode * 59 + District.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (Country != null) { hashCode = hashCode * 59 + Country.GetHashCode(); } if (PostalCode != null) { hashCode = hashCode * 59 + PostalCode.GetHashCode(); } if (Period != null) { hashCode = hashCode * 59 + Period.GetHashCode(); } if (Creation != null) { hashCode = hashCode * 59 + Creation.GetHashCode(); } if (LastUpdated != null) { hashCode = hashCode * 59 + LastUpdated.GetHashCode(); } return(hashCode); } }
public Region(string region, string country, Creation regionType) { Country = country; PreferredName = region; AlternativeNames = new List <string>(); ISOcode = string.Empty; RegionType = regionType; CountyCodes = null; }
public Creation Create() { buildingObject = new Creation(); SetIsValue(); SetNumber(); SetName(); return(buildingObject); }
void Start() { _instance = GetComponent <Creation>(); if (_instance == null) { Debug.LogError("Error - AI didn't find creation instance"); } _playersCount = _gameState.Players.ToList().Count; }
public override string Xml(EtpVersion version, string indentation = "", bool embedded = false) => $@"{indentation}<Well{Namespaces(embedded)} schemaVersion=""2.0"" uuid=""{Uuid}""{DefaultNamespace(embedded)}> {indentation} <Citation xmlns=""http://www.energistics.org/energyml/data/commonv2""> {indentation} <Title>{Title}</Title> {indentation} <Originator>ETP DevKit</Originator> {indentation} <Creation>{Creation.ToUniversalTime():O}</Creation> {indentation} <Format>Energistics:ETP DevKit {typeof(IEtpSession).Assembly.GetName().Version}</Format> {indentation} <LastUpdate>{LastUpdate.ToUniversalTime():O}</LastUpdate> {indentation} </Citation> {indentation}</Well>";
public SendMailRequest GetSendMailRequest(Creation creation) { var request = new SendMailRequest() { Creation = creation, ActionType = Requests.ActionType.Update }; return(request); }
public AnswerStatusRequest GetUpdateAnswerStatusRequest(Creation creation) { var request = new AnswerStatusRequest() { Creation = creation, ActionType = Requests.ActionType.Update }; return(request); }
public UpdatePaymentStatusRequest GetUpdatePaymentStatusRequest(Creation creation) { var request = new UpdatePaymentStatusRequest() { Creation = creation, ActionType = Requests.ActionType.Update }; return(request); }
public override int GetHashCode() { var hashCode = 1636230790; hashCode *= -1521134295 + Creation.GetHashCode(); hashCode *= -1521134295 + LastModified.GetHashCode(); hashCode *= -1521134295 + EqualityComparer <string> .Default.GetHashCode(Sha256sum); return(hashCode); }
public AddCreationRequest GetAddCreationRequest(Creation creation) { var request = new AddCreationRequest() { Creation = creation, ActionType = Requests.ActionType.Insert }; return(request); }
public void CreateClassesAndIds() { for (int row = 0; row < Creation.GetLength(0); row++) { for (int col = 0; col < Creation.Length / Creation.GetLength(0); col++) { CreationIds[row, col] = GetCellIds(row, col); } } }
/// <summary> /// Deletes the original instance of the creation from the database and saves the new, edited version /// </summary> /// <param name="newName">new name of the creation entered by the user</param> /// <param name="newDescripiton">new description of the creation entered by the user</param> public void SaveNewVersionOfCreation(string newName, string newDescripiton) { Dictionary <string, string> newGeneration = new Dictionary <string, string>(); newGeneration.Add("name", newName); newGeneration.Add("description", newDescripiton); Creation currentCreation = new Creation(newName, selectedCreation.Type, newGeneration); Save.Instance.deleteCreation(selectedCreation); Save.Instance.Creation(currentCreation); }
public void ExecuteStep(int stepType) { Base global = Base.GetInstance(); Show show = new Show(global); Tools tools = new Tools(); global.Verschnittoptimierung.Output.Text = ""; // for testing only if (global.Verschnittoptimierung.comboBox1.Text.Equals("Create Board(s) + Objects")) { } // reset displayed values if (global.runningProcess.existing == false) { global.Verschnittoptimierung.cl_evolutionMue.Text = ""; global.Verschnittoptimierung.cl_evolutionLambda.Text = ""; } switch (global.Verschnittoptimierung.comboBox1.Text) { // old, not existing anymore. Objects+board created when creating benchmark, including an empty solution case "Create Board(s) + Objects": // get board values from user interface float generalBoardHeight = (float)(global.Verschnittoptimierung.boardHeight.Value); float generalBoardWidth = (float)(global.Verschnittoptimierung.boardWidth.Value); if(generalBoardHeight >= generalBoardWidth) { float h = generalBoardWidth; generalBoardWidth = generalBoardHeight; generalBoardHeight = h; } // set global board values in Base/global global.generalBoardHeight = generalBoardHeight; global.generalBoardWidth = generalBoardWidth; CalculateMult(); // global.boardGap = Convert.ToInt32(0.1 * global.generalBoardHeight); // create and draw board(s) Creation creation = new Creation(); creation.CreateBoards(); DrawBoards(); break; case "Create Benchmark": // 1. step: verify benchmark information if(global.Verschnittoptimierung.boardHeight.Value <= global.Verschnittoptimierung.boardWidth.Value && global.Verschnittoptimierung.objectsMinNumber.Value <= global.Verschnittoptimierung.objectsMaxNumber.Value) { // before creating benchmark clear the screen // clear screen global.Verschnittoptimierung.display.Invalidate(); global.bestSolution = null; global.Verschnittoptimierung.button_useBestSolution.Enabled = false; // create benchmark Benchmark benchmark = new Benchmark(); //benchmark.BoardList = new List<Board>(); BenchmarkManagement benchmarkManagement = new BenchmarkManagement(); benchmarkManagement.CreateBenchmark(global, benchmark); benchmarkManagement.CreateRects(Convert.ToInt32(global.Verschnittoptimierung.objectsMinNumber.Value) , Convert.ToInt32(global.Verschnittoptimierung.objectsMaxNumber.Value), benchmark); global.benchmark = benchmark; // info: benchmark (boards with rects that fit exactly) created // also create a basic solution SolutionManagement solutionManagement = new SolutionManagement(); solutionManagement.CreateBasicSolution(global, global.benchmark); show.ShowBenchmark(global.benchmark); } else { // not enough information entered or too much information entered System.Windows.Forms.MessageBox.Show("Not enough information specified or wrong information. Check the min, max fields."); /* FolderBrowserDialog fbd = new FolderBrowserDialog(); DialogResult result = fbd.ShowDialog(); string[] files = Directory.GetFiles(fbd.SelectedPath); System.Windows.Forms.MessageBox.Show("Files found: " + files.Length.ToString(), "Message"); */ } break; case "Fill": // lock fill radio buttons tools.LockFillButtons(); // get type from what was entered int type = 0; // check if no process exists, create one if(global.runningProcess.existing == false) { global.runningProcess.type = 0; global.runningProcess.existing = true; global.runningProcess.state = 0; // 0 = single step, 1 = all remaining steps global.runningProcess.stepType = stepType; global.runningProcess.firstStep = true; /* // background worker global.Verschnittoptimierung.backgroundWorker1.RunWorkerAsync(); */ } // if a process exists, but of another process type else if(global.runningProcess.existing == true && global.runningProcess.type != type) { global.Verschnittoptimierung.Output.Text = "Another process is already running. Please complete this process first."; break; } // if a process exists of the same type else if(global.runningProcess.existing == true && global.runningProcess.type == type) { // check if the process is running or waiting // if waiting, do another step or all steps if(global.runningProcess.state == 0) { // set params and reactivate process // single step or all steps global.runningProcess.stepType = stepType; /* // process makes the next step or all remaining steps, depending on stepType global.runningProcess.autoResetEvent.Set(); */ } // if running else if(global.runningProcess.state == 1) { global.Verschnittoptimierung.Output.Text = "The process is already running. Please wait."; break; } } // check if a valid solution + benchmark exist if(global.solution != null && global.benchmark != null && global.solution.benchmark != null && global.solution.BoardList != null && global.solution.BoardList.Count > 1) { show.ShowSolution(global.solution); int selection = 1; // greedy 1 if(selection == 1) { Fill fill = new Fill(); if(global.Verschnittoptimierung.radioButton_BestFit.Checked) { fill.Greedy(false, new Solution()); } if(global.Verschnittoptimierung.radioButton_FirstFit.Checked) { global.Verschnittoptimierung.Output.Text = "@info: \"First Fit\" not implemented"; global.runningProcess.existing = false; } } } else { global.Verschnittoptimierung.Output.Text = "At least one global element is null. Cannot fill."; tools.UnlockFillButtons(); } // unlock fill radio buttons if(global.runningProcess.existing == false) { tools.UnlockFillButtons(); } break; case "Evolutionary Algorithm": // lock EvAlg entry tools.LockEvAlgButtons(); // set entered evAlg values global.mue = Convert.ToInt32(global.Verschnittoptimierung.evAlg_mue.Value); global.multForLambda = Convert.ToInt32(global.Verschnittoptimierung.evAlg_mult.Value); global.lambda = global.mue * global.multForLambda; global.mutationRate = (float)global.Verschnittoptimierung.evAlg_mutationRate.Value; tools.SaveSelectedGreedies(); global.tournamentPopulation = global.Verschnittoptimierung.checkBox_greedyTournamentPopulation.Checked; global.tournamentGreediesOnly = global.Verschnittoptimierung.checkBox_greedyTournamentProceduresOnly.Checked; // 1. verification // check if a valid solution + benchmark exist if (global.solution != null && global.benchmark != null && global.solution.benchmark != null && global.solution.BoardList != null && global.solution.BoardList.Count > 1) { // check if 'emptySolution' exists (the unchanged basic solution) if (global.emptySolution == null) { global.Verschnittoptimierung.Output.Text = "global.emptySolution is null"; break; } // check parameters entered at evolutionary algorithm int numberGreedies = tools.GetNumberSelectedGreedies(); if ((!(numberGreedies > 2) || (numberGreedies < global.mue) || numberGreedies < global.multForLambda) && !(global.tournamentPopulation && global.tournamentGreediesOnly)) { global.Verschnittoptimierung.Output.Text = "You need to select more greedy procedures."; tools.UnlockEvAlgButtons(); break; } if (global.mutationRate > (global.emptySolution.BoardList.Count - 1)) { global.Verschnittoptimierung.Output.Text = "The mutation rate cannot be larger than the number of boards."; tools.UnlockEvAlgButtons(); break; } // check if no process exists, create one if (global.runningProcess.existing == false) { global.runningProcess.type = 1; global.runningProcess.existing = true; global.runningProcess.state = 0; // 0 = single step, 1 = all remaining steps global.runningProcess.stepType = stepType; global.runningProcess.firstStep = true; // set display values global.Verschnittoptimierung.cl_evolutionMue.Text = global.mue.ToString(); global.Verschnittoptimierung.cl_evolutionLambda.Text = global.lambda.ToString(); } // if a process exists, but of another process type else if (global.runningProcess.existing == true && global.runningProcess.type != 1) { global.Verschnittoptimierung.Output.Text = "Another process is already running. Please complete this process first."; break; } // if a process exists of the same type else if (global.runningProcess.existing == true && global.runningProcess.type == 1) { // check if the process is running or waiting // if waiting, do another step or all steps if (global.runningProcess.state == 0) { // set params and reactivate process // single step or all steps global.runningProcess.stepType = stepType; } // if running else if (global.runningProcess.state == 1) { global.Verschnittoptimierung.Output.Text = "The process is already running. Please wait."; break; } } // 2. execute EvolutionaryAlgorithm evolutionaryAlgorithm = new EvolutionaryAlgorithm(); evolutionaryAlgorithm.BombingAlgorithm(); } else { global.Verschnittoptimierung.Output.Text = "At least one global element is null. Cannot use EvAlg."; tools.UnlockEvAlgButtons(); } // unlock EvAlg entry if (global.runningProcess.existing == false) { tools.UnlockEvAlgButtons(); } break; default: break; } /* //global.Verschnittoptimierung.display.; using (Graphics g = global.Verschnittoptimierung.display.CreateGraphics()) { using (Pen pen = new Pen(Color.Black, 2)) { Brush brush = new SolidBrush(Color.DarkBlue); g.TranslateTransform(global.Verschnittoptimierung.display.AutoScrollPosition.X, global.Verschnittoptimierung.display.AutoScrollPosition.Y); g.DrawRectangle(pen, 100, 100, 100, 200); } } */ }