/// <summary> /// Accepts an invite and adds to the list of trusted hubs. This method does not verify the signature or existance in the current list of invitations, will remove if exists. /// </summary> /// <param name="invite"></param> public void AcceptInvite(HubInvitation invite) { var hubInstance = new HubInstance(invite.HubId); hubInstance.Created = DateTime.UtcNow; Hubs.Add(hubInstance); Invitations.Remove(invite); Persist(); }
private void AddNewHubExecute() { Views.SelectAirport window = new Views.SelectAirport(); var data = new AirportSelectorViewModel(this, null); window.DataContext = data; try { bool?result = window.ShowDialog(); if (result.HasValue && result.Value) { if (data.SelectedFlightLine != null) { HubViewModel newHub = new HubViewModel(this, data.SelectedFlightLine.DepartureAirport.Airport); Hubs.Add(newHub); SelectedHub = newHub; } } } catch (Exception ex) { Console.Write(ex.Message); } }
public int Refresh() { int rv; int n; rv = WWUsbDeviceTreeDLL_Refresh(); if (rv < 0) { Console.WriteLine("Error: WWUsbDeviceTreeCs::Refresh() failed {0}", rv); return(rv); } HCs.Clear(); n = WWUsbDeviceTreeDLL_GetNumOfHostControllers(); for (int i = 0; i < n; ++i) { WWUsbHostControllerCs hc; rv = WWUsbDeviceTreeDLL_GetHostControllerInf(i, out hc); if (rv < 0) { Console.WriteLine("Error: WWUsbDeviceTreeCs::Update HC failed {0}", rv); return(rv); } HCs.Add(hc); } Hubs.Clear(); n = WWUsbDeviceTreeDLL_GetNumOfHubs(); for (int i = 0; i < n; ++i) { WWUsbHubCs hub; rv = WWUsbDeviceTreeDLL_GetHubInf(i, out hub); if (rv < 0) { Console.WriteLine("Error: WWUsbDeviceTreeCs::Update HUB failed {0}", rv); return(rv); } Hubs.Add(hub); } HPs.Clear(); n = WWUsbDeviceTreeDLL_GetNumOfHubPorts(); for (int i = 0; i < n; ++i) { WWUsbHubPortNative hpn; rv = WWUsbDeviceTreeDLL_GetHubPortInf(i, out hpn); if (rv < 0) { Console.WriteLine("Error: WWUsbDeviceTreeCs::Update HubPort failed {0}", rv); return(rv); } WWUsbHubPortCs hp = new WWUsbHubPortCs(hpn); for (int j = 0; j < hpn.numStringDesc; ++j) { WWUsbStringDescCs sdc; WWUsbDeviceTreeDLL_GetStringDesc(i, j, out sdc); hp.stringDescList.Add(sdc); } HPs.Add(hp); } return(0); }