public async Task <ActionResult> DeleteConfirmed(byte id)
        {
            StopCode stopCode = await db.StopCodes.FindAsync(id);

            db.StopCodes.Remove(stopCode);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "id,label,description")] StopCode stopCode)
        {
            if (ModelState.IsValid)
            {
                db.Entry(stopCode).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(stopCode));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,label,description")] StopCode stopCode)
        {
            if (ModelState.IsValid)
            {
                db.StopCodes.Add(stopCode);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(stopCode));
        }
        // GET: StopCodes/Delete/5
        public async Task <ActionResult> Delete(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StopCode stopCode = await db.StopCodes.FindAsync(id);

            if (stopCode == null)
            {
                return(HttpNotFound());
            }
            return(View(stopCode));
        }
Exemple #5
0
    /// <summary>
    /// Halt simulation and write log to file.
    /// </summary>
    /// <param name="code">Reason for halt.</param>
    public static void Halt(StopCode code)
    {
        Debug.Log("Simulation Halt! " + code.ToString());
        // stop logging
        if (Log.logging)
        {
            Log.Stop(code);
        }

        // freeze the robot
        if (robot)
        {
            robot.rigidbody.velocity        = Vector3.zero;
            robot.rigidbody.angularVelocity = Vector3.zero;
            robot.moveEnabled = false;
        }
        // set simulation state
        state = State.stopped;
    }
Exemple #6
0
 /// <summary>
 /// 循环结构
 /// </summary>
 public void Runtime()
 {
     for (int i = 0; i < 1000; i++)
     {
         if (stop)//退出
         {
             StopCode?.Invoke();
             return;
         }
         if (on_off)//运行和暂停切换
         {
             ma = new ManualResetEvent(false);
             ma.WaitOne();
         }
         Info?.Invoke("计数:" + i.ToString());
         WorkCode?.Invoke();
         Thread.Sleep(500);
     }
     EndCode?.Invoke();
 }