static void CreateStyles()
        {
            CssEngine.Add("InspectionBox", s =>
            {
                s.Ignored         = true;
                s.Border.Left     = 3;
                s.Border.Color    = "#999";
                s.BackgroundColor = "#333";
                s.Width(InspectionBox.WIDTH);
            });

            CssEngine.Add("InspectionBox #HeaderBar", s => { s.BackgroundColor = "#555"; s.Height(30); });

            CssEngine.Add("InspectionBox ScrollView TextView", s => s.Font(12).Padding(2));
            CssEngine.Add("InspectionBox ScrollView TextView.toggle-icon", s => s.Width(12).Margin(right: 3));

            CssEngine.Add("InspectionBox PropertiesList CheckBox", s => s.Size(14));
            CssEngine.Add("InspectionBox PropertiesList OptionsList-Option #Label", x => x.TextColor("#eee"));

            CssEngine.Add("InspectionBox TextView", s => s.TextColor = "#ddd");

            CssEngine.Add("InspectionBox CheckBox", s => s.Border(1, color: Colors.Gray).Background(Colors.Transparent));
            CssEngine.Add("InspectionBox CheckBox #CheckedImage", s => s.Ignored());
            CssEngine.Add("InspectionBox CheckBox:checked", s => s.Background(Colors.LightGray));
        }
Example #2
0
        /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
        /// <param name='commandName'>The name of the command to execute.</param>
        /// <param name='executeOption'>Describes how the command should be run.</param>
        /// <param name='varIn'>Parameters passed from the caller to the command handler.</param>
        /// <param name='varOut'>Parameters passed from the command handler to the caller.</param>
        /// <param name='handled'>Informs the caller if the command was handled or not.</param>
        public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            handled = false;

            if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
            {
                if (this.App != null)
                {
                    string fileToTry = string.Empty;

                    try {
                        if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_MINIFIER)
                        {
                            try {
                                ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem;
                                if (EngineManager.IsHandledWithoutHint(projectItem.FileName()))
                                {
                                    this.ProjectItemsEvents_ItemAdded(projectItem);
                                }
                                else
                                {
                                    string path            = projectItem.FileName();
                                    string code            = System.IO.File.ReadAllText(path);
                                    var    settings        = Settings.Instance(path);
                                    string outputExtension = settings.OutputExtensionJS;
                                    if (this.IsLessFile(path))
                                    {
                                        code            = LessEngine.TransformToCss(path, code, projectItem);
                                        outputExtension = settings.OutputExtensionCSS;
                                    }
                                    else if (this.IsCoffeeScriptFile(path))
                                    {
                                        code            = CoffeeScriptEngine.TransformToJs(path, code, projectItem);
                                        outputExtension = settings.OutputExtensionJS;
                                    }
                                    else if (this.IsSassFile(path))
                                    {
                                        code            = SassEngine.TransformToCss(path, code, projectItem);
                                        outputExtension = settings.OutputExtensionCSS;
                                    }
                                    else if (this.IsCssFile(path))
                                    {
                                        code            = CssEngine.Minify(path, code, projectItem, Xml.MinifyType.Unspecified);
                                        outputExtension = settings.OutputExtensionCSS;
                                    }
                                    else if (this.IsJsFile(path))
                                    {
                                        code            = JsEngine.Minify(path, code, projectItem, Xml.MinifyType.Unspecified, string.Empty);
                                        outputExtension = settings.OutputExtensionJS;
                                    }
                                    using (var manager = new Manager.VSProjectItemManager(this.App, projectItem))
                                    {
                                        manager.AddFileByFileName(Utilities.GetBaseFileName(path) + outputExtension, code);
                                    }
                                }
                            } catch (Exception e) {
                                this.OutputWindowWriteText(e.ToString());
                            }
                        }
                        else if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_JSHINT)
                        {
                            try {
                                ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem;
                                string      path        = projectItem.FileName();
                                JSHintEngine.Run(path, projectItem);
                            } catch (Exception e) {
                                this.OutputWindowWriteText(e.ToString());
                            }
                        }
                        else if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_CSSLINT)
                        {
                            try {
                                ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem;
                                string      path        = projectItem.FileName();
                                CSSLintEngine.Run(path, projectItem);
                            } catch (Exception e) {
                                this.OutputWindowWriteText(e.ToString());
                            }
                        }
                        else if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_TYPESCRIPT)
                        {
                            try
                            {
                                ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem;
                                string      path        = projectItem.FileName();
                                TypeScriptEngine.Run(path, projectItem);
                            }
                            catch (Exception e)
                            {
                                this.OutputWindowWriteText(e.ToString());
                            }
                        }
                    } catch (Exception ex) {
                        this.OutputWindowWriteText(string.Format("Error occured.\r\nFileName:\r\n{0}\r\nException details:\r\n{1}", fileToTry, ex));
                    } // try

                    handled = true;

                    return;
                }
            }
        } // Exec