Example #1
0
        private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var button = (OleMenuCommand)sender;
            var items  = ProjectHelpers.GetSelectedItems();

            button.Visible = false;

            if (items.Count() != 1)
            {
                return;
            }

            var item = items.FirstOrDefault();

            if (item == null || item.ContainingProject == null || item.Properties == null)
            {
                return;
            }

            var sourceFile = item.Properties.Item("FullPath").Value.ToString();

            if (!WebCompiler.CompilerService.IsSupported(sourceFile))
            {
                return;
            }

            string configFile = item.ContainingProject.GetConfigFile();

            _configs = ConfigFileProcessor.IsFileConfigured(configFile, sourceFile);

            button.Visible = _configs != null && _configs.Any();
        }
Example #2
0
        private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var button = (OleMenuCommand)sender;

            button.Visible = button.Enabled = false;

            _item = GetProjectItem(WebCompilerPackage._dte);
            _reCompileConfigs.Clear();

            if (_item == null || _item.ContainingProject == null || _item.Properties == null)
            {
                return;
            }

            string configFile = _item.ContainingProject.GetConfigFile();
            string inputFile  = _item.Properties.Item("FullPath").Value.ToString();

            button.Visible = button.Enabled = WebCompiler.CompilerService.IsSupported(inputFile);

            if (!button.Visible)
            {
                return;
            }

            var configs = ConfigFileProcessor.IsFileConfigured(configFile, inputFile);

            if (configs != null && configs.Any())
            {
                button.Text = "Re-compile file";
                _reCompileConfigs.AddRange(configs);
            }
            else
            {
                button.Text = "Compile file";
            }
        }