Record At Will

Implementation of “Record At Will” button, that will allow you to toggle Live Recording from your application

Estimated reading time: 1 min

Last edited: 04 Nov 2019

RevDeBug API allows to add user interface option to enable or disable a continuous recording mode. Using it users can record all code and it’s state triggered by their actions “from-to” moment of their choosing (ie.a full testing scenario or a reproducible issue happening on production in a remote installation location).

Example - Record At Will button

First you need to add RevDeBug to your application. To do this, follow this chapter about API installation.

Now that RevDeBug has been added to your application, it is very important to rebuild your application. Otherwise you won’t be able to complete the next step.

After the successful rebuild, in the output folder there should be a file named RevDeBug.setup. Open it and make sure, that ConnectivityType value is Continuous

RevDeBug.setup
Repository.Port=42742;
Repository.Address=127.0.0.1;
Application.Name=Starter;
SolutionName=RDBShowRoom;
ConnectivityType=Continuous;
Release=;
BacklogSize=1000;
  

Application in Connectivity Type Continuous by default automatically records everything from the application start. This behaviour is controlled by the Recording Server which stores the recordings. As we would like the recording to start from the user defined moment in time the Recording Server need to have parameter CONTINUOUS_CONNECTION_STARTUP_MODE='crash' passed when launched. In case your Record Server is already running you must restart it with this parameter set

Now we can add a button, that will turn recording off and on:

MainWindow.xaml.cs

  private void Button_Click(object sender, RoutedEventArgs e){
    if (RevDeBug.Api.CrashRecorder.Api.IsActive) {
      RevDeBug.Api.CrashRecorder.Api.Deactivate();
    } 
    else {
      RevDeBug.Api.CrashRecorder.Api.Activate();
    }
  }
  

In order to show visual feedback to the user, whether RevDeBug is recording at the moment you can query IsActive property:

MainWindow.xaml.cs

  private void Button_Click(object sender, RoutedEventArgs e){
    if (RevDeBug.Api.CrashRecorder.Api.IsActive) {
      RevDeBug.Api.CrashRecorder.Api.Deactivate();
      } 
      else {
      RevDeBug.Api.CrashRecorder.Api.Activate();
    }

    NotifyPropertyChanged(nameof(RevDeBug.Api.CrashRecorder.Api.IsActive));
  }

  public bool IsRevDeBugRecording {
    get {
      return RevDeBug.Api.CrashRecorder.Api.IsActive;
    }
  }