Example #1
0
 public bool RequestVariables(string expName, Action <Dictionary <int, double> > callback,
                              int userPermissionLevel = 0)
 {
     if (!Started)
     {
         return(false);
     }
     if (!Experiments.ContainsKey(expName))
     {
         throw new InvalidOperationException(string.Format("Unknown experiment: {0}", expName));
     }
     variableRequests.Enqueue(new VariablesRequest(expName, callback, userPermissionLevel));
     return(true);
 }
Example #2
0
 public void RemoveExperiment(string experimentName, int userPermissionLevel = 0)
 {
     #region Preconditions
     if (userPermissionLevel < MinUserLevelToAdmin)
     {
         throw new SecurityException("Cannot remove experiment with current user permission");
     }
     if (Started)
     {
         throw new InvalidOperationException("Cannot remove experiment to running server");
     }
     if (!Experiments.ContainsKey(experimentName))
     {
         throw new InvalidOperationException("Cannot remove unexisting experiment");
     }
     #endregion
     Experiments.Remove(experimentName);
 }