protected ViewModelBaseEx(IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IMessenger messenger = null) { MessengerInstance = messenger; ViewServices = viewServices ?? App.ViewServices; Session = App.Session; Settings = settingsRepo ?? App.Settings; }
public ProjectListViewModel( IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IProjectRepository projectRepo = null, IMessenger messenger = null ) : base( viewServices, settingsRepo, messenger ) { ProjectRepo = projectRepo ?? new ProjectRepository( Session ); Projects = new ObservableCollection<ProjectViewModel>( ProjectRepo.GetAll().OrderBy( p => p.Name ).Select( p => new ProjectViewModel( p ) ) ); var last = Settings.GetById( SettingKeys.LastProject ); CurrentProject = Projects.FirstOrDefault( p => p.Model.Id == last.Get<int>() ) ?? Projects.FirstOrDefault(); foreach( var proj in Projects ) { proj.CurrentChanged += Proj_CurrentChanged; } if( CurrentProject != null ) { CurrentProject.IsCurrent = true; } ProjectNames = new List<string>(); Validate( nameof( NewProjectName ) ).Check( () => !string.IsNullOrWhiteSpace( NewProjectName ) ).Message( Strings.ProjectMustHaveName ); Validate( nameof( NewProjectName ) ).Check( () => !ProjectNames.Contains( NewProjectName ) ).Message( Strings.ThisNameIsAlreadyUsed ); Reset(); }
public ProjectListViewModel(IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IProjectRepository projectRepo = null, IMessenger messenger = null) : base(viewServices, settingsRepo, messenger) { ProjectRepo = projectRepo ?? new ProjectRepository(Session); Projects = new ObservableCollection <ProjectViewModel>(ProjectRepo.GetAll().OrderBy(p => p.Name).Select(p => new ProjectViewModel(p))); var last = Settings.GetById(SettingKeys.LastProject); CurrentProject = Projects.FirstOrDefault(p => p.Model.Id == last.Get <int>()) ?? Projects.FirstOrDefault(); foreach (var proj in Projects) { proj.CurrentChanged += Proj_CurrentChanged; } if (CurrentProject != null) { CurrentProject.IsCurrent = true; } ProjectNames = new List <string>(); Validate(nameof(NewProjectName)).Check(() => !string.IsNullOrWhiteSpace(NewProjectName)).Message(Strings.ProjectMustHaveName); Validate(nameof(NewProjectName)).Check(() => !ProjectNames.Contains(NewProjectName)).Message(Strings.ThisNameIsAlreadyUsed); Reset(); }
protected ViewModelBaseEx( IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IMessenger messenger = null ) { MessengerInstance = messenger; ViewServices = viewServices ?? App.ViewServices; Session = App.Session; Settings = settingsRepo ?? App.Settings; }
public ViewModelContainer( IViewServiceRepository viewServices, IMessenger messenger, IBackgroundRunner backgroundRunner, ILanguageProvider languageProvider ) { ViewServices = viewServices; Messenger = messenger; BackgroundRunner = backgroundRunner; LanguageProvider = languageProvider; }
public SettingsViewModel( IViewServiceRepository viewServices, ISettingsRepository settingsRepo = null, IAppThemes themes = null, IStartupConfigurator startup = null ) : base( viewServices, settingsRepo ) { Themes = themes ?? new AppThemes(); Startup = startup ?? new StartupConfigurator(); AvailableAccents = Themes.Accents.ToList(); AvailableThemes = Themes.Themes.ToList(); ResxLocalizationProvider.Instance.UpdateCultureList( GetType().Assembly.FullName, "Strings" ); IEnumerable<CultureInfo> languages = ResxLocalizationProvider.Instance.AvailableCultures; languages = languages.Where( l => !Equals( l, CultureInfo.InvariantCulture ) ); AvailableLanguages = new List<CultureInfo>( languages.OrderBy( l => l.NativeName ) ); }
public ScheduleItem(SchedulerJob job, UserViewModel user, IScheduler scheduler, IConfig config, IViewServiceRepository viewServices) : base(config, viewServices) { Job = job; User = user; Scheduler = scheduler; ViewServices = viewServices; Entities = new Entities { HashTagEntities = EntityParser.ExtractHashtags(job.Text), MediaEntities = new List <MediaEntity>(), SymbolEntities = new List <SymbolEntity>(), UrlEntities = new List <UrlEntity>(), UserMentionEntities = EntityParser.ExtractMentions(job.Text) }; }
public SettingsViewModel(IViewServiceRepository viewServices, ISettingsRepository settingsRepo = null, IAppThemes themes = null, IStartupConfigurator startup = null) : base(viewServices, settingsRepo) { Themes = themes ?? new AppThemes(); Startup = startup ?? new StartupConfigurator(); AvailableAccents = Themes.Accents.ToList(); AvailableThemes = Themes.Themes.ToList(); ResxLocalizationProvider.Instance.UpdateCultureList(GetType().Assembly.FullName, "Strings"); IEnumerable <CultureInfo> languages = ResxLocalizationProvider.Instance.AvailableCultures; languages = languages.Where(l => !Equals(l, CultureInfo.InvariantCulture)); AvailableLanguages = new List <CultureInfo>(languages.OrderBy(l => l.NativeName)); }
public ScheduleItem(SchedulerJob job, UserViewModel user, IScheduler scheduler, IConfig config, IViewServiceRepository viewServices) : base(config, viewServices) { Job = job; User = user; Scheduler = scheduler; ViewServices = viewServices; Entities = new Entities { HashTagEntities = EntityParser.ExtractHashtags(job.Text), MediaEntities = new List <MediaEntity>(), SymbolEntities = new List <SymbolEntity>(), UrlEntities = new List <UrlEntity>(), UserMentionEntities = EntityParser.ExtractMentions(job.Text) }; BlockUserCommand = new LogMessageCommand("Tried to block user from ScheduleItem", LogLevel.Warn); ReportSpamCommand = new LogMessageCommand("Tried to report user from ScheduleItem", LogLevel.Warn); }
public Notifier(IConfig config, IMessenger messenger, IDispatcher dispatcher, IViewServiceRepository viewServices) { Dispatcher = dispatcher; MessengerInstance = messenger; Config = config; ViewServices = viewServices; if (config.Notifications.SoundEnabled) { Player = new MediaPlayer(); string soundFileName = File.Exists(config.Notifications.SoundFileName) ? config.Notifications.SoundFileName : ResourceHelper.GetDefaultNotificationSound(); Player.Open(new Uri(soundFileName)); } if (config.Notifications.PopupEnabled) { PopupNotify = new NotifyIcon(); } }
public StatusViewModel(Status model, IContextEntry context, IConfig config, IViewServiceRepository viewServiceRepo) : base(config, viewServiceRepo) { Context = context; Model = model; OriginalStatus = Model; if (OriginalStatus.RetweetedStatus != null && OriginalStatus.RetweetedStatus.StatusID != 0) { Model = OriginalStatus.RetweetedStatus; SourceUser = new UserViewModel(OriginalStatus.User); } else { Model = OriginalStatus; SourceUser = null; } HasSensibleContent = config?.General?.FilterSensitiveTweets == true && Model.PossiblySensitive; User = new UserViewModel(Model.User); Dispatcher = new DispatcherHelperWrapper(); RetweetedBy = new SmartCollection <UserViewModel>(); }
public StatusViewModel(Status model, IContextEntry context, IConfig config, IViewServiceRepository viewServiceRepo) { Config = config; Context = context; ViewServiceRepository = viewServiceRepo; Model = model; OriginalStatus = Model; if (OriginalStatus.RetweetedStatus != null && OriginalStatus.RetweetedStatus.StatusID != 0) { Model = OriginalStatus.RetweetedStatus; SourceUser = new UserViewModel(OriginalStatus.User); } else { Model = OriginalStatus; SourceUser = null; } User = new UserViewModel(Model.User); Dispatcher = new DispatcherHelperWrapper(); RetweetedBy = new SmartCollection <UserViewModel>(); }
public MainViewModel(IDatabaseConnector connector, IViewServiceRepository viewServices = null, ITaskRunner taskRunner = null, IProcessStarter procStarter = null, IMessenger messenger = null, IProjectListViewModel projectList = null, ISettingsRepository settingsRepo = null) : base(viewServices, settingsRepo, messenger) { var dbConnector = connector ?? Application.Current as IDatabaseConnector; Debug.Assert(dbConnector != null); var runner = taskRunner ?? new TaskRunner(); ProcStarter = procStarter ?? new ProcessStarter(); IsLoading = true; runner.Run(() => { dbConnector.ConnectToDatabase(); ProjectList = projectList ?? new ProjectListViewModel(ViewServices, Settings); TagList = new TagListViewModel(ProjectList); Searcher = new EntrySearcher(ProjectList); }).ContinueWith(t => { ExpandEntries = Settings.GetById(SettingKeys.ExpandEntries).Get <bool>(); // ReSharper disable ExplicitCallerInfoArgument RaisePropertyChanged(nameof(ProjectList)); RaisePropertyChanged(nameof(TagList)); RaisePropertyChanged(nameof(Searcher)); // ReSharper restore ExplicitCallerInfoArgument IsLoading = false; CommandManager.InvalidateRequerySuggested(); }); }
public BackgroundRunner( IViewServiceRepository viewServices ) { ViewServices = viewServices; }
public MessageViewModel(DirectMessage model, IContextEntry context, IConfig config, IViewServiceRepository viewServices) : base(config, viewServices) { Model = model; Context = context; User = new UserViewModel(model.Sender); Partner = new UserViewModel(model.SenderID == context.UserId ? model.Recipient : model.Sender); IsIncoming = Model.SenderID != context.UserId; }
protected ValidationViewModel(IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IMessenger messenger = null) : base(viewServices, settingsRepo, messenger) { }
protected ColumnItem(IConfig config, IViewServiceRepository viewServiceRepo) { Config = config; ViewServiceRepository = viewServiceRepo; }
public MessageViewModel(DirectMessage model, IContextEntry context, IConfig config, IViewServiceRepository viewServices) : base(config, viewServices) { Model = model; Context = context; User = new UserViewModel(model.Sender); Partner = new UserViewModel(model.SenderID == context.UserId ? model.Recipient : model.Sender); IsIncoming = Model.SenderID != context.UserId; BlockUserCommand = new LogMessageCommand("Tried to block user from MessageViewModel", LogLevel.Warn); ReportSpamCommand = new LogMessageCommand("Tried to report user from MessageViewModel", LogLevel.Warn); }
protected ValidationViewModel( IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IMessenger messenger = null ) : base(viewServices, settingsRepo, messenger) { }
public DatabasePathViewModel(IViewServiceRepository viewServiceRepo) : base(viewServiceRepo) { Validate(nameof(Path)).Check(() => !string.IsNullOrWhiteSpace(Path)).Message(Strings.MustEnterValidPath); ClearValidationErrors(); }
private static void SetupViewServices() { ViewServices = new ViewServiceRepository(); ViewServices.Register<IConfirmationService>( new ConfirmationService() ); ViewServices.Register<IInfoService>( new InfoService() ); ViewServices.Register<IMoveDatabaseService>( new MoveDatabaseService() ); ViewServices.Register<IBrowseFileService>( new BrowseFileService() ); ViewServices.Register<IProgressService>( new ProgressService() ); }
public DatabasePathViewModel( IViewServiceRepository viewServiceRepo ) : base( viewServiceRepo ) { Validate( nameof( Path ) ).Check( () => !string.IsNullOrWhiteSpace( Path ) ).Message( Strings.MustEnterValidPath ); ClearValidationErrors(); }