public int SaveChanges() { int result = AddList.Count + RemoveList.Count; foreach (var addItem in AddList) { if (FinalList.Any(x => x.Equals(addItem))) { throw new Exception("Cannot add twice the same item"); } FinalList.Add(addItem); } foreach (var removeItem in RemoveList) { if (!FinalList.Any(x => x.Equals(removeItem))) { throw new Exception("Cannot remove items that are not in the list"); } FinalList.Remove(removeItem); } AddList.Clear(); RemoveList.Clear(); return(result); }
private void AddListButton_Click(object sender, EventArgs e) { AddList addList = new AddList(AddListButton); this.selectableFlowLayoutPanel1.Controls.Add(addList); addList.Focus(); //focus mai intai pe control, si dupa Select pe textbox in constructor }
public bool AñadirALista(DescripcionAlarma da) { if (lstAlarms.InvokeRequired) { AddList d = new AddList(AñadirALista); if (parent.Status != UBSLib.UBSModuleStatus.Closing && parent.Status != UBSLib.UBSModuleStatus.Closed) { return((bool)this.Invoke(new Func <bool>(() => d(da)))); } else { return(true); } } else { if (parent.Status != UBSLib.UBSModuleStatus.Closing && parent.Status != UBSLib.UBSModuleStatus.Closed) { if (!lstAlarms.Items.Contains(da)) { lstAlarms.Items.Add(da); lstAlarms.DisplayMember = "Titulo"; return(true); } else { return(false); } } return(true); } }
/// <summary> /// Check to see if the add list of the action can potentially be used to fulfill a goal /// </summary> /// <param name="goal">The goal to be fulfilled</param> /// <param name="currentBeliefs">The current beliefs that we have at the moment</param> /// <returns>Returns a fact that can be found in the add list that has the same name as the end goal/fact in the goal /// and where an assignment can be found that fulfills the goal and does not violate the constraints of the action.</returns> internal virtual Fact IsApplicableForAdd(SimpleGoal goal, List <Fact> currentBeliefs) { //only facts that have the same name as the goal are considered but also only those that are more general (or equally general) than the goal //this means that a substitution (or empty substitution) exists that transforms the fact of the addlist into the fact of the goal var possibeAdds = AddList.Where(y => y.Name.Equals(goal.Fact.Name) && y.IsMoreGeneralThanOrEqualTo(goal.Fact)); //if no such facts can be found, quickly return null if (!possibeAdds.Any()) { return(null); } //if there are no constraints, quickly return the first fact that can fulfill the goal if (!Constraints.Any()) { return(possibeAdds.FirstOrDefault()); } //return the first fact of the possible facts of the addlist where an assignment can be found that also //does not violate the constraints of the action foreach (var possibleGoal in possibeAdds) { var tuples = GetAssignment(possibleGoal, goal, currentBeliefs); if (CheckConstraints(tuples)) { return(possibleGoal); } } return(null); }
/// <summary> /// 删除进程信息。 /// </summary> /// <param name="task"> /// 进程信息。 /// </param> /// <param name="taskType"> /// 进程信息类型。 /// </param> public void DelTask(string task, TASK_TYPE_FLAGS taskType) { if (AddList.Any(tmp => string.Equals(tmp, task, StringComparison.CurrentCultureIgnoreCase))) { AddList.Remove(task); } DelList.AddLast(task); }
private void 一键导入账号关注VTB和VUP_Click(object sender, RoutedEventArgs e) { 增加房间提示信息.Content = $"正在导入,此期间请勿关闭该窗口.速度会根据关注列表的长度有所变化(一个V大约2秒)...请稍后....."; AddList.导入VTBVUP((TEXT) => { 增加房间提示信息.Content = TEXT; }, this, false); }
/// <summary> /// Default constructor /// </summary> public SellGoldAction() { var x = new NamedParameter("param1"); var y = new NamedParameter("param2"); Preconditions.Add(new Fact(Definitions.HasGold, new ValueParameter(true))); Preconditions.Add(new Fact(Definitions.Town, x, y)); Preconditions.Add(new Fact(Definitions.In, x, y)); AddList.Add(new Fact(Definitions.HasGold, new ValueParameter(false))); DeleteList.Add(new Fact(Definitions.HasGold, new ValueParameter(true))); }
/// <summary> /// Default constructor /// </summary> public GoToAction() { var x = new NamedParameter("param1"); var y = new NamedParameter("param2"); var x2 = new NamedParameter("param3"); var y2 = new NamedParameter("param4"); Preconditions.Add(new Fact(Definitions.In, x, y)); AddList.Add(new Fact(Definitions.In, x2, y2)); DeleteList.Add(new Fact(Definitions.In, x, y)); }
private void button1_Click(object sender, EventArgs e) { try { AddList.Invoke(this, new ViewEventArgs(textBox1.Text)); } catch (Exception) { MessageBox.Show("Неправильно введен символ."); } }
// GET: ThongKe public ActionResult Index(DateTime?startTime, DateTime?endTime) { var list = GetDoc(startTime, endTime); HttpContext.Session["ListTK"] = list; var dataPoints = AddList.ListDataPonit(list); ViewBag.DataPoints = JsonConvert.SerializeObject(dataPoints); return(View(list)); }
public ActionResult MuonTra(DateTime?startTime, DateTime?endTime) { var list = GetMuonTra(startTime, endTime); HttpContext.Session["ListMT"] = list; ViewBag.UsersBorrowDocument = GetUsersBorrowDocument(); var dataPoints = AddList.ListDataPonit(list); ViewBag.DataPoints = JsonConvert.SerializeObject(dataPoints); return(View(list)); }
private void ShowList(string msg) { if (Lbx_OutputInfo.InvokeRequired) { AddList d = new AddList(ShowList); Lbx_OutputInfo.Invoke(d, msg); } else { Lbx_OutputInfo.Items.Insert(0, DateTime.Now.ToLongTimeString() + ":" + msg); } }
/// <summary> /// Default constructor that initializes preconditions, add/delete list and constraints /// </summary> /// <param name="table">The table of our problem</param> public PutDownAction(Table table) { _table = table; var block = new NamedParameter("param1"); var goal1 = new Fact(Definitions.ArmHolds, block); Preconditions.Add(goal1); AddList.Add(new Fact(Definitions.ArmHolds, new ValueParameter(null))); AddList.Add(new Fact(Definitions.On, block, new ValueParameter(table))); AddList.Add(new Fact(Definitions.Clear, block)); DeleteList.Add(goal1); Constraints.Add(TypeCheck(typeof(Block), block)); }
public ActionResult Dashboard() { ViewBag.Array = CountItem(); ViewBag.DataPoints = JsonConvert.SerializeObject(AddList.ListDataPonit(GetDoc())); var listKe = _lichSuHoatDongService.GetAllHaveJoinUser(); var lichSuHoatDongs = listKe.Where(p => p.NgayTao <= DateTime.Now).OrderByDescending(p => p.NgayTao).Take(5); ViewBag.LichSuHoatDong = lichSuHoatDongs; return(View()); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.N)) { AddList.Add(enemypool.Create()); } if (Keyboard.GetState().IsKeyDown(Keys.M)) { foreach (GameObject item in gameObjectList) { if ((item.GetComponent("Enemy") != null) || (item.GetComponent("Scissor") != null)) { enemypool.ReleaseObject(item); break; } } } foreach (GameObject item in gameObjectList) { item.Update(gameTime); } //adds new item to the loop foreach (GameObject item in addList) { if (item != null) { item.LoadContent(Content); gameObjectList.Add(item); } } addList.Clear(); //removes items from the loop foreach (GameObject item in removeList) { gameObjectList.Remove(item); } removeList.Clear(); // TODO: Add your update logic here ScreenHeight = graphics.PreferredBackBufferHeight; ScreenWidth = graphics.PreferredBackBufferWidth; camera.Follow(player, (Collider)player.GetComponent("Collider")); base.Update(gameTime); }
private void 一键导入账号关注VTB和VUP_Click(object sender, RoutedEventArgs e) { 增加房间提示信息.Content = $"正在导入,请勿关闭该窗口,请稍后"; AddList.导入VTBVUP((TEXT) => { try { 增加房间提示信息.Content = "导入完成,新增:" + TEXT.Split(':')[TEXT.Split(':').Length - 1] + "个"; } catch (Exception) { 增加房间提示信息.Content = "导入完成"; } }, this, false); }
private void LblAddTodoBtn_MouseDown(object sender, MouseButtonEventArgs e) { Utils.MarkTravel(this); if (Db.GetLists().Count > 0) { State.LastAction = ACTION.AddToDo; AddToDo w = new AddToDo(); w.Show(); this.Close(); } else { State.LastAction = ACTION.AddList; AddList w = new AddList(); w.Show(); this.Close(); } }
public StackAction() { var param1 = new STRIPS.NamedParameter("param1"); var param2 = new STRIPS.NamedParameter("param2"); var goal1 = new STRIPS.Fact(Definitions.ArmHolds, param1); var goal2 = new STRIPS.Fact(Definitions.Clear, param2); Preconditions.Add(goal1); Preconditions.Add(goal2); AddList.Add(new STRIPS.Fact(Definitions.ArmHolds, new STRIPS.ValueParameter(null))); AddList.Add(new STRIPS.Fact(Definitions.On, param1, param2)); AddList.Add(new STRIPS.Fact(Definitions.Clear, param1)); DeleteList.Add(goal1); DeleteList.Add(goal2); Constraints.Add(TypeCheck(typeof(Block), param1)); Constraints.Add(TypeCheck(typeof(Block), param2)); Constraints.Add(NotEqualsCheck(param1, param2)); }
/// <summary> /// 增加进程信息。 /// </summary> /// <param name="task"> /// 进程信息。 /// </param> /// <param name="taskType"> /// 进程信息类型。 /// </param> /// <returns> /// True为添加成功。 /// False为添加失败。 /// </returns> public bool AddTask(string task, TASK_TYPE_FLAGS taskType) { if (AddList.Any(tmp => string.Equals(tmp, task, StringComparison.CurrentCultureIgnoreCase))) { return(false); } if (DelList.Any(tmp => string.Equals(tmp, task, StringComparison.CurrentCultureIgnoreCase))) { DelList.Remove(task); return(true); } if (OriginList.Any(tmp => string.Equals(tmp, task, StringComparison.CurrentCultureIgnoreCase))) { return(false); } AddList.AddLast(task); return(true); }
/// <summary> /// 修改进程信息。 /// </summary> /// <param name="frmTask"> /// 需修改的进程信息。 /// </param> /// <param name="nowTask"> /// 修改为的进程信息。 /// </param> /// <param name="taskType"> /// 进程信息类型。 /// </param> /// <returns> /// True为修改成功。 /// False为修改失败。 /// </returns> public bool ModifyTask(string frmTask, string nowTask, TASK_TYPE_FLAGS taskType) { if (AddList.Any(tmp => string.Equals(tmp, nowTask, StringComparison.CurrentCultureIgnoreCase))) { return(false); } if (DelList.Any(tmp => string.Equals(tmp, nowTask, StringComparison.CurrentCultureIgnoreCase))) { DelList.AddLast(frmTask); DelList.Remove(nowTask); return(true); } if (OriginList.Any(tmp => string.Equals(tmp, nowTask, StringComparison.CurrentCultureIgnoreCase))) { return(false); } DelList.AddLast(frmTask); AddList.AddLast(nowTask); return(true); }
private void 导入VTBVUP数据层_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue) // 显示 { if (string.IsNullOrEmpty(MMPU.Cookie)) { 导入VTBVUP提示文本.Text = "您未登录bilibili,请直接点击\"下一步\""; } else if (_已导入 == false) { 一步按钮.IsEnabled = false; 一步按钮.IsEnabled = false; 导入VTBVUP提示文本.Text = "正在导入关注列表里符合的VTB/VUP数据,速度会根据关注列表的长度有所变化(一个V大约2秒) 请勿关闭软件,请稍候……"; AddList.导入VTBVUP((TEXT) => { 导入VTBVUP提示文本.Text = $"{TEXT}"; 一步按钮.IsEnabled = true; 一步按钮.IsEnabled = true; }, this, true); } } }
public SomeOtherAction() { AddList.Add(new STRIPS.Fact("True")); AddList.Add(new STRIPS.Fact("OneParam", new STRIPS.NamedParameter("test"))); Constraints.Add(TypeCheck(typeof(string), new STRIPS.NamedParameter("test"))); }
/// <summary> /// 重置列表状态。 /// </summary> public void Reset() { AddList.Clear(); DelList.Clear(); }
public SomeAction() { AddList.Add(new STRIPS.Fact("True")); AddList.Add(new STRIPS.Fact("OneParam", new STRIPS.NamedParameter("test"))); }
public AnAction() { AddList.Add(new STRIPS.Fact("test", new STRIPS.NamedParameter("param1"))); DeleteList.Add(new STRIPS.Fact("test", new STRIPS.NamedParameter("param1"))); Preconditions.Add(new STRIPS.Fact("test", new STRIPS.NamedParameter("param1"))); }
public void Add(T input) { AddList.Add(input); }
public void AddRange(IEnumerable <T> inputList) { AddList.AddRange(inputList); }