public void Function(ScalarValue digits) { var n = digits.GetIntegerOrThrowException("digits", Name); Context.Precision = n; Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Information, "Output precision changed to " + Context.Precision + " digits.")); }
public void Function(PlotValue plot, MatrixValue series, StringValue property, Value newValue) { var s = new List <string>(); if (series is RangeValue) { var r = series as RangeValue; var step = (int)r.Step; var end = r.All ? plot.Count : (int)r.End; for (var j = (int)r.Start; j <= end; j += step) { s.Add(j.ToString()); AlterSeriesProperty(plot, j - 1, property.Value, newValue); } } else { var end = series.Length; for (var i = 1; i <= end; i++) { var n = series[i].GetIntegerOrThrowException("series", Name); s.Add(n.ToString()); AlterSeriesProperty(plot, n - 1, property.Value, newValue); } } Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Failure, "Series " + string.Join(", ", s.ToArray()) + " changed.")); plot.UpdateProperties(); }
public void Function(StringValue type) { var stec = new StringToEnumConverter(typeof(DisplayStyle)); var value = stec.Convert(type); Context.DefaultDisplayStyle = (DisplayStyle)value; Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Information, "Display format changed to " + value + ".")); }
public void Function(PlotValue plot, StringValue property, Value newValue) { var propertyName = property.Value; AlterProperty(plot, propertyName, newValue); plot.RaisePlotChanged(propertyName); Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Success, "Property changed")); }
public void Function(MatrixValue series, StringValue property, Value newValue) { if (Context.LastPlot == null) { Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Failure, "No plot available... Nothing changed.")); } else { Function(Context.LastPlot, series, property, newValue); } }
public void Function(ScalarValue timeout) { var n = timeout.GetIntegerOrThrowException("timeout", Name); var start = Environment.TickCount; using (var blocking = new ManualResetEvent(false)) { blocking.WaitOne(n); } var time = Environment.TickCount - start; Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Information, "Slept " + time + "ms.")); }
public void Function(PlotValue plot, ScalarValue series, StringValue property, Value newValue) { if (plot.Count == 0) { throw new YAMPNoSeriesAvailableException("The given plot contains no series."); } var n = series.GetIntegerOrThrowException("series", Name); if (n < 1 || n > plot.Count) { throw new YAMPArgumentRangeException("series", 1, plot.Count); } AlterSeriesProperty(plot, n - 1, property.Value, newValue); plot.UpdateProperties(); Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Success, "Series " + n + " changed.")); }
public void Function(StringValue path) { var p = path.Value; if (!Path.IsPathRooted(path.Value)) { p = Path.Combine(Environment.CurrentDirectory, path.Value); } if (!Directory.Exists(path.Value)) { Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Failure, "The directory " + p + " could not be found.")); } else { Environment.CurrentDirectory = path.Value; } }
void Notify(int count) { Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Information, count + " objects cleared.")); }
public void Function(StringValue text, ArgumentsValue args) { var content = string.Format(text.Value, args.ToArray()); Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Message, content)); }
void Notify(int count) { Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Success, count + " objects loaded.")); }
public void Function(StringValue source, StringValue target) { File.Copy(source.Value, target.Value); Parser.RaiseNotification(Context, new NotificationEventArgs(NotificationType.Success, string.Format("Copied {0} to {1}.", source.Value, target.Value))); }