public LinksViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { Files = new ObservableCollection <TimeKeyGroup <TLMessageBase> >(); Status = AppResources.Loading; IsEmptyList = false; Items = new ObservableCollection <TLMessage>(); DisplayName = LowercaseConverter.Convert(AppResources.SharedLinks); EventAggregator.Subscribe(this); PropertyChanged += (o, e) => { if (Property.NameEquals(e.PropertyName, () => IsSelectionEnabled)) { if (!IsSelectionEnabled) { foreach (var item in Items) { item.IsSelected = false; } } } }; }
public CallsViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { DisplayName = LowercaseConverter.Convert(AppResources.Calls); Status = AppResources.Loading; FirstRun = true; }
public SearchMessagesViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { Items = new ObservableCollection <TLDialog>(); DisplayName = LowercaseConverter.Convert(AppResources.Messages); EventAggregator.Subscribe(this); }
public MediaViewModel(IFileManager downloadFileManager, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { IsEmptyList = false; Items = new ObservableCollection <MessagesRow>(); Media = new ObservableCollection <TimeKeyGroup <MessagesRow> >(); _downloadFileManager = downloadFileManager; DisplayName = LowercaseConverter.Convert(AppResources.Media); EventAggregator.Subscribe(this); }
public ContactsViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, IEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { Items = new AlphaKeyGroup <TLUserBase>("@"); _contacts = new ObservableCollection <AlphaKeyGroup <TLUserBase> >(); _contacts.Add((AlphaKeyGroup <TLUserBase>)Items); DisplayName = LowercaseConverter.Convert(AppResources.Contacts); Status = AppResources.Loading; EventAggregator.Subscribe(this); }
public ContactsViewModel(IFileManager fileManager, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { _fileManager = fileManager; Items = new AlphaKeyGroup <TLUserBase>("@"); _contacts = new ObservableCollection <AlphaKeyGroup <TLUserBase> > { (AlphaKeyGroup <TLUserBase>)Items }; DisplayName = LowercaseConverter.Convert(AppResources.Contacts); Status = AppResources.Loading; }
private void UpdateArchivedSetsString(int count) { if (count == 0) { ArchivedStickersSubtitle = LowercaseConverter.Convert(AppResources.NoSets); } else if (count > 0) { ArchivedStickersSubtitle = Language.Declension( count, AppResources.SetNominativeSingular, AppResources.SetNominativePlural, AppResources.SetGenitiveSingular, AppResources.SetGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } }
private void UpdateBlockedUsersString(int count) { _blockedUsersCount = count; if (count == 0) { BlockedUsersSubtitle = LowercaseConverter.Convert(AppResources.NoUsers); } else if (count > 0) { BlockedUsersSubtitle = Language.Declension( count, AppResources.UserNominativeSingular, AppResources.UserNominativePlural, AppResources.UserGenitiveSingular, AppResources.UserGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } }
public ContactDetailsViewModel(IVoIPService voipService, IFileManager fileManager, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { _voipService = voipService; Spans = new List <TimerSpan> { new TimerSpan(AppResources.Enabled, string.Empty, 0, AppResources.Enabled), new TimerSpan(AppResources.HourNominativeSingular, "1", (int)TimeSpan.FromHours(1.0).TotalSeconds, string.Format(AppResources.MuteFor, string.Format("{0} {1}", "1", AppResources.HourNominativeSingular).ToLowerInvariant())), new TimerSpan(AppResources.HourGenitivePlural, "8", (int)TimeSpan.FromHours(8.0).TotalSeconds, string.Format(AppResources.MuteFor, string.Format("{0} {1}", "8", AppResources.HourGenitivePlural).ToLowerInvariant())), new TimerSpan(AppResources.DayNominativePlural, "2", (int)TimeSpan.FromDays(2.0).TotalSeconds, string.Format(AppResources.MuteFor, string.Format("{0} {1}", "2", AppResources.DayNominativePlural).ToLowerInvariant())), new TimerSpan(AppResources.Disabled, string.Empty, int.MaxValue, AppResources.Disabled), }; _selectedSpan = Spans[0]; _notificationTimer = new DispatcherTimer(); _notificationTimer.Interval = TimeSpan.FromSeconds(Constants.NotificationTimerInterval); _notificationTimer.Tick += OnNotificationTimerTick; _fileManager = fileManager; EventAggregator.Subscribe(this); DisplayName = LowercaseConverter.Convert(AppResources.Profile); Sounds = new List <string>(); PropertyChanged += (sender, args) => { if (Property.NameEquals(args.PropertyName, () => MuteUntil) && !_suppressUpdating) { UpdateNotifySettingsAsync(); } if (Property.NameEquals(args.PropertyName, () => SelectedSound) && !_suppressUpdating) { NotificationsViewModel.PlaySound(SelectedSound); UpdateNotifySettingsAsync(); } }; CalculateSecretChatParamsAsync(); }
public FilesViewModel(ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator) { DisplayName = LowercaseConverter.Convert(AppResources.SharedFiles); }
private string GetSubtitle() { var channel = With as TLChannel; if (channel != null) { if (channel.ParticipantsCount != null) { return(Language.Declension( channel.ParticipantsCount.Value, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural).ToLower(CultureInfo.CurrentUICulture)); } if (channel.IsMegaGroup) { return(AppResources.Loading.ToLowerInvariant()); } return(channel.IsPublic ? AppResources.PublicChannel.ToLowerInvariant() : AppResources.PrivateChannel.ToLowerInvariant()); } var user = With as TLUserBase; if (user != null) { return(GetUserStatus(user)); } var chat = With as TLChat; if (chat != null) { var participantsCount = chat.ParticipantsCount.Value; var onlineCount = chat.UsersOnline; var onlineString = onlineCount > 0 ? string.Format(", {0} {1}", chat.UsersOnline, AppResources.Online.ToLowerInvariant()) : string.Empty; var currentUser = CacheService.GetUser(new TLInt(StateService.CurrentUserId)); var isCurrentUserOnline = currentUser != null && currentUser.Status is TLUserStatusOnline; if (participantsCount == 1 || (onlineCount == 1 && isCurrentUserOnline)) { onlineString = string.Empty; } return(Language.Declension( participantsCount, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural).ToLower(CultureInfo.CurrentUICulture) + onlineString); } var forbiddenChat = With as TLChatForbidden; if (forbiddenChat != null) { return(LowercaseConverter.Convert(AppResources.YouWhereKickedFromTheGroup)); } var broadcastChat = With as TLBroadcastChat; if (broadcastChat != null) { var participantsCount = broadcastChat.ParticipantIds.Count; var onlineParticipantsCount = 0; foreach (var participantId in broadcastChat.ParticipantIds) { var participant = CacheService.GetUser(participantId); if (participant != null && participant.Status is TLUserStatusOnline) { onlineParticipantsCount++; } } var onlineString = onlineParticipantsCount > 0 ? string.Format(", {0} {1}", onlineParticipantsCount, AppResources.Online.ToLowerInvariant()) : string.Empty; return(Language.Declension( participantsCount, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural).ToLower(CultureInfo.CurrentUICulture) + onlineString); } return(string.Empty); }