public CommandBindingViewModel(IInputProvider provider, CommandBindingEntry entry) { if (provider == null) throw new ArgumentNullException ("provider"); this.provider = provider; Input = entry.Input; ProviderType = entry.ProviderType; Command = entry.Command; }
public static void Create(CommandBindingEntry bindingEntry) { if (bindingEntry == null) { throw new ArgumentNullException("bindingEntry"); } using (var cmd = db.CreateCommand()) { cmd.CommandText = "INSERT INTO commandbindings (commandbindingProvider,commandbindingCommand,commandbindingInput) VALUES (?,?,?)"; cmd.Parameters.Add(new SQLiteParameter("provider", bindingEntry.ProviderType)); cmd.Parameters.Add(new SQLiteParameter("command", (int)bindingEntry.Command)); cmd.Parameters.Add(new SQLiteParameter("input", bindingEntry.Input)); cmd.ExecuteNonQuery(); } }