Ejemplo n.º 1
0
 private void ButtonClearEvents_Activated(object sender, EventArgs e)
 {
     if (dataSource != null)
     {
         dataSource.Events.Clear();
         TableEvents.ReloadData();
     }
 }
Ejemplo n.º 2
0
        private void Adb_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            if (e.Data == null)
            {
                return;
            }

            if (!e.Data.Contains("ShadowOS"))
            {
                return;
            }

            // Got an event from ShadowOS
            Console.WriteLine("received output: {0}", e.Data);

            try
            {
                // Parse out the details
                int    start         = e.Data.IndexOf("{", StringComparison.CurrentCulture);
                string data          = e.Data.Substring(start);
                var    shadowOSEvent = JsonConvert.DeserializeObject <ShadowOSEvent>(data);

                string details = string.Empty;

                if (shadowOSEvent.EventType == "http")
                {
                    details = shadowOSEvent.Data.Uri;
                }
                else
                {
                    details = shadowOSEvent.Data.Data;
                }

                dataSource.Events.Insert(0, new Event(shadowOSEvent.EventType, shadowOSEvent.Data.Action, details));

                this.InvokeOnMainThread(() =>
                {
                    TableEvents.ReloadData();
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }