我有System.Window.Form.CheckBox数据绑定的问题.我有代码:
checkBox1.DataBindings.Add("Checked", _movementsBindingSource, "Moved", true);
Run Code Online (Sandbox Code Playgroud)
它工作,但我想反转checkBox1.Checked.如果Moved为true,则checked = false.你能帮我解决这个问题吗?
我有ObjectContext.SaveChanges方法的问题:
public void Save(Action<object, object> action)
{
EventAggregator.GetEvent<EntityServiceRequestingEvent>().Publish(true);
var bw = new BackgroundWorker();
var saved = false;
bw.DoWork += (o, ee) =>
{
ProgramStatusService.Status = Resources.DatabaseSavingMessage;
if (!CanSave())
{
throw new InvalidOperationException(
"You must not call Save when CanSave returns false.");
}
try
{
lock (Context)
{
Context.SaveChanges();
saved = true;
}
}
catch (ValidationException e)
{
MessageService.ShowError(null, string.Format(CultureInfo.CurrentCulture,
Resources.SaveErrorInvalidEntities,
e.Message));
}
catch (UpdateException e)
{
var innerException = e.InnerException as SqlException;
if (innerException != null && innerException.Number == 2601) …
Run Code Online (Sandbox Code Playgroud)