/// <summary> /// Retrieve selected Contact /// </summary> /// <param name="contact"></param> private async void GetContact(Guid id) { Views.Shell.SetBusy(true, "Getting Contact..."); // Try to re-use cached contact record when appropriate if (CurrentContact == null || id != CurrentContact.Id) { // Retrieve Contact if cache cannot be used CurrentContact = await crmservice.RetrieveContact(id); // As contact record has been changed, clear the activity CompletedActivities.Clear(); CurrentActivity = null; } // If there is no completed activities for the contact, this runs all the time. if (CompletedActivities.Count == 0) { CompletedActivities = await crmservice.RetrieveActivitiesOfContact(id); } // Update Pin status Pin = _helper.ToggleAppBarButton(); Views.Shell.SetBusy(false); CheckVoiceCommand(); }
public void Save() { if (!Directory.Exists("Resources/Save")) { Directory.CreateDirectory("Resources/Save"); } if (!Directory.Exists("Resources/Save/Region")) { Directory.CreateDirectory("Resources/Save/Region"); } XmlDocument savefile = new XmlDocument(); XmlElement gamestateElement = savefile.CreateElement("gamestate"); XmlElement pointsElement = savefile.CreateElement("points"); XmlElement pointsBeforeSubstractionElement = savefile.CreateElement("pointsbs"); XmlElement comboElement = savefile.CreateElement("combo"); XmlElement completedActivitiesElement = savefile.CreateElement("activities"); XmlElement comboDeltaTimeElement = savefile.CreateElement("combotime"); XmlElement weatherElement = savefile.CreateElement("weathertype"); XmlElement weatherTimeElement = savefile.CreateElement("weathertime"); pointsElement.InnerText = Points.ToString(); pointsBeforeSubstractionElement.InnerText = PointsBeforeSubstraction.ToString(); comboElement.InnerText = Combo.ToString(); completedActivitiesElement.InnerText = CompletedActivities.ToString(); comboDeltaTimeElement.InnerText = ComboDeltaTimeCummulated.ToString(); weatherElement.InnerText = WeatherController.WeatherType; weatherTimeElement.InnerText = WeatherController.CurrentWeatherTime.ToString(); new List <XmlElement> { pointsElement, pointsBeforeSubstractionElement, comboElement, completedActivitiesElement, comboDeltaTimeElement, weatherElement, weatherTimeElement }.ForEach(element => gamestateElement.AppendChild(element)); savefile.AppendChild(savefile.CreateXmlDeclaration("1.0", "utf-8", null)); savefile.AppendChild(gamestateElement); savefile.Save(Savefile); Map.Save(); }