public async void onBoot() { await Task.Delay(200); try { SettingsXML = (App.Current as App).SettingsXML; } catch (UnauthorizedAccessException e) { onBoot(); } catch (FileNotFoundException e) { this.Frame.Navigate(typeof(LoginPage)); } StorageFile ProfilePictureFile = await ApplicationData.Current.LocalFolder.GetFileAsync("profile.jpg"); CityYouSelected = theSettings.getWeatherQuery(); UnitTemperature = theSettings.isUnitTemperatureC(); Weather theWeather = new Weather(CityYouSelected, UnitTemperature); MainPageInformation.TextAlignment = TextAlignment.Center; UsernameText.TextAlignment = TextAlignment.Center; DisplayNameText.TextAlignment = TextAlignment.Center; await Task.Delay(100); profilePicture.Source = new BitmapImage(new Uri(ProfilePictureFile.Path, UriKind.Absolute)); MainPageInformation.Text = "Weather Forecast for " + CityYouSelected + ":\nMin: " + theWeatherQuery.getMinTemp() + "ºC\tMax: " + theWeatherQuery.getMaxTemp() + "ºC\nHumidity: " + theWeatherQuery.getHumidity() + "%\n\n" + theSensors.getRoomData(); UsernameText.Text = "@" + theSettings.getUserQuery(); DisplayNameText.Text = theSettings.getNameQuery(); LedControl(); //NamesXML = XDocument.Load(await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("OutputNames.xml")); //var DataQuery = from r in NamesXML.Descendants("Output") // select r; //for (int i = 0; i < 4; i++) //{ // XElement Data = DataQuery.ElementAt(i); // OriginalPinData[i] = Data.Element("name").Value; //} await Task.Delay(1000); theExtras.LoadNews(NewsTextLine, new Uri("http://feeds.bbci.co.uk/news/world/rss.xml")); theArduino.UpdatingPinsThread(5); }
public string AssistantBrainWorking(string incomingText) { string reply = "Hunh?"; switch (TryToUnderStand(incomingText)) { case 0: { reply = HelloText(); break; } case 1: { reply = iShouldTurnSomething(incomingText); break; } case 2: { reply = "So far i can only welcome you\n and turn things on and off"; break; } case 3: { string UnitTemperatureString = ""; if (theSettings.isUnitTemperatureC()) { UnitTemperatureString = "°C"; } else if (!theSettings.isUnitTemperatureC()) { UnitTemperatureString = "°F"; } reply = "Weather Forecast for " + theSettings.getWeatherQuery() + ":\nMin: " + theWeatherQuery.getMinTemp() + UnitTemperatureString + "\tMax: " + theWeatherQuery.getMaxTemp() + UnitTemperatureString + "\nHumidity: " + theWeatherQuery.getHumidity() + "%"; break; } case 4: { reply = SayMyName(); break; } case 5: { reply = IAmStuuuupid(); break; } } return(reply); }
public async void onBoot() { try { SettingsXML = XDocument.Load(await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("SettingsData.xml")); StorageFile ProfilePictureFile = await ApplicationData.Current.LocalFolder.GetFileAsync("profile.jpg"); for (int i = 0; i < 2; i++) { await Task.Delay(1000); CityYouSelected = theSettings.getWeatherQuery(); UnitTemperature = theSettings.isUnitTemperatureC(); theWeather = new Weather(CityYouSelected, UnitTemperature); WeatherQuery theWeatherQuery = new WeatherQuery(); if (UnitTemperature == true) { UnitTemperatureString = "°C"; } else { UnitTemperatureString = "°F"; } MainPageInformation.TextAlignment = TextAlignment.Center; UsernameText.TextAlignment = TextAlignment.Center; DisplayNameText.TextAlignment = TextAlignment.Center; await Task.Delay(100); profilePicture.Source = new BitmapImage(new Uri(ProfilePictureFile.Path, UriKind.Absolute)); MainPageInformation.Text = "Weather Forecast for " + CityYouSelected + ":\nMin: " + theWeatherQuery.getMinTemp() + UnitTemperatureString + "\tMax: " + theWeatherQuery.getMaxTemp() + UnitTemperatureString + "\nHumidity:\t" + theWeatherQuery.getHumidity() + "%"; UsernameText.Text = "@" + theSettings.getUserQuery(); DisplayNameText.Text = theSettings.getNameQuery(); theExtras.LoadNews(NewsTextLine, new Uri("http://feeds.bbci.co.uk/news/world/rss.xml")); } } catch (Exception e) { onBoot(); } //This should get location from SettingsData.xml but i was waiting to finish the // queries class. Now its hard coded to beirut. ---- DONE // ------------ NVM now it gets location from queries. --------------------------// //Options for weather we need to add= Celsius or Fahrenhiet. ---- DONE // Metric or imperial measurement. --- DONE // The xml has a lot of data we can use //theArduino.UpdatingPinsThread(1); }