Exemplo n.º 1
0
 private void RefreshSync(object sender, System.Timers.ElapsedEventArgs e)
 {
     _shouldRedraw = true;
     if (InvokeRequired)
     {
         var rcb = new RefreshCallBack(Invalidate);
         Invoke(rcb);
     }
     else
     {
         Invalidate();
     }
 }
 public EditSelectedStorageTypeViewModels(Models.Entity.Map map, Window self, List <SingleGridMapItemViewModels> SelectedMapItemsss,
                                          RefreshCallBack refreshCallbackFunc, SetStatusStringErasing msgCallBackFunc)
 {
     this._map                = map;
     this._self               = self;
     this._selectedMapItems   = SelectedMapItemsss;
     this._refreshCallBack    = refreshCallbackFunc;
     this._setMessageCallBack = msgCallBackFunc;
     this.Zones.AddRange(this._map.Zones);
     if (this.Zones.Count != 0)
     {
         SelectedZoneIndex = 0;
     }
     ExecuteSaveEditSelectedStorageZoneTypeCommand = new DelegateCommand(ExecuteSaveEditSelectedStorageZoneTypeCommandDo);
 }
Exemplo n.º 3
0
        //進行對 Windows Form 控制項的安全執行緒呼叫
        //進行對 Windows Form 控制項的安全執行緒呼叫
        private void RefreshUser()
        {
            if (listView_Users.InvokeRequired)
            {
                RefreshCallBack d = new RefreshCallBack(RefreshUser);
                this.Invoke(d, new object[] { });
            }
            else
            {
                listView_Users.Items.Clear();

                UserInfo user;
                ListViewItem item;
                ListViewItem.ListViewSubItem subItem;
                Color color;
                Socket socket;

                if (usersArray != null && usersArray.Count > 0 && allClientSockets != null && allClientSockets.Count > 0)
                {
                    for (int i = 0; i < usersArray.Count; i++)
                    {
                        user = (UserInfo)usersArray[i];
                        socket = (Socket)allClientSockets[user.DeviceId];

                        item = listView_Users.Items.Add((i + 1).ToString());

                        if (user.Enable)
                            color = Color.Blue;
                        else
                            color = Color.Red;

                        item.ForeColor = color;

                        subItem = item.SubItems.Add(user.UserName);
                        subItem.ForeColor = color;

                        subItem = item.SubItems.Add(user.IPAddress);
                        subItem.ForeColor = color;

                        subItem = item.SubItems.Add(user.LoginTime.ToString());
                        subItem.ForeColor = color;
                    }
                }

            }
        }