Пример #1
0
		public ConfirmationViewModel(JournalItem journalItem)
		{
			Title = "Подтверждение критических событий";
			ConfirmCommand = new RelayCommand(OnConfirm);
			JournalItemViewModel = new JournalItemViewModel(journalItem);

			if (parentWindow == null)
				parentWindow = DialogService.GetActiveWindow();
        }
Пример #2
0
		void OnCallbackOperationResult(CallbackOperationResult callbackOperationResult)
		{
			if (callbackOperationResult.CallbackOperationResultType == CallbackOperationResultType.GetJournal && callbackOperationResult.ClientUid == _uid)
			{
				ApplicationService.BeginInvoke(() =>
				{
					JournalItems = new ObservableCollection<JournalItemViewModel>();
					if (callbackOperationResult.JournalItems != null)
					foreach (var journalItem in callbackOperationResult.JournalItems)
					{
						var journalItemViewModel = new JournalItemViewModel(journalItem);
						JournalItems.Add(journalItemViewModel);
					}
					SelectedJournal = JournalItems.FirstOrDefault();
					IsLoading = false;
				});
			}
		}
Пример #3
0
		void OnNewJournalItems(List<JournalItem> journalItems)
		{
			foreach (var journalItem in journalItems)
			{
				if (!CheckFilter(journalItem))
					continue;

				var journalItemViewModel = new JournalItemViewModel(journalItem);
				if (JournalItems.Count > 0)
					JournalItems.Insert(0, journalItemViewModel);
				else
					JournalItems.Add(journalItemViewModel);

				if (JournalItems.Count > Filter.LastItemsCount)
					JournalItems.RemoveAt(Filter.LastItemsCount);
			}

			if (SelectedJournal == null)
				SelectedJournal = JournalItems.FirstOrDefault();

			_unreadCount += journalItems.Count;
			UpdateUnread();
		}