private static string GetTransmissionName(TransmissionEvent transmissionEvent) { if (transmissionEvent is ImmediatelyTransmissionEvent) { return((string)Application.Current.Resources["Immediately"]); } if (transmissionEvent is DateTimeTransmissionEvent) { return((string)Application.Current.Resources["DateAndTime"] + $" ({((DateTimeTransmissionEvent) transmissionEvent).DateTime.ToLocalTime()})"); } if (transmissionEvent is OnJoinTransmissionEvent) { return((string)Application.Current.Resources["OnJoin"]); } if (transmissionEvent is RepeatingTransmissionEvent) { return((string)Application.Current.Resources["Repeating"] + $" ({((int) ((RepeatingTransmissionEvent) transmissionEvent).TimeSpan.TotalHours):00}:{((RepeatingTransmissionEvent) transmissionEvent).TimeSpan.Minutes:00}:{((RepeatingTransmissionEvent) transmissionEvent).TimeSpan.Seconds:00})"); } if (transmissionEvent is EveryClientOnceTransmissionEvent) { return((string)Application.Current.Resources["EveryClientOnce"]); } return(null); }
public async Task <bool> ExecuteCommand(StaticCommand staticCommand, TransmissionEvent transmissionEvent, ExecutionEvent executionEvent, StopEvent stopEvent, List <Condition> conditions, CommandTarget target) { if (conditions != null && conditions.Count == 0) { conditions = null; } var plugin = StaticCommands[staticCommand.GetType()]; if (plugin != null) { if (!await UploadPluginToServer(plugin)) { return(false); } } _connectionManager.SendCommand(new DynamicCommand { CommandId = staticCommand.CommandId, Target = target, Conditions = conditions, TransmissionEvent = transmissionEvent, ExecutionEvent = executionEvent, CommandParameter = staticCommand.GetCommandParameter().Data, PluginHash = plugin?.PluginHash, StopEvent = stopEvent }); return(true); }
public void OkButtonClick(CommandTarget commandTarget, TransmissionEvent transmissionEvent, ExecutionEvent executionEvent, StopEvent stopEvent) { CommandTarget = commandTarget; TransmissionEvent = transmissionEvent; ExecutionEvent = executionEvent; StopEvent = stopEvent; DialogResult = true; }
public void ExecuteCommand(StaticCommand staticCommand, TransmissionEvent transmissionEvent, ExecutionEvent executionEvent, List <Condition> conditions, CommandTarget target) { if (conditions != null && conditions.Count == 0) { conditions = null; } _serverConnection.SendCommand(new DynamicCommand { CommandId = staticCommand.CommandId, Target = target, Conditions = conditions, TransmissionEvent = transmissionEvent, ExecutionEvent = executionEvent, CommandParameter = staticCommand.GetCommandParameter().Data, PluginHash = null }); }
private DateTime GetNextTime(TransmissionEvent transmissionEvent) { var dateTimeEvent = transmissionEvent as DateTimeTransmissionEvent; if (dateTimeEvent != null) { return(dateTimeEvent.DateTime); } var repeatingEvent = transmissionEvent as RepeatingTransmissionEvent; if (repeatingEvent != null) { return (repeatingEvent.DayZero.AddMilliseconds(repeatingEvent.TimeSpan.TotalMilliseconds * Math.Ceiling( (DateTime.UtcNow - repeatingEvent.DayZero).TotalMilliseconds / repeatingEvent.TimeSpan.TotalMilliseconds))); } throw new InvalidOperationException(nameof(transmissionEvent)); }
public Task <bool> ExecuteCommand(StaticCommand staticCommand, TransmissionEvent transmissionEvent, ExecutionEvent executionEvent, StopEvent stopEvent, List <Condition> conditions, CommandTarget target) { return(Task.FromResult(true)); }