public void Deselect() { SelectedFaces.Clear(); SelectedVertices.Clear(); _isFaceSelected = false; UpdateUI?.Invoke(); }
public void Execute(UndoItem ui) { ui.Redo(); Redo.Clear(); Undo.Push(ui); UpdateUI?.Invoke(); }
public void SelectFaces(IEnumerable <Face> Faces) { SelectedFaces = Faces.ToList(); SelectedVertices.Clear(); _isFaceSelected = SelectedFaces.Count > 0; UpdateUI?.Invoke(); }
public void FindSmallestBoundaryPolygon(List <Point> points) { int step = 0; PointsToEnclose = points; int vertices = BoundaryPolygon.Vertices.Count; bool developed = true; while (developed) { developed = false; for (int v = 0; v < vertices; v++) { step++; Point vertex = BoundaryPolygon.Vertices.ElementAt(v); Point bestNeighbour = FindBestNeighbour(vertex, v); if (!vertex.Equals(bestNeighbour)) { BoundaryPolygon.ExchangeVertexAt(v, bestNeighbour); //v--; developed = true; Thread.Sleep(5); UpdateUI?.Invoke(this, new HillClimbingEventArgs(new Polygon(BoundaryPolygon))); } } } }
private void Ga_Update(object sender, EventArgs e) { CurrentGeneration++; RaisePropertyChanged(nameof(ShortestRouteFound)); RaisePropertyChanged(nameof(CurrentGeneration)); UpdateUI?.Invoke(this, EventArgs.Empty); }
private void updateUI(int i) { Dispatcher.Invoke(() => { lstSample.Items.Add(i); }); UpdateUI.Invoke(this, new EventArgs()); }
public void FetchLessons() { if (SelectedCategory == DefaultMessage) { return; } Lessons = (LessonDataStore as LessonDataStore).GetItemsByCategoryAsync(SelectedCategory).Result.ToList(); UpdateUI.Invoke(null, new EventArgs()); }
private bool EndDelegate(PlaceHolderTextView placeView, UITextView textview, string formattedText) { if (scrollForward && textScroller.ContentOffset.X < 50f) { ScrollForward(true); DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => { textScroller.FlashScrollIndicators(); }); } if (updateText) { int textViewLen = formattedText.Length; int formattedLen = placeView.Text.Length; if ((formattedLen > textViewLen) && !deleting) { char c = placeView.Text.Substring(textViewLen, 1).ToCharArray() [0]; if (c == ' ') { formattedText = formattedText + " "; } else if (c == '/') { formattedText = formattedText + "/"; } textViewLen = formattedText.Length; formattedLen = placeView.Text.Length; } placeView.SetShowTextOffSet(Math.Min(textViewLen, formattedLen)); if (!deleting || hasFullNumber || deletedSpace) { textview.Text = formattedText; } else { ret = true; } } if (flashForError) { FlashMessage("Please recheck number"); } if (ccText.Text.Length == cardHelper.LengthOfFormattedStringForType(Type) && expiryText.Text.Length == 5 && cvTwoText.Text.Length == (Type == CardType.AMEX ? 4 : 3)) { CompletelyDone = true; } else { CompletelyDone = false; } DispatchQueue.MainQueue.DispatchAsync(() => { UpdateUI.Invoke(); }); return(ret); }
public void PerfectReload() { int needed = clipCapacity - currentClip; int amount = currentAmmo > needed ? needed : currentAmmo; for (int i = 0; i < amount; i++) { bulletState.Add(true); } currentClip += amount; currentAmmo -= amount; state = State.READY; if (updateUI != null) { updateUI.Invoke(); } }
public void SelectFace(Face face) { SelectedFaces.Clear(); if (face != null && Faces.Contains(face)) { SelectedFaces.Add(face); } SelectedVertices.Clear(); _isFaceSelected = SelectedFaces.Count > 0; UpdateUI?.Invoke(); }
public void SelectVertices(IEnumerable <Pt> vertices) { SelectedVertices.Clear(); if (vertices != null) { SelectedVertices.AddRange(vertices.Distinct()); } SelectedFaces.Clear(); _isFaceSelected = false; UpdateUI?.Invoke(); }
public void SelectVertex(Pt?vertex) { SelectedFaces.Clear(); SelectedVertices.Clear(); if (vertex != null) { SelectedVertices.Add(vertex.Value); } _isFaceSelected = false; UpdateUI?.Invoke(); }
public void SelectFace(int?index) { SelectedVertices.Clear(); SelectedFaces.Clear(); if (index != null && index.Value >= 0 && index.Value < Faces.Count) { SelectedFaces.Add(Faces[index.Value]); } _isFaceSelected = SelectedFaces.Count > 0; UpdateUI?.Invoke(); }
public void AddItem(Clothes item) { if (clothes.ContainsKey(item.Name)) { clothes.Remove(item.Name); clothes.Add(item.Name, item); } else { clothes.Add(item.Name, item); } UpdateUI?.Invoke(); }
public void AddItem(Item item) { if (items.ContainsKey(item.Name)) { items.Remove(item.Name); items.Add(item.Name, item); } else { items.Add(item.Name, item); } UpdateUI?.Invoke(); }
private void HandleMessage(Message message) { switch (message.messageType) { case MessageTypes.RegResponse: ID = message.id; Conversations[-1] = message.message + "\r\n"; foreach (UserInfo userInfo in message.users) { if (ID != userInfo.ID) { Users.Add(userInfo.ID, userInfo.Name); Conversations.Add(userInfo.ID, ""); } } break; case MessageTypes.UserJoinOrLeft: if (message.isJoin) { if (message.id != ID) { Conversations.Add(message.id, ""); Conversations[-1] += message.message + "\r\n"; Users.Add(message.id, message.name); } } else { Conversations[-1] += message.message + "\r\n"; Conversations.Remove(message.id); Users.Remove(message.id); } break; case MessageTypes.PrivateMsg: Conversations[message.sourceID] += message.message + "\r\n"; break; case MessageTypes.ToAllMsg: Conversations[message.id] += message.message + "\r\n"; break; case MessageTypes.SearchResponse: ServerPort = message.port; ServerIPAddress = message.ipAddress; break; } UpdateUI?.Invoke(); }
public double CalculateScore(IMLMethod network) { SessionNumber++; DateTime startSession = DateTime.Now; PlanogramSimulation pilot = new PlanogramSimulation((BasicNetwork)network, Items, SimSettings); var result = LastResult = pilot.ScorePilot(); result.CurrentSession = SessionNumber; metricScoreHistory.Add(result.Score); metricAvgLastTen.Enqueue(result.Score); if (metricAvgLastTen.Count > 10) { metricAvgLastTen.Dequeue(); } result.MaxScore = metricScoreHistory.Max(); result.MinScore = metricScoreHistory.Min(); result.AvgScore = metricScoreHistory.Average(); result.AvgLastTen = metricAvgLastTen.Average(); if (SimSettings.Score.HasValue) { if (result.Score >= SimSettings.Score.Value) { NumScoreHits++; } else { NumScoreHits = 0; } } result.NumScoreHits = NumScoreHits; if (Logger != null) { SimulationData logdata = new SimulationData(); logdata.Session = result.CurrentSession; logdata.Score = result.Score; logdata.Elapse = DateTime.Now - startSession; Logger.Add(logdata, false); } UpdateUI?.Invoke(result, SimSettings.EnableSimDisplay); return(result.Score); }
public static void Show(Level level, string buf) { if (level <= mLevel) { string log = DateTime.Now.ToString(" yyyy-MM-dd HH:mm:ss ffff") + "---" + "[" + level.ToString() + "] " + buf; if (mLogFile == null) { Console.WriteLine(log); } else { mLogFile.Write(log + "\n"); mLogFile.Flush(); } if (updateUI != null) { updateUI.Invoke(log); } } }
public void RaiseUIUpdated() { UpdateUI?.Invoke(this, new EventArgs()); }
//=========== Event Senders ===========// protected virtual void OnUpdateUI(object sender, EventArgs e) => UpdateUI?.Invoke(sender, e);
public void DeleteItem(string name) { clothes.Remove(name); UpdateUI?.Invoke(); }
private void STextBox_UpdateUI(object sender, ScintillaNET.UpdateUIEventArgs e) { UpdateUI?.Invoke(this, e); }
private void ReceiveMess(Sockets sks) { ControlInvoker.Invoke(this, new ThreadStart(delegate { if (sks.ex != null) { if (sks.ClientDispose == true) { //由于未知原因引发异常.导致客户端下线. 比如网络故障.或服务器断开连接. //SetClientState(string.Format("客户端下线.!异常消息:{0}\r\n", sks.ex)); } else { //SetClientState(string.Format("异常消息:{0}\r\n", sks.ex)); } //timerConnect.Enabled = true; } else if (sks.Offset == 0) { //客户端主动下线 // SetClientState("客户端下线.!"); } else { byte[] buffer = new byte[sks.Offset]; Array.Copy(sks.RecBuffer, buffer, sks.Offset); string str = Encoding.UTF8.GetString(buffer); strPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; //此方式针对vs运行的程序有效,如果为直接启动exe,需要注意图片的路径 switch (str.Substring(0, 1)) { case "1": strPath += @"/dnf.png"; break; case "2": strPath += @"/lol.png"; break; case "3": strPath += @"/ahead.png"; break; } updateUi?.Invoke(); //同步更新Panel if (sks.Client.Client.Available > 0) //判断消息是否发送完成,socket的数据大小限制,分多个包发送 { Console.Write(str); _mess += str; } else { _mess = ""; _mess += str; } } })); }
/// <summary> /// 刷新前端显示 /// </summary> protected void OnUpdateUI() { UpdateUI?.Invoke(this.Lable, this.Index); // Task.Delay(50); }
public void DeleteItem(string name) { items.Remove(name); Console.WriteLine(name); UpdateUI?.Invoke(); }
private void Fa_Update(object sender, EventArgs e) { //raise property canged?? UpdateUI?.Invoke(this, EventArgs.Empty); RaisePropertyChanged(nameof(ViewModelSwarm)); }
private void Hca_UpdateUI(object sender, EventArgs e) { UpdateUI?.Invoke(this, e); }