Exemplo n.º 1
0
        public void Initialize(ISourceController sourceController, ITrackController trackController, ITagController tagController)
        {
            this.sourceController = sourceController;
            this.trackController  = trackController;
            this.tagController    = tagController;

            treeView.ItemsSource = boundSources;

            boundSources.Add(new DeviceCatalogSource {
                Name = "Devices"
            });

            var sources = sourceController.Search(new Dictionary <string, object> {
                { "Parent", null }
            });

            if (sources != null && sources.Count() > 0)
            {
                foreach (var source in sources)
                {
                    boundSources.Add(source);
                    LoadSourceChildren(source);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecViewControllers class.
        /// </summary>
        /// <param name="mouseController">Mouse controller.</param>
        /// <param name="sourceController">Source controller.</param>
        /// <param name="keyController">Key controller.</param>
        public ButtonSpecViewControllers(IMouseController mouseController,
                                         ISourceController sourceController,
                                         IKeyController keyController)
        {
            Debug.Assert(mouseController != null);
            Debug.Assert(sourceController != null);
            Debug.Assert(keyController != null);

            _mouseController  = mouseController;
            _sourceController = sourceController;
            _keyController    = keyController;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecViewControllers class.
        /// </summary>
        /// <param name="mouseController">Mouse controller.</param>
        /// <param name="sourceController">Source controller.</param>
        /// <param name="keyController">Key controller.</param>
        public ButtonSpecViewControllers(IMouseController mouseController,
            ISourceController sourceController,
            IKeyController keyController)
        {
            Debug.Assert(mouseController != null);
            Debug.Assert(sourceController != null);
            Debug.Assert(keyController != null);

            _mouseController = mouseController;
            _sourceController = sourceController;
            _keyController = keyController;
        }
Exemplo n.º 4
0
        public void Initialize(ISourceController sourceController, ITrackController trackController, ITagController tagController)
        {
            this.sourceController = sourceController;
            this.trackController = trackController;
            this.tagController = tagController;

            treeView.ItemsSource = boundSources;

            boundSources.Add(new DeviceCatalogSource { Name = "Devices" });

            var sources = sourceController.Search(new Dictionary<string, object> { { "Parent", null } });
            if (sources != null && sources.Count() > 0)
            {
                foreach (var source in sources)
                {
                    boundSources.Add(source);
                    LoadSourceChildren(source);
                }
            }
        }
Exemplo n.º 5
0
        static async Task <DownloadResult> DownloadFilesAsync(BuildConfig config, string buildFolder)
        {
            using (ISourceController ctrl = GetController(config))
            {
                using (LocalRepository rep = new LocalRepository(buildFolder, config.SiteId))
                {
                    ctrl.Initialize(config);

                    SourceRepository r = await ctrl.FetchAllFiles(config);

                    List <ISourceItem> remoteItems = r.Files;
                    var changes = rep.GetChanges(remoteItems).ToList();

                    var changeTypes = changes
                                      .Where(x => !x.RepositoryFile.IsDirectory)
                                      .GroupBy(x => x.Type);
                    foreach (var item in changeTypes)
                    {
                        Console.WriteLine("Changes {0}: {1}", item.Key, item.Count());
                    }

                    var updatedFiles = changes.Where(x => x.Type == ChangeType.Added || x.Type == ChangeType.Modified)
                                       .Select(x => x.RepositoryFile).Where(x => !x.IsDirectory).ToList();

                    foreach (var item in changes.Where(x => x.Type == ChangeType.Removed))
                    {
                        string filePath = item.RepositoryFile.FilePath;
                        if (File.Exists(filePath))
                        {
                            File.Delete(filePath);
                        }
                    }

                    foreach (var slice in updatedFiles.Slice(25))
                    {
                        var downloadList = slice.Select(x =>
                        {
                            string filePath          = rep.LocalFolder + x.Folder + "/" + x.Name;
                            System.IO.FileInfo finfo = new System.IO.FileInfo(filePath);
                            if (finfo.Exists)
                            {
                                finfo.Delete();
                            }
                            else
                            {
                                if (!finfo.Directory.Exists)
                                {
                                    finfo.Directory.Create();
                                }
                            }
                            x.FilePath = filePath;
                            return(ctrl.DownloadAsync(config, x, filePath));
                        });

                        await Task.WhenAll(downloadList);

                        rep.UpdateFiles(slice);
                    }

                    return(new DownloadResult {
                        LastVersion = r.LatestVersion,
                        UpdatedFiles = updatedFiles.Count()
                    });
                }
            }
        }