예제 #1
0
        private void ScanConnections()
        {
            List <RemoteConnection> connections = _resolver.GetRemoteConnections();

            _hostList.Clear();

            foreach (var remConn in connections)
            {
                RemoteListItem item = new RemoteListItem();

                if (remConn.type == ConnectionType.Incoming)
                {
                    item.iconPath = @"/WPF_Resolver;component/img/red_arrow.png";
                }
                else
                {
                    item.iconPath = @"/WPF_Resolver;component/img/green_arrow.png";
                }

                item.resolverName = remConn.remoteResolver.name;
                item.energy       = remConn.requests.Sum(x => x.Value.energy);

                _hostList.Add(item);
            }
        }
예제 #2
0
 private RemoteListItem GetRemoteListItem(RemoteBranch branch)
 {
     lock(_repository.Remotes.SyncRoot)
     {
         foreach(var remote in _repository.Remotes)
         {
             if(branch.Name.StartsWith(remote.Name + "/"))
             {
                 RemoteListItem ritem = null;
                 foreach(var i in _remotes)
                 {
                     if(i.DataContext.Name == remote.Name)
                     {
                         ritem = i;
                         break;
                     }
                 }
                 if(ritem == null)
                 {
                     ritem = new RemoteListItem(remote);
                     ritem.Items.Comparison = RemoteBranchListItem.CompareByName;
                     _remotes.Add(ritem);
                     CustomListBoxItemsCollection host;
                     if(_refsRemotes == null)
                     {
                         host = _itemHost;
                     }
                     else
                     {
                         host = _refsRemotes.Items;
                     }
                     host.AddSafe(ritem);
                 }
                 return ritem;
             }
         }
     }
     return null;
 }