Пример #1
0
        private SessionViewModel CreateOrRefreshSessionViewModel(ILog log)
        {
            log.Deleted += OnLogDeleted;
            var viewModel = Sessions.FirstOrDefault(session => session.Log.Equals(log));

            if (viewModel == null)
            {
                viewModel = new SessionViewModel(log, _cmdGen);
                viewModel.ConfirmationRequest.Raised += (sender, args) => _confirmationRequest.Delegate(args);
                RegisterSubViewModel(viewModel);
            }
            else
            {
                viewModel.Refresh();
            }
            return(viewModel);
        }