Esempio n. 1
0
 public void ReplayListed(object e, RoutedEventArgs args)
 {
     this.Hide();
     //Array.ForEach(Process.GetProcessesByName("WinAppDriver"), x => x.Kill());
     if (session != null)
     {
         session.Close();
         //Array.ForEach(Process.GetProcessesByName("WinAppDriver"), x => x.Kill());
     }
     session = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
     foreach (string filename in eventFilesList)
     {
         RepeatTaps(jsonSimpleWrapper.LoadEvent(filename), filename);
     }
     session.Close();
     this.Show();
     foreach (string filename in eventFilesList)
     {
         PreviewImages(filename);
     }
 }
Esempio n. 2
0
        private void OnButtonKeyDown(object sender, KeyEventArgs e)
        {
            Console.WriteLine(e.Key.ToString() + " held down");
            switch (e.Key.ToString())
            {
            case "D1":
                //record = !record;
                //if (record)
                //{
                //    Console.WriteLine("Recording ON");
                //    this.Opacity = 0.25;
                //}
                //else {
                //    Console.WriteLine("Recording OFF");
                //    this.Opacity = 0.50;
                //}
                break;

            case "D2":
                RepeatTaps(eventList);
                break;

            case "D3":
                parent.Show();
                this.Close();
                break;

            case "D4":
                jsonSimpleWrapper.WriteEvents(eventList);
                Console.WriteLine("List count: " + eventList.Count);
                jsonSimpleWrapper.SaveEvents(installDirectory);
                break;

            case "D5":
                RepeatTaps(jsonSimpleWrapper.LoadEvent(installDirectory + "events.json"));
                break;

            case "D6":
                Console.WriteLine("Clearing Events");
                eventList = new List <Coordinate>();
                jsonSimpleWrapper.ClearEvents();
                jsonSimpleWrapper.WriteEvents(eventList);
                jsonSimpleWrapper.SaveEvents(installDirectory);
                break;

            case "D7":
                Console.WriteLine("Screenshot");
                //expected = imageComparer.Screenshot(width, height);
                break;

            case "D8":
                //imageComparer.CompareImages(expected, imageComparer.Screenshot(width, height));
                break;

            case "D9":

                break;

            case "D0":
                record = !record;
                if (record)
                {
                    if (session != null)
                    {
                        //Array.ForEach(Process.GetProcessesByName("WinAppDriver"), x => x.Kill());
                        session.Close();
                        session = new WindowsDriver <WindowsElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
                    }
                    this.Hide();
                    Console.WriteLine("Recording ON");
                    //jsonSimpleWrapper.WriteEvents(eventList);
                    CustomSaveDialog customSaveDialog2 = new CustomSaveDialog(this);
                    customSaveDialog2.ShowDialog();
                    if (customSaveDialog2.DialogResult.HasValue && customSaveDialog2.DialogResult.Value)
                    {
                        Console.WriteLine("Event Name: " + customSaveDialog2.eventName.Text);
                        currentEventName     = customSaveDialog2.eventName.Text;
                        currentEventTapCount = 0;
                    }
                    //String eventName = customSaveDialog2.GetEventName();
                    this.Show();
                    this.Opacity = 0.25;
                }
                else
                {
                    Console.WriteLine("Recording OFF");
                    jsonSimpleWrapper.WriteEvents(eventList);
                    Console.WriteLine("List count: " + eventList.Count);
                    jsonSimpleWrapper.SaveEvents(installDirectory, currentEventName, true);    //need install directory
                    this.Opacity = 0.75;
                    if (session != null)
                    {
                        session.Close();
                        //Array.ForEach(Process.GetProcessesByName("WinAppDriver"), x => x.Kill());
                    }
                }
                break;

            default:
                break;
            }
        }