private void FormatActiveDocument() { ItemsCollector itemsCollector = new ItemsCollector(); itemsCollector.CollectActiveProjectItem(); var document = (itemsCollector.items[0].GetObject() as ProjectItem).Document; mDocument = document; ExecuteFormatCommand(); }
public static bool AreToolbarCommandsEnabled() { if (IsOpenFolderModeActive()) { return(true); } ItemsCollector itemCollector = new ItemsCollector(); itemCollector.CollectActiveProjectItem(); if (itemCollector.IsEmpty) { return(false); } string activeItem = itemCollector.Items[0].GetName().ToLower(); var fileExtension = Path.GetExtension(activeItem); return(ScriptConstants.kAcceptedFileExtensions.Contains(fileExtension)); }
internal static bool AreToolbarCommandsEnabled() { if (IsOpenFolderModeActive()) { return(true); } ItemsCollector itemCollector = new ItemsCollector(); itemCollector.CollectActiveProjectItem(); List <string> selectedItems = new List <string>(); if (itemCollector.HaveItems == false) { return(false); } itemCollector.Items.ForEach(i => selectedItems.Add(i.GetName())); var fileExtension = Path.GetExtension(selectedItems.FirstOrDefault()).ToLower(); return(ScriptConstants.kAcceptedFileExtensions.Contains(fileExtension)); }