private void OnReplayCapture()
        {
            var dialog = new CommonOpenFileDialog
            {
                IsFolderPicker = true,
                Multiselect    = false
            };


            //var fileDialog = new OpenFileDialog();
            //fileDialog.Filter = "Json Files (*.json)|*.json";
            //dialog.Filters.Add(new CommonFileDialogFilter("Json files",".json"));

            var res = dialog.ShowDialog();

            if (res == CommonFileDialogResult.Ok)
            {
                var dir       = dialog.FileName;
                var jsonFiles = Directory.GetFiles(dir, "*.json");
                var sessions  = new List <EventCaptureSession>();
                foreach (var jsonFile in jsonFiles)
                {
                    string json;
                    using (var reader = new StreamReader(File.OpenRead(jsonFile)))
                    {
                        json = reader.ReadToEnd();
                    }
                    try
                    {
                        var session = JsonConvert.DeserializeObject <EventCaptureSession>(json);
                        sessions.Add(session);
                    }
                    catch (Exception)
                    {
                    }
                }
                if (sessions.IsNullOrEmpty())
                {
                    InsertMessage("Couldn't load any event sessions");
                    return;
                }
                sessions = sessions.OrderByDescending(s => s.Start).ToList();
                var capturePickerVm = new CapturePickerViewModel
                {
                    CaptureSessions = new ObservableCollection <EventCaptureSession>(sessions)
                };
                var window = new CapturePickerWindow
                {
                    DataContext = capturePickerVm
                };
                capturePickerVm.OnOk += window.Close;
                var pickResult = window.ShowDialog();
                if (pickResult.HasValue && pickResult.Value && capturePickerVm.SelectedSession != null)
                {
                    Task.Run(() => _model.PlaySession(capturePickerVm.SelectedSession));
                }
            }
        }
        private void OnReplayCapture()
        {
            var dialog = new CommonOpenFileDialog
            {
                IsFolderPicker = true,
                Multiselect = false
            };

            //var fileDialog = new OpenFileDialog();
            //fileDialog.Filter = "Json Files (*.json)|*.json";
            //dialog.Filters.Add(new CommonFileDialogFilter("Json files",".json"));

            var res = dialog.ShowDialog();
            if (res == CommonFileDialogResult.Ok)
            {
                var dir = dialog.FileName;
                var jsonFiles = Directory.GetFiles(dir, "*.json");
                var sessions = new List<EventCaptureSession>();
                foreach (var jsonFile in jsonFiles)
                {
                    string json;
                    using (var reader = new StreamReader(File.OpenRead(jsonFile)))
                    {
                        json = reader.ReadToEnd();
                    }
                    try
                    {
                        var session = JsonConvert.DeserializeObject<EventCaptureSession>(json);
                        sessions.Add(session);
                    }
                    catch (Exception)
                    {

                    }
                }
                if (sessions.IsNullOrEmpty())
                {
                    InsertMessage("Couldn't load any event sessions");
                    return;
                }
                sessions=sessions.OrderByDescending(s => s.Start).ToList();
                var capturePickerVm = new CapturePickerViewModel
                {

                    CaptureSessions = new ObservableCollection<EventCaptureSession>(sessions)
                };
                var window = new CapturePickerWindow
                {
                    DataContext = capturePickerVm
                };
                capturePickerVm.OnOk += window.Close;
                var pickResult = window.ShowDialog();
                if (pickResult.HasValue && pickResult.Value && capturePickerVm.SelectedSession!=null)
                    Task.Run(() => _model.PlaySession(capturePickerVm.SelectedSession));
            }
        }