Esempio n. 1
0
        //sets up correct URL info to get data via api call
        private void btnWeatherData_Click(object sender, RoutedEventArgs e)
        {
            string CompletedURL       = WeatherDataRetrived.URLBuild(CityName, UriOneLocation, NAMEQUERY, APIKEY);
            WeatherDataRetrived wInfo = JsonConvert.DeserializeObject <WeatherDataRetrived>(GetWeatherData(CompletedURL));

            //Testing
            WeatherDataBox.Text  = wInfo.name;
            WeatherDataBox.Text += "\n" + wInfo.main.temp;
            WeatherDataBox.Text += "\n" + wInfo.wind.speed;

            #region TestingTotalAmountOfPropertiesClassHas
            //using reflection and linq to check retrived data (wi = WeatherInfo)
            var dataobtained = from wi in Assembly.GetExecutingAssembly().GetTypes()
                               where wi.GetCustomAttributes().Any(a => a is WDRetrivedAttribute)
                               select wi;


            foreach (Type WData in dataobtained)
            {//scaning each item for all properties
                foreach (var props in WData.GetProperties())
                {
                    Debug.WriteLine(props.Name);
                }
            }
            #endregion
        }
Esempio n. 2
0
        private bool InitSystemContextCapture(bool ctrlSysCursor = true)
        {
            context = OpenSystemContext(ctrlSysCursor);

            if (context == null)
            {
                return(false);
            }

            data = new WData(context);
            data.SetWTPacketEventHandler(OnReceivePacket);
            return(true);
        }
Esempio n. 3
0
 public void CaptureStop()
 {
     if (!IsRunning)
     {
         return;
     }
     try {
         if (context != null)
         {
             context.Close();
         }
         IsRunning = false;
         for (int i = 0; i < taskList.Count; ++i)
         {
             taskList[i].Stop();
         }
         taskList.Clear();
     } catch (Exception ex) {
     }
     context = null;
     data    = null;
 }