public ServerEditViewModel(ITabController tabController, ServerData data) : base(tabController)
        {
            Name = data.Code;
            CurrentServerData = data;
            TransportDictionary dic = new TransportDictionary();

            Transfers        = dic.Transfers.ToArray();
            SelectedTransfer = Transfers.FirstOrDefault(x => x.Name == data.Protocol);
            OnPropertyChanged(nameof(Transfers));
        }
Exemplo n.º 2
0
        private async Task UpdateTransfers(HostState hostState)
        {
            await hostState.BoincState.UpdateFileTransfers();

            if (!_useObservableCollections)
            {
                return;
            }

            foreach (BoincRpc.FileTransfer fileTransfer in hostState.BoincState.FileTransfers)
            {
                ObservableTransfer transfer = Transfers.FirstOrDefault(tvm => tvm.HostId == hostState.Id && tvm.FileName == fileTransfer.Name);
                if (transfer == null)
                {
                    transfer = new ObservableTransfer(hostState, fileTransfer);
                    if (string.IsNullOrEmpty(SearchString))
                    {
                        Transfers.Add(transfer);
                    }
                    else
                    {
                        foreach (var content in transfer.GetContentsForFiltering())
                        {
                            if (content != null && content.IndexOf(SearchString, StringComparison.InvariantCultureIgnoreCase) != -1)
                            {
                                // The search string is found in any of the Models's property
                                Transfers.Add(transfer);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    transfer.Update(fileTransfer);
                }
            }
        }
Exemplo n.º 3
0
        public void EditTransfer(Transfer transfer)
        {
            var editTransfer = Transfers.FirstOrDefault(x => x.Id == transfer.Id);

            editTransfer = transfer;
        }
Exemplo n.º 4
0
 public ActionResult <Transfer> Get(int id)
 {
     return(Transfers.FirstOrDefault(x => x.Id == id));
 }
Exemplo n.º 5
0
 public void Delete(int id)
 {
     _db.Transfers.Remove(Transfers.FirstOrDefault(x => x.Id == id));
 }