Esempio n. 1
0
 /// <summary>
 /// Reload the LogEntryRowViewModels then update counters and update the selectedlogitem
 /// </summary>
 /// <param name="repositories">Repositories containing the entries</param>
 public void SetEntries(List <RepositoryViewModel> repositories)
 {
     Application.Current.Dispatcher.Invoke(
         DispatcherPriority.Normal,
         (Action) delegate
     {
         RemoveAllItems();
         foreach (RepositoryViewModel repo in repositories)
         {
             if (repo.Active)
             {
                 foreach (LogEntry entry in repo.Repository.LogEntries)
                 {
                     var entryRow = new LogEntryRowViewModel(entry);
                     entryRow.UpdateTextMarkerQuantity();
                     LogEntryRowViewModels.Add(entryRow);
                 }
             }
         }
         SelectedLogItem = LogEntryRowViewModels.Any()
                                               ? LogEntryRowViewModels.Last()
                                               : null;
         UpdateCounters();
     });
 }
Esempio n. 2
0
        private object CommandUpdateDeltaExecute(object arg)
        {
            var list = arg as IEnumerable <LogEntryRowViewModel>;

            if (list != null)
            {
                // We sure has 2 and only 2 entries
                List <LogEntryRowViewModel> logEntryRowViewModels = list as List <LogEntryRowViewModel> ?? list.ToList();
                LogEntryRowViewModel        entry1 = logEntryRowViewModels.ElementAt(0);
                LogEntryRowViewModel        entry2 = logEntryRowViewModels.ElementAt(1);
                CalculatedDelta = String.Concat("between GuId : ", entry1.Entry.GuId, " and GuId : ", entry2.Entry.GuId,
                                                " = ",
                                                GlobalHelper.GetTimeDelta(entry1.Entry.TimeStamp, entry2.Entry.TimeStamp));
            }
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Keep the Actual selected logitems then refresh the view and reset the selected log item
        /// </summary>
        public void RefreshView()
        {
            LogEntryRowViewModel l = SelectedLogItem;

            SelectedLogItem = null;
            if (LogView != null)
            {
                LogView.Refresh();
                RaisePropertyChanged(PROP_LogView);

                // Attempt to restore selected item if there was one before
                // and if it is not part of the filtered set of items
                // (ScrollItemBehaviour may scroll it into view when filter is applied)
                if (l != null)
                {
                    if (OnFilterLogItems(l))
                    {
                        SelectedLogItem = l;
                    }
                }
            }
            UpdateFilteredCounters(LogView);
            CommandManager.InvalidateRequerySuggested();
        }