public LogViewModelWrapper(LogViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            Dispatch = Dispatcher.CurrentDispatcher;
            ClearCommand = new DelegateCommand(ClearFunc, CanClearFunc);
            m_readOnlyUnits = new ReadOnlyObservableCollection<LogInfo>(m_units);
            m_model = model;

            // Pre-fill our units with what's in the workspace view model prior to exposing it
            // this is a mild performance tweak.
            foreach (LogInfo unit in model.Events)
            {
                AddUnit(unit);
            }

            INotifyCollectionChanged logEventsCollection = m_model.Events;
            logEventsCollection.CollectionChanged += EventsCollectionChanged;
        }
예제 #2
0
            internal OutputControlTarget(LogViewModel model)
                : base()
            {
                m_model = model;

                if (String.IsNullOrWhiteSpace(model.ExperimentId) == false)
                {
                    Name = m_model.ExperimentId.ToString();
                }
                else
                {
                    Name = new Guid().ToString();
                }
            }
예제 #3
0
 public LogViewModel(string experimentId, LogViewModel oldModel) : this(experimentId)
 {
     if (oldModel != null)
     {
         foreach (LogInfo logEvent in oldModel.m_events)
         {
             m_events.Add(logEvent);
         }
     }
 }
 private void SetLogViewModel(LogViewModel logViewModel) 
 {
     if(m_logViewModel != null) 
     {
         //detach handlers
         ((INotifyCollectionChanged)m_logViewModel.Events).CollectionChanged -= EventsCollectionChanged;
         m_logStore.Clear();
     }
     
     m_logViewModel = logViewModel;
     
     // Load existing tasks
     foreach(LogInfo logInfo in m_logViewModel.Events) 
     {
         AddEventUnit(logInfo);
     }
     
     //attach listener to Events collection, so that view is updated anytime there is new log message in the collection
     ((INotifyCollectionChanged)m_logViewModel.Events).CollectionChanged += EventsCollectionChanged;
 }