예제 #1
0
 public SettingsViewModel(IConfigSerializer configSerializer, INotificationService notificationService)
 {
     Title                = "Settings";
     _dispatcher          = Dispatcher.CurrentDispatcher;
     _configSerializer    = configSerializer;
     _notificationService = notificationService;
     _platformProvider    = ServiceLocator.Current.GetInstance <IPlatformProvider>();
     Config               = configSerializer.GetConfig();
     Commands             = UICommand.GenerateFromMessageButton(MessageButton.OKCancel, new DialogService(), MessageResult.OK, MessageResult.Cancel);
     Commands.Single(c => c.IsDefault).Command = new DelegateCommand(Save, AllowDialogButtons);
     Commands.Single(c => c.IsCancel).Command  = new DelegateCommand(Cancel, AllowDialogButtons);
 }
예제 #2
0
        public RepositoryModel(Repository source, IPlatformInfo platform, INotificationService notificationService)
        {
            Repository           = source;
            Version              = Repository.Version;
            _notificationService = notificationService;
            Path        = Repository.Path;
            _dispatcher = Dispatcher.CurrentDispatcher;
            var platformProvider = ServiceLocator.Current.GetInstance <IPlatformProvider>();

            _platform = platform;
            UpdateDownloadState();
        }
예제 #3
0
        public static void ActualizeRepositories(IPlatformInfo platform, ICollection <RepositoryModel> repositories, INotificationService notificationService, string filePath)
        {
            var savedVersions = repositories.Select(r => r.Version).ToList();

            foreach (var ver in RepositoryLoader.GetVersions(platform).Where(v => !savedVersions.Contains(v)))
            {
                foreach (var directoryPath in Directory.GetDirectories(filePath))
                {
                    var dirName   = System.IO.Path.GetFileName(directoryPath);
                    var localPath = string.Format(platform.LocalPath, ver);
                    if (dirName != localPath)
                    {
                        continue;
                    }
                    if (!File.Exists(directoryPath + "\\VisualTestsConfig.xml"))
                    {
                        continue;
                    }
                    var repository = new RepositoryModel(Repository.CreateRegular(platform.Name, ver, directoryPath + "\\"), platform, notificationService);
                    repositories.Add(repository);
                    InitializeLinks(platform, repository.Path, repository.Version);
                }
            }
        }