示例#1
0
 private async void DocumentSaved(object sender, TextDocumentFileActionEventArgs e)
 {
     if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
     {
         await SpriteService.GenerateSprite(e.FilePath);
     }
 }
 private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e)
 {
     if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
     {
         SpriteService.GenerateSpriteAsync(e.FilePath).ConfigureAwait(false);
     }
 }
示例#3
0
        protected override void Initialize()
        {
            Logger.Initialize(this, Vsix.Name);

            SpriteService.Initialize();
            CreateSpriteCommand.Initialize(this);
            UpdateSpriteCommand.Initialize(this);
            UpdateAllSpritesCommand.Initialize(this);

            base.Initialize();
        }
示例#4
0
        protected override async task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await Logger.InitializeAsync(this, Vsix.Name);

            await SpriteService.Initialize();

            var commandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            await JoinableTaskFactory.SwitchToMainThreadAsync();

            CreateSpriteCommand.Initialize(commandService);
            UpdateSpriteCommand.Initialize(commandService);
            UpdateAllSpritesCommand.Initialize(commandService);
        }
        private async void Execute(object sender, EventArgs e)
        {
            string folder = _project != null?_project.GetRootFolder() : Path.GetDirectoryName(_solution.FileName);

            if (!Directory.Exists(folder))
            {
                return;
            }

            List <string> files = GetFiles(folder, "*" + Constants.FileExtension);

            foreach (string file in files)
            {
                await SpriteService.GenerateSpriteAsync(file);
            }
        }
示例#6
0
        private async void Execute(object sender, EventArgs e)
        {
            string folder = _project != null?_project.GetRootFolder() : Path.GetDirectoryName(_solution.FileName);

            if (!Directory.Exists(folder))
            {
                return;
            }

            var files = GetFiles(folder, "*.sprite");

            foreach (var file in files)
            {
                await SpriteService.GenerateSprite(file);
            }
        }
        private async void Execute(object sender, EventArgs e)
        {
            var    files  = GetFiles();
            var    folder = Path.GetDirectoryName(files.First());
            string spriteFile;

            if (GetFileName(folder, out spriteFile))
            {
                var doc = new SpriteDocument(spriteFile, files);
                doc.Stylesheet = Stylesheet.Css;

                await doc.Save();

                ProjectHelpers.DTE.ItemOperations.OpenFile(doc.FileName);
                await SpriteService.GenerateSprite(doc);
            }
        }
        private void Execute(object sender, EventArgs e)
        {
            IEnumerable <string> files = GetFiles();
            string folder = Path.GetDirectoryName(files.First());

            if (GetFileName(folder, out string spriteFile))
            {
                var doc = new SpriteDocument(spriteFile, files)
                {
                    Stylesheet = Stylesheet.Css
                };

                ThreadHelper.JoinableTaskFactory.Run(async() =>
                {
                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    await doc.Save();
                    ProjectHelpers.DTE.ItemOperations.OpenFile(doc.FileName);
                    await SpriteService.GenerateSpriteAsync(doc);
                });
            }
        }
示例#9
0
 private async void Execute(object sender, EventArgs e)
 {
     var files = ProjectHelpers.GetSelectedItemPaths();
     await SpriteService.GenerateSprite(files.First());
 }
 private async void Execute(object sender, EventArgs e)
 {
     System.Collections.Generic.IEnumerable <string> files = ProjectHelpers.GetSelectedItemPaths();
     await SpriteService.GenerateSpriteAsync(files.First());
 }