コード例 #1
0
 public void Deselect()
 {
     SelectedFaces.Clear();
     SelectedVertices.Clear();
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
コード例 #2
0
 public void Execute(UndoItem ui)
 {
     ui.Redo();
     Redo.Clear();
     Undo.Push(ui);
     UpdateUI?.Invoke();
 }
コード例 #3
0
 public void SelectFaces(IEnumerable <Face> Faces)
 {
     SelectedFaces = Faces.ToList();
     SelectedVertices.Clear();
     _isFaceSelected = SelectedFaces.Count > 0;
     UpdateUI?.Invoke();
 }
コード例 #4
0
        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)));
                    }
                }
            }
        }
コード例 #5
0
ファイル: GeneticViewModel.cs プロジェクト: csabull96/adv_alg
 private void Ga_Update(object sender, EventArgs e)
 {
     CurrentGeneration++;
     RaisePropertyChanged(nameof(ShortestRouteFound));
     RaisePropertyChanged(nameof(CurrentGeneration));
     UpdateUI?.Invoke(this, EventArgs.Empty);
 }
コード例 #6
0
 private void updateUI(int i)
 {
     Dispatcher.Invoke(() =>
     {
         lstSample.Items.Add(i);
     });
     UpdateUI.Invoke(this, new EventArgs());
 }
コード例 #7
0
 public void FetchLessons()
 {
     if (SelectedCategory == DefaultMessage)
     {
         return;
     }
     Lessons = (LessonDataStore as LessonDataStore).GetItemsByCategoryAsync(SelectedCategory).Result.ToList();
     UpdateUI.Invoke(null, new EventArgs());
 }
コード例 #8
0
        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);
        }
コード例 #9
0
    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();
        }
    }
コード例 #10
0
 public void SelectFace(Face face)
 {
     SelectedFaces.Clear();
     if (face != null && Faces.Contains(face))
     {
         SelectedFaces.Add(face);
     }
     SelectedVertices.Clear();
     _isFaceSelected = SelectedFaces.Count > 0;
     UpdateUI?.Invoke();
 }
コード例 #11
0
 public void SelectVertices(IEnumerable <Pt> vertices)
 {
     SelectedVertices.Clear();
     if (vertices != null)
     {
         SelectedVertices.AddRange(vertices.Distinct());
     }
     SelectedFaces.Clear();
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
コード例 #12
0
 public void SelectVertex(Pt?vertex)
 {
     SelectedFaces.Clear();
     SelectedVertices.Clear();
     if (vertex != null)
     {
         SelectedVertices.Add(vertex.Value);
     }
     _isFaceSelected = false;
     UpdateUI?.Invoke();
 }
コード例 #13
0
 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();
 }
コード例 #14
0
ファイル: StorageService.cs プロジェクト: yasha1212/oop-4sem
 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();
 }
コード例 #15
0
ファイル: ListItemStorage.cs プロジェクト: L3SHA/OOP-Labs
 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();
 }
コード例 #16
0
        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();
        }
コード例 #17
0
        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);
        }
コード例 #18
0
ファイル: Logger.cs プロジェクト: shiningstone/PowerTest
        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);
                }
            }
        }
コード例 #19
0
 public void RaiseUIUpdated()
 {
     UpdateUI?.Invoke(this, new EventArgs());
 }
コード例 #20
0
ファイル: SquaresGameModel.cs プロジェクト: Stryse/SquareGame
 //=========== Event Senders ===========//
 protected virtual void OnUpdateUI(object sender, EventArgs e) => UpdateUI?.Invoke(sender, e);
コード例 #21
0
ファイル: StorageService.cs プロジェクト: yasha1212/oop-4sem
 public void DeleteItem(string name)
 {
     clothes.Remove(name);
     UpdateUI?.Invoke();
 }
コード例 #22
0
 private void STextBox_UpdateUI(object sender, ScintillaNET.UpdateUIEventArgs e)
 {
     UpdateUI?.Invoke(this, e);
 }
コード例 #23
0
ファイル: MainForm.cs プロジェクト: brucedota/subtoros
        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;
                    }
                }
            }));
        }
コード例 #24
0
 /// <summary>
 /// 刷新前端显示
 /// </summary>
 protected void OnUpdateUI()
 {
     UpdateUI?.Invoke(this.Lable, this.Index);
     // Task.Delay(50);
 }
コード例 #25
0
ファイル: ListItemStorage.cs プロジェクト: L3SHA/OOP-Labs
 public void DeleteItem(string name)
 {
     items.Remove(name);
     Console.WriteLine(name);
     UpdateUI?.Invoke();
 }
コード例 #26
0
 private void Fa_Update(object sender, EventArgs e)
 {
     //raise property canged??
     UpdateUI?.Invoke(this, EventArgs.Empty);
     RaisePropertyChanged(nameof(ViewModelSwarm));
 }
コード例 #27
0
 private void Hca_UpdateUI(object sender, EventArgs e)
 {
     UpdateUI?.Invoke(this, e);
 }