public override void LoadDataAsync(LoadCommand cmd, LoadDataAsyncParameters cmdParam, Action <PaneViewModelBase> success = null, Action <PaneViewModelBase, Exception> error = null) { base.LoadDataAsync(cmd, cmdParam, success, error); switch (cmd) { case LoadCommand.Load: using (var db = _dbContext.Open()) { Items.AddRange(db.Get <FtpConnection>().Select(c => new FtpConnectionItemViewModel(c))); } var add = new NewConnectionPlaceholderViewModel(); Items.Add(add); break; case LoadCommand.Restore: Save(cmdParam.Payload as FtpConnectionItemViewModel); ConnectedFtp = null; break; } if (success != null) { success.Invoke(this); } }
public override void LoadDataAsync(LoadCommand cmd, LoadDataAsyncParameters cmdParam, Action<PaneViewModelBase> success = null, Action<PaneViewModelBase, Exception> error = null) { base.LoadDataAsync(cmd, cmdParam, success, error); switch (cmd) { case LoadCommand.Load: using (var db = _dbContext.Open()) { Items.AddRange(db.Get<FtpConnection>().Select(c => new FtpConnectionItemViewModel(c))); } var add = new NewConnectionPlaceholderViewModel(); Items.Add(add); break; case LoadCommand.Restore: Save(cmdParam.Payload as FtpConnectionItemViewModel); ConnectedFtp = null; break; } if (success != null) success.Invoke(this); }