public MainViewModel(Controllers.ISparkSolutionController mainController) { // TÃtulo de la aplicación Text = mainController.AppName; // Asigna las propiedades Instance = this; MainController = mainController; Manager = new SolutionManager(mainController.Logger, mainController.Configuration.ConfigurationPath); // Inicializa los objetos SolutionViewModel = new Solutions.SolutionViewModel(this); // Inicializa el log LogViewModel = new Tools.LogListViewModel(this); // Asigna los comandos AddConnectionCommand = new BaseCommand(_ => SolutionViewModel.TreeConnectionsViewModel.OpenConnection(null)); AddFolderToExplorerCommand = new BaseCommand(_ => SolutionViewModel.TreeFoldersViewModel.AddFolderToExplorer()); SaveCommand = new BaseCommand(parameter => Save(false), parameter => CanSave()) .AddListener(this, nameof(SelectedDetailsViewModel)); SaveAsCommand = new BaseCommand(parameter => Save(true), parameter => CanSave()) .AddListener(this, nameof(SelectedDetailsViewModel)); RefreshCommand = new BaseCommand(parameter => Refresh()); }
public LogListItemViewModel(LogListViewModel listViewModel, string type, string content, BauMvvm.ViewModels.Media.MvvmColor color) : base(content, null, false, color) { // Asigna las propiedades ListViewModel = listViewModel; Type = type; Content = content; if (content.Length > 200) { Text = content.Substring(0, 200); } else { Text = content; } if (!string.IsNullOrWhiteSpace(Text)) { Text = Text.Replace("\r\n", " "); Text = Text.Replace("\r", " "); Text = Text.Replace("\n", " "); } CreatedAt = DateTime.Now; // Asigna los comandos ShowDetailsCommand = new BauMvvm.ViewModels.BaseCommand(_ => ShowDetails()); }