/// <summary> /// Pin a host that isn't currently selected /// </summary> public bool autoPin(int uId, string name) { HostProfile host = null; bool isHostValid = false; if (isPinned(uId)) { // Update with existing pinned profile isHostValid = foundProfiles.TryGetValue(uId, out host); } if (!isHostValid) { // Empty profile, will be filled first time this host is selected host = new HostProfile(); } host.uId = uId; // Might be able to get a better name string n; ; if ("" != (n = App.nearby.getFullName(uId))) { host.name = n; } else { host.name = name; } return pin(host); }
public HostProfile(HostProfile newHost) { lastUpdateTime = newHost.lastUpdateTime; uId = newHost.uId; name = newHost.name; profile = new Profile(newHost.profile); feedback = new Feedback(newHost.feedback); messages = new Messages(newHost.messages); }
// public Map myMap; // Constructor public NearbyData() { hosts = new Hosts(); host = new HostProfile(); messageThread = new MessageThread(); viewportCache = new ViewportCache(); locationRect = null; selectedPage = 0; selectedUid = 0; selectedTid = 0; AboutPageActive = false; _mapCenter = null; _isCenteredOnMe = true; _meCenter = null; }
/// <summary> /// Common pin functionality /// </summary> private bool pin(HostProfile host) { int uId = host.uId; GreatCircle gc = new GreatCircle(); if (foundProfiles.Count == 0) { // Clear the "no found hosts" help message Deployment.Current.Dispatcher.BeginInvoke(() => { App.ViewModelMain.foundItems.Clear(); }); } host.lastUpdateTime = gc.Now(); // Deal with case where host is already pinned if (isPinned(uId)) { foundProfiles.Remove(uId); } Deployment.Current.Dispatcher.BeginInvoke(() => { App.ViewModelMain.unPin(uId); }); // Add pinned items to store and pinnedList UI foundProfiles.Add(uId, host); Deployment.Current.Dispatcher.BeginInvoke(() => { App.ViewModelMain.Pin(uId, host.name, host.lastUpdateTime); App.ViewModelHost.Pin(uId); }); return true; }
/// <summary> /// Explicitly pin the currently selected host /// </summary> public bool pin() { HostProfile host = new HostProfile(App.nearby.host); return pin(host); }