public IHttpActionResult PutDrill(int id, Drill drill) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != drill.Id) { return(BadRequest()); } db.Entry(drill).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DrillExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
void Main() { var blocks = new List <IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType <IMyShipController>(blocks, NoPassenger); if (blocks.Count == 0) { throw new Exception("No ship controller (cockpit, etc.) available."); } controller = blocks[0] as IMyShipController; Drill drill = new Drill(controller); blocks = new List <IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType <IMyGyro>(blocks); drill.AddGyroskopes(blocks); blocks = new List <IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType <IMyThrust>(blocks); drill.AddThrusters(blocks); blocks = new List <IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType <IMySensorBlock>(blocks); drill.AddSensors(blocks); debug.Append(drill.GetBounds().Center).AppendLine(); Debug(debug.ToString()); debug.Clear(); }
// PUT api/Drills/5 public HttpResponseMessage PutDrill(int id, Drill drill) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } if (id != drill.Id) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } db.Entry(drill).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
private ActionResponse CanUserEditDrill(int drillId) { Drill wantedDrill = RepositoriesFactory.CreateRepository <DrillsRepository, Drill>() .Query().FirstOrDefault(currDrill => currDrill.DrillId == drillId); if (wantedDrill == null) { return(new ActionResponse() { ErrorMessage = "Wanted drill does not exists", CompletedSuccessfully = false }); } if (!(GetCurrentUser().Permission == (int)Enums.PermissionsType.Admin)) { if (wantedDrill.CreatorUserId != GetCurrentUser().UserId) { return(new ActionResponse() { ErrorMessage = "The given user does not have permissions to update the given drill", CompletedSuccessfully = false }); } } return(null); }
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { var response = actionExecutedContext.Response; var urlHelper = actionExecutedContext.ActionContext.ControllerContext.Url; Tag tag = null; Drill drill = null; HttpResourceList <Tag> tags = null; HttpResourceList <Drill> tagDrills = null; if (response.TryGetContentValue(out tag)) { BuildTagLinks(urlHelper, tag); } else if (response.TryGetContentValue(out drill)) { BuildDrillLinks(urlHelper, drill); } else if (response.TryGetContentValue(out tags)) { tags.SelfLink = urlHelper.ApiLink("tags").ToString(); tags.Items.ForEach(t => BuildTagLinks(urlHelper, t)); } else if (response.TryGetContentValue(out tagDrills)) { tagDrills.SelfLink = urlHelper.ApiLink(tagDrills.Items.First().Id, "tagdrills", "ChildApiRoute").ToString(); tagDrills.Links.Add(new Link { LinkName = "add-drill", Href = urlHelper.ApiLink("drills").ToString() }); tagDrills.Items.ForEach(d => BuildDrillLinks(urlHelper, d)); } }
public async Task<IActionResult> Edit(int id, [Bind("DrillId,Description,RoutineId,TechniqueId,Time")] Drill drill) { if (id != drill.DrillId) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(drill); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrillExists(drill.DrillId)) { return NotFound(); } else { throw; } } return RedirectToAction("Index"); } ViewData["RoutineId"] = new SelectList(_context.Set<Routine>(), "RoutineId", "RoutineId", drill.RoutineId); ViewData["TechniqueId"] = new SelectList(_context.Techniques, "TechniqueId", "TechniqueId", drill.TechniqueId); return View(drill); }
// Start is called before the first frame update void Start() { showMap = false; drill = drillObj.GetComponent <Drill>(); mapCamera = GameObject.FindGameObjectWithTag("MapCam"); }
public void displayDrillUpgradeInfo() { SoundController.me.PlaySound(SoundController.me.shopButtons); Drill drill = Master.me.drills[0]; string requiredOreNames = ""; string playerOreNames = ""; for (int i = 0; i < drill.requiredOre.Length; i++) { requiredOreNames += Master.me.getOreName(i) + ": " + drill.requiredOre[i] + "\n"; } for (int i = 0; i < Player.me.inventory.Length; i++) { playerOreNames += Master.me.getOreName(i) + ": " + Player.me.inventory[i] + "\n"; } upgradeInfo.SetText ("DRILL NAME: " + drill.name + "\nDRILL SPEED: " + drill.speed + "\n--------------" + "\nREQUIRED ORE: " + "\n--------------\n" + requiredOreNames + "\n\nINVENTORY : " + "\n--------------\n" + playerOreNames); selectedUpgrade = "drill"; }
/// <summary> /// Save the actual state of the game. /// </summary> /// <param name="drill">Drill that has to be saved.</param> /// <param name="minerals">List of minerals that are have to be saved.</param> public void SaveGame(Drill drill, List <Mineral> minerals) { Database.drill newDrill = new Database.drill() { drill_x = (int)this.gameModel.Drill.Location[0], drill_y = (int)this.gameModel.Drill.Location[1], drill_score = this.gameModel.TotalPoints, drill_fuel = this.gameModel.Drill.FuelTankLvl, drill_storage = this.gameModel.Drill.StorageLvl, drill_speed = this.gameModel.Drill.DrillLvl, }; this.AddNewDrill(newDrill); foreach (Mineral mineral in minerals) { Database.brick newBrick = new Database.brick() { brick_type = mineral.Type.ToString(), brick_x = (int)mineral.Location[0], brick_y = (int)mineral.Location[1], }; this.AddNewBrick(newBrick); conn newConn = new conn() { conn_brick_id = newBrick.brick_id, conn_drill_id = newDrill.drill_id, }; this.AddNewConnection(newConn); } }
public void buyDrill() { displayDrillUpgradeInfo(); Drill drill = Master.me.drills[0]; string missingText = ""; for (int i = 0; i < drill.requiredOre.Length - 1; i++) { if (Player.me.inventory[i] >= drill.requiredOre[i]) { continue; } else { missingText = "\nmissing 1 " + Master.me.getOreName(i); upgradeInfo.SetText(upgradeInfo.text + missingText); SoundController.me.PlaySound(SoundController.me.shopError); return; } } Debug.Log("cha ching!"); SoundController.me.PlaySound(SoundController.me.boughtItem); for (int i = 0; i < drill.requiredOre.Length - 1; i++) { Player.me.inventory[i] -= drill.requiredOre[i]; } Player.me.updateStats(); Master.me.drills.Remove(drill); displayDrillUpgradeInfo(); }
protected override async StrategyTask <bool> Run() { var vertices = plane.Vertices().Distinct().ToList(); var strategies = new IStrategy[bots.Length]; for (var i = 0; i < bots.Length; i++) { var bot = bots[i]; vertices.Sort(i, vertices.Count - i, Comparer <Vec> .Create((a, b) => a.MDistTo(bot.Position).CompareTo(b.MDistTo(bot.Position)))); var target = vertices[i] .GetNears() .Where(n => n.IsInCuboid(R) && !n.IsInRegion(plane)) .OrderBy(v => state.Matrix[v]) .First(); strategies[i] = new Drill(state, bot, target); } await WhenAll(strategies); // todo High if problems for (int i = 0; i < bots.Length; i++) { state.SetBotCommand(bots[i], new GFill(new NearDifference(vertices[i] - bots[i].Position), new FarDifference(plane.Opposite(vertices[i]) - vertices[i]))); } return(await WhenNextTurn()); }
public static IEnumerable <TrainingSession> GetInitSession() { var sessions = new List <TrainingSession>(); for (var i = 0; i < 100; i++) { var session = new TrainingSession() { Name = $"Test Session {i+1}", DateCreated = DateTime.UtcNow }; var drill = new Drill() { Description = "Defensive Skills", Name = "Defense", Duration = 20, DateCreated = DateTime.UtcNow }; session.AddDrill(drill); sessions.Add(session); } return(sessions); }
public async Task <IActionResult> Create([Bind("Id,DrillName,DrillDescription,PlayersRequired,DateCreated,UserId,CategoryId")] Drill drill) { //don't fully understand why removing user/userId from ModelState here. ModelState.Remove("User"); ModelState.Remove("userId"); var user = await GetCurrentUserAsync(); drill.UserId = user.Id; if (ModelState.IsValid) { _context.Add(drill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var viewmodel = new DrillCategory() { Drill = null, CategoryOptions = _context.Categories.Select(c => new SelectListItem { Value = c.CategoryId.ToString(), Text = c.CategoryName }).ToList() }; return(View(viewmodel)); }
public IOHandler() { RaspberryPi.Initialize(); this.I2C = new I2CBusPi(); this.SPI = new SPIBusPi(0); this.PWMGenHighFreq = new PCA9685(this.I2C, 0x4C, -1, PCA9685.OutputInvert.Inverted, PCA9685.OutputDriverMode.OpenDrain); this.PWMGenLowFreq = new PCA9685(this.I2C, 0x74, -1, PCA9685.OutputInvert.Inverted, PCA9685.OutputDriverMode.OpenDrain); this.PWMGenHighFreq.SetFrequency(333); this.PWMGenLowFreq.SetFrequency(50); this.RailController = new Rail(this.PWMGenHighFreq.Outputs[0], new DigitalInPi(11), this.SPI, new DigitalOutPi(29), this.I2C, null) { TraceLogging = true }; this.DrillController = new Drill(this.PWMGenHighFreq.Outputs[1], this.PWMGenLowFreq.Outputs[0]); this.SampleController = new Sample(this.PWMGenLowFreq.Outputs[1]); this.LEDController = new LEDs(this.PWMGenLowFreq.Outputs, this.PWMGenHighFreq.Outputs); this.AuxSensors = new AuxSensors(this.SPI, this.I2C) { TraceLogging = false }; this.SysSensors = new SysSensors(); this.Music = new MusicPlayer(); this.InitProcedure = new ISubsystem[] { this.RailController, this.DrillController, this.LEDController, this.AuxSensors, this.SysSensors, this.Music }; this.EStopProcedure = new ISubsystem[] { this.Music, this.RailController, this.DrillController, this.LEDController, this.AuxSensors, this.SysSensors }; this.UpdateProcedure = new ISubsystem[] { this.RailController, this.DrillController, this.LEDController /*, this.AuxSensors, this.SysSensors*/ }; if (this.EStopProcedure.Length < this.InitProcedure.Length || this.EStopProcedure.Length < this.UpdateProcedure.Length) { throw new Exception("A system is registered for init or updates, but not for emergency stop. For safety reasons, this is not permitted."); } }
private static void TalkViaUnitOfWork() { using (var uow = new UnitOfWork()) { Drill drill = uow.Drills.Get(1); Console.WriteLine(drill.Procedure); } }
public DrillPage(Drill drill) { InitializeComponent(); Drill = drill; CurrentTime = drill.SecondsForExercise * 1000; BindingContext = this; }
public override void _EnterTree() { drill = (Drill)building; stock = GetNode <ItemList>("back/stock"); giveSelected = GetNode <Button>("back/GiveSelected"); giveAll = GetNode <Button>("back/GiveAll"); stock.MaxColumns = 1; _on_Timer_timeout(); }
public DrillForm(Drill drill) { InitializeComponent(); this.drill = drill; wordTextBox.Text = drill.CurrentWord(); wordTextBox.AutoSize = false; }
static async Task <Uri> CreateDrillAsync(Drill drill) { HttpResponseMessage response = await client.PostAsJsonAsync("api/drills", drill); response.EnsureSuccessStatusCode(); // return URI of the created resource. return(response.Headers.Location); }
private void DrillUrl(DrillOptions drillOptions) { var drill = new Drill(); var drillStats = drill.DrillUrl(drillOptions); _scenarioContext.Set(drillStats, "DrillStats"); _scenarioContext.Set(drillStats.AverageResponseTime, "AverageResponseTime"); _scenarioContext.Set(drillStats.FailureCount, "FailureCount"); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { Drill = db.Drill.Where(O => O.ID == AppDrill.DrillID).FirstOrDefault(); list_tagdir = db.TagDictionary.Where(o => o.TransferType == AppDrill.language).ToList();//取出Tag字典表中的数据 } catch { } }
public HttpResponseMessage Post(Drill item) { this.drillRepository.InsertOrUpdate(item); this.drillRepository.Save(); var response = this.Request.CreateResponse(HttpStatusCode.Created, item); response.Headers.Location = this.Url.ApiLink(item.Id); return(response); }
public HttpResponseMessage <Drill> Post(Drill item) { this.drillRepository.InsertOrUpdate(item); this.drillRepository.Save(); var response = new HttpResponseMessage <Drill>(item); response.StatusCode = HttpStatusCode.Created; response.Headers.Location = new Uri("drills/" + item.Id, UriKind.Relative); return(response); }
static async Task <Drill> GetDrillAsync(string path) { Drill drill = null; HttpResponseMessage response = await client.GetAsync(path); if (response.IsSuccessStatusCode) { drill = await response.Content.ReadAsAsync <Drill>(); } return(drill); }
static async Task <Drill> UpdateDrillAsync(Drill drill) { HttpResponseMessage response = await client.PutAsJsonAsync($"api/drills/{drill.Id}", drill); response.EnsureSuccessStatusCode(); // Deserialize the updated drill from the response body. drill = await response.Content.ReadAsAsync <Drill>(); return(drill); }
public void godMode() { drill = Master.me.drills[Master.me.drills.Count - 1]; engine = Master.me.engines[Master.me.engines.Count - 1]; hull = Master.me.hulls[Master.me.hulls.Count - 1]; money = 100000f; inventory[inventory.Length - 1] = 5; updateStats(); fuel = fueltankSize; }
// GET api/Drills/5 public Drill GetDrill(int id) { Drill drill = db.Drills.Find(id); if (drill == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(drill); }
private void Awake() { if (drill != null) { GameObject.Destroy(drill); } else { drill = this; } }
// POST: api/Drills public IHttpActionResult Post([FromBody] Drill drill) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } uow.Drills.Add(drill); uow.Complete(); return(new OkResult(this)); }
public async Task <IActionResult> AddDrill(Drill drill) { if (drill == null) { return(BadRequest()); } db.Drills.Add(drill); await db.SaveChangesAsync(); return(Ok($"object {drill} was added!")); }
private async void OnOkClicked(object sender, RoutedEventArgs e) { this.IsEnabled = false; try { BoardDescription templateDescription = this.boardFormatter.ParseBoardDescription(this.TemplateDescription); BoardTemplate template = new BoardTemplate(templateDescription.Width, templateDescription.Height, templateDescription.Values); BoardDescription goalDescription = this.boardFormatter.ParseBoardDescription(this.GoalDescription); BoardGoal goal = new BoardGoal(goalDescription.Width, goalDescription.Height, goalDescription.Values); Drill drillToSave = this.drill.Update(this.DrillName, template, goal); if (this.update) { await this.drillService.Update(drillToSave); } else { await this.drillService.Add(drillToSave); } this.SavedDrill = drillToSave; this.Close(); } catch (InvalidBoardException exception) { MessageBox.Show( this, string.Join(Environment.NewLine, exception.Errors.Select(x => x.Message)), "Invalid board", MessageBoxButton.OK, MessageBoxImage.Warning); } catch (InvalidDrillException exception) { MessageBox.Show(this, exception.Message, "Invalid drill", MessageBoxButton.OK, MessageBoxImage.Warning); } catch { MessageBox.Show("An unexpected error occured during saving."); } finally { this.IsEnabled = true; } }
public DrillEditor([CanBeNull] Drill drill) { this.update = drill != null; this.drill = drill ?? this.drillService.GetDrillForAdd(); this.DrillName = this.drill.Name; this.TemplateDescription = this.boardFormatter.ToString(this.drill.Template); this.GoalDescription = this.boardFormatter.ToString(this.drill.Goal); this.DataContext = this; this.InitializeComponent(); this.Loaded += (sender, e) => { this.NameTextBox.Focus(); this.NameTextBox.SelectAll(); }; }
public GameService([NotNull] IMessageBus messageBus, [NotNull] IBoardGeneratorService boardGeneratorService) { if (messageBus == null) { throw new ArgumentNullException(nameof(messageBus)); } if (boardGeneratorService == null) { throw new ArgumentNullException(nameof(boardGeneratorService)); } this.messageBus = messageBus; this.boardGeneratorService = boardGeneratorService; this.drill = Drill.CreateNew("Default", BoardTemplate.CreateEmpty(4, 4), BoardGoal.CreateCompleted(4, 4)); this.InitialState = this.boardGeneratorService.Generate(this.drill.Template, this.drill.Goal); this.boardState = this.InitialState; }
private void UpdateDrillList(ICollection<Drill> drills, Drill selectedDrill) { this.DrillsListBox.ItemsSource = drills.OrderBy(x => x.Name, StringComparer.CurrentCultureIgnoreCase); this.DrillsListBox.SelectedItem = drills.FirstOrDefault(x => x.Equals(selectedDrill)) ?? drills.FirstOrDefault(); this.DrillsListBox.UpdateLayout(); if (this.DrillsListBox.SelectedItem != null) { ListBoxItem item = this.DrillsListBox.ItemContainerGenerator.ContainerFromItem(this.DrillsListBox.SelectedItem) as ListBoxItem; Debug.Assert(item != null, "Just set the selected item and called UpdateLayout, so the container should already exists."); item.Focus(); } }
// Use this for initialization void Start () { drillScript = GameObject.Find("DrillPoint").GetComponent<Drill>(); }
public void CalibrationCalculation(ushort il_punktow) { Drill dr = new Drill(); double x = 0; double y = 0; // zamiana z ListOfDrillsTemp na ListOfDrills switch(il_punktow) { case 3: for (int i = 0; i < ListOfDrills.Count; i++) { // wczytanie poczatkowych danych otworu x = ListOfDrills[i].x; y = ListOfDrills[i].y; dr.diameter = ListOfDrills[i].diameter; // uwzglednienie zmiany rozmiaru plytki x *= div_x; y *= div_y; // obliczenie nowego polozenia punktu dr.x = (long)((x * Math.Cos(CalibrationDegreeToRadian(przesuniecie_kat)) - y * Math.Sin(CalibrationDegreeToRadian(przesuniecie_kat)))); dr.y = (long)((x * Math.Sin(CalibrationDegreeToRadian(przesuniecie_kat)) + y * Math.Cos(CalibrationDegreeToRadian(przesuniecie_kat)))); // usuniecie starych danych ListOfDrills.RemoveAt(i); ListOfDrillsTemp.RemoveAt(i); // zastapienie ich nowymi danymi ListOfDrills.Insert(i, dr); ListOfDrillsTemp.Insert(i, dr); } TreeFillNode(ListOfDrillsTemp); break; default: string stemp = string.Format("nie ma kalibracji dla takiej ilosci punktow: {0} ", il_punktow); MessageBox.Show(stemp); break; } }
private void SortowanieNajkrotszaTrasa(object sender, EventArgs e) { Drill dr = new Drill(); double distance = 0; double distance_2 = 0; int number = 0; // sortujemy otwory wg najkrotszej trasy for (int i = 0; i < ListOfDrillsTemp.Count - 1; i++) { // dystans pomiedzy kolejnym ustalonym otworem, a jeszcze nieustalonym distance = Math.Sqrt(Math.Pow(ListOfDrillsTemp[i + 1].x - ListOfDrillsTemp[i].x, 2) + Math.Pow(ListOfDrillsTemp[i + 1].y - ListOfDrillsTemp[i].y, 2)); number = i + 1; for (int j = i + 2; j < ListOfDrillsTemp.Count; j++) { // obliczenie dystansu pomiedzy dwoma nastepnymi punktami, zapisanie go, oraz numeru otworu distance_2 = Math.Sqrt(Math.Pow(ListOfDrillsTemp[j].x - ListOfDrillsTemp[i].x, 2) + Math.Pow(ListOfDrillsTemp[j].y - ListOfDrillsTemp[i].y, 2)); if (distance > distance_2) { number = j; distance = distance_2; } } // zamiana otworow dr = ListOfDrillsTemp[number]; ListOfDrillsTemp[number] = ListOfDrillsTemp[i + 1]; ListOfDrillsTemp[i + 1] = dr; } TreeFillNode(ListOfDrillsTemp); }
private void DrillFileImport() { string[] temp; double diameter_temp = 0d; char[] filter = { ' ', 'X', 'Y', '(', ')' }; int drills_count_all = 0; openFileDialog1.InitialDirectory = "d:\\"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { ListOfDrills.Clear(); ListOfDrillsTemp.Clear(); // przeszukiwanie pliku TextReader tReader = new StreamReader(openFileDialog1.FileName); // odczytwujemy wielkosc plytki temp = tReader.ReadLine().Split(' '); boardX = (float)Convert.ToDouble(temp[7].Replace('.', ',')); boardY = (float)Convert.ToDouble(temp[10].Replace('.', ',')); // odczytujemy liczbe otworow temp = tReader.ReadLine().Split(' '); total_count = Convert.ToInt16(temp[4]); this.BeginInvoke((ThreadStart)delegate() { this.toolStripProgressBar1.Visible = true; this.toolStripProgressBar1.Maximum = total_count; this.toolStripProgressBar1.Value = 0; this.toolStripStatusLabel1.Visible = true; this.toolStripStatusLabel1.Text = "otwory : " + "0 / " + total_count; }); // czytamy do konca pliku // nastepnie szukamy slowa '(X/Y/Z)' temp = tReader.ReadLine().Split(' '); while (temp[0] != "(X/Y/Z") temp = tReader.ReadLine().Split(' '); // ustalamy jakie narzedzie teraz bedziemy uzywac temp = tReader.ReadLine().Split('C', ' '); while (temp[0] != "%") { Diameters diam = new Diameters(); diam.number = temp[0]; diam.diameter = Convert.ToDouble(temp[1].Replace('.', ',')); ListOfDiameters.Add(diam); temp = tReader.ReadLine().Split('C', ' '); //various_count++; } // czytamy do konca pliku drills_count[various_count] = 0; temp = tReader.ReadLine().Split(' ', 'X', 'Y', '.'); while (temp != null) { // ustalamy aktualne narzedzie if (temp[0] == "(Insert") { if (drills_count[various_count] > 0) various_count++; for (short i = 0; i < ListOfDiameters.Count; i++) { if (ListOfDiameters[i].number + ")" == temp[1]) { diameter_temp = ListOfDiameters[i].diameter; break; } } } // nastepnie ustalamy koordynaty otworow else if (temp[0] == "G82") { Drill dr = new Drill(); dr.diameter = diameter_temp; dr.x = Convert.ToInt32(temp[2].Replace('.', ',')); dr.y = Convert.ToInt32(temp[4].Replace('.', ',')); dr.ID = drills_count_all + 1; ListOfDrills.Add(dr); ListOfDrillsTemp.Add(dr); // zliczamy rozne otwory drills_count[various_count]++; // zliczamy wszystkie otwory drills_count_all++; this.BeginInvoke((ThreadStart)delegate() { this.toolStripProgressBar1.Value++; this.toolStripStatusLabel1.Text = "otwory : " + this.toolStripProgressBar1.Value.ToString() + " / " + total_count; }); } // czytamy kolejna linie try { temp = tReader.ReadLine().Split(' ', 'X', 'Y', '.'); } catch { temp = null; } } various_count++; // zamykamy plik tReader.Close(); wczytano_plik = true; } }
public void DrillChangeParams(Drill d) { double[] tablica = new double[100]; //int various_drills = 1; // znalezc otwor na liscie ListOfDrills i tam go zmienic ListOfDrills.RemoveAt(d.ID - 1); ListOfDrills.Insert(d.ID - 1, d); // przepisac liste ListOfDrills na ListOfDrillsTemp ListOfDrillsTemp.Clear(); for (int i = 0; i < ListOfDrills.Count; i++) ListOfDrillsTemp.Insert(i, ListOfDrills[i]); // wylaczyc event this.ListaOtworowListBox.ItemCheck -= new System.Windows.Forms.ItemCheckEventHandler(this.DrillListBox_ItemCheck); // sprawdzić czy nowa średnica jest na liście bool jest = false; for (int i = 0; i < ListaOtworowListBox.Items.Count; i++) { if (d.diameter == Convert.ToDouble(ListaOtworowListBox.Items[i])) { jest = true; break; } } // jesli nie ma, dodajemy z atrybutem checked if (!jest) ListaOtworowListBox.Items.Add(d.diameter, CheckState.Checked); // nowa lista otworow otwory = DrillDiamList(); // sortowanie otworow, od najmniejszego otwory = DrillSortList(otwory); DrillFillList(otwory); DrillListBox_ItemCheck(); this.ListaOtworowListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.DrillListBox_ItemCheck); TreeFillNode(ListOfDrillsTemp); }
public void DrillAdd(Drill d) { ListOfDrills.Add(d); ListOfDrillsTemp.Add(d); total_count = ListOfDrills.Count; TreeFillNode(ListOfDrillsTemp); }
public async Task Add(Drill drill) { if (drill == null) { throw new ArgumentNullException(nameof(drill)); } await this.repository.AddAsync(drill); }
private void SortowanieYInc(object sender, EventArgs e) { Drill dr = new Drill(); for (int i = 0; i < ListOfDrillsTemp.Count; i++) for (int j = 1; j < ListOfDrillsTemp.Count; j++) { if (ListOfDrillsTemp[j].y < ListOfDrillsTemp[j - 1].y) { dr = ListOfDrillsTemp[j - 1]; ListOfDrillsTemp[j - 1] = ListOfDrillsTemp[j]; ListOfDrillsTemp[j] = dr; } } TreeFillNode(ListOfDrillsTemp); }
public void InitShip() { map = GameObject.Find("Map").GetComponent<Map>(); drill = new Drill(1, 1); detector = new Detector(3, 1, 5); }
public void SetDrill(Drill drill) { if (drill == null) { throw new ArgumentNullException(nameof(drill)); } this.Drill = drill; this.messageBus.Publish(new DrillChanged()); this.Scramble(); }