Class MainWindow

Interaction logic for MainWindow.xaml

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Visual
        System.Windows.UIElement
          System.Windows.FrameworkElement
            System.Windows.Controls.Control
              System.Windows.Controls.ContentControl
                System.Windows.Window
                  MahApps.Metro.Controls.MetroWindow
                    MarkdownMonster.MainWindow
public class MainWindow : MetroWindow, IComponentConnector,
   IStyleConnector

Class Members

MemberDescription

Constructor

DocumentType

DocumentType Name Field

FolderBrowser

FolderBrowser Name Field

LeftSidebarColumn

LeftSidebarColumn Name Field

LeftSidebarSeparatorColumn

LeftSidebarSeparatorColumn Name Field

MainMenu

MainMenu Name Field

MainMenuFile

MainMenuFile Name Field

MainWindowEditorColumn

MainWindowEditorColumn Name Field

RightSidebarColumn

RightSidebarColumn Name Field

RightSidebarContainer

RightSidebarContainer Name Field

RightSidebarSeparatorColumn

RightSidebarSeparatorColumn Name Field

SidebarContainer

SidebarContainer Name Field

StatusEncoding

StatusEncoding Name Field

StatusStats

StatusStats Name Field

StatusText

StatusText Name Field

TabControl

TabControl Name Field

TabDocumentOutline

TabDocumentOutline Name Field

TabFolderBrowser

TabFolderBrowser Name Field

ActivateTab

Activates a tab from an active tab instance

public TabItem ActivateTab(TabItem tab)

public TabItem ActivateTab(string filename,     bool openIfNotFound)

AddLeftSidebarPanelTabItem

Adds a new panel to the sidebar, and adds header text and icon explicitly. This overload provides a simpler way to add icon and header

public void AddLeftSidebarPanelTabItem(TabItem tabItem,     string tabHeaderText,     ImageSource tabHeaderIcon,     bool selectItem)

AddRecentFile

public void AddRecentFile(string file,     bool noConfigWrite)

AddRightSidebarPanelTabItem

Adds a new panel to the right sidebar

public void AddRightSidebarPanelTabItem(TabItem tabItem,     string tabHeaderText,     ImageSource tabHeaderIcon,     bool selectItem)

AppTheme_SelectionChanged

public void AppTheme_SelectionChanged(object sender,     SelectionChangedEventArgs e)

BindTabHeaders

Binds all Tab Headers

public void BindTabHeaders()

Button_Handler

Generic button handler that handles a number of simple tasks in a single method to minimize class noise.

public void Button_Handler(object sender,     RoutedEventArgs e)

CheckFileChangeInOpenDocuments

public void CheckFileChangeInOpenDocuments()

CloseAllTabs

public bool CloseAllTabs(TabItem allExcept)

CloseTab

Closes a tab and ask for confirmation if the tab doc is dirty.

public bool CloseTab(TabItem tab,     bool rebindTabHeaders,     bool dontPromptForSave)

public bool CloseTab(string filename)

GenerateContextMenuItemsFromOpenTabs

public List GenerateContextMenuItemsFromOpenTabs(ContextMenu ctx)

GetActiveMarkdownEditor

public MarkdownDocumentEditor GetActiveMarkdownEditor()

GetTabFromFilename

Retrieves an open tab based on its filename.

public TabItem GetTabFromFilename(string filename)

InitializeComponent

InitializeComponent

public sealed void InitializeComponent()

LoadPreviewBrowser

Create an instance of the Preview Browser either using the default IE based preview browser, or if an addin has registered a custom preview browser.

public void LoadPreviewBrowser()

Navigate

public void Navigate(string url)

OnAddinsLoaded

This is called only if addin loading takes very long Potentially fired off

public void OnAddinsLoaded()

OpenBrowserTab

Opens a preview tab

public TabItem OpenBrowserTab(string url,     bool selectTab,     bool isImageFile,     ImageSource icon,     string tabHeaderText)

OpenFavorites

public void OpenFavorites(bool noActivate)

OpenTab

Opens a tab by a filename

public TabItem OpenTab(string mdFile,     MarkdownDocumentEditor editor,     bool showPreviewIfActive,     string syntax,     bool selectTab,     bool rebindTabHeaders,     bool batchOpen,     int initialLineNumber,     bool readOnly,     bool noFocus,     bool isPreview)

PreviewMarkdown

public void PreviewMarkdown(MarkdownDocumentEditor editor,     bool keepScrollPosition,     bool showInBrowser,     string renderedHtml)

PreviewMarkdownAsync

public void PreviewMarkdownAsync(MarkdownDocumentEditor editor,     bool keepScrollPosition,     string renderedHtml)

RefreshTabFromFile

Refreshes an already loaded tab with contents of a new (or the same file) file by just replacing the document's text.

If the tab is not found a new tab is opened.

Note: File must already be open for this to work

public TabItem RefreshTabFromFile(string editorFile,     bool maintainScrollPosition,     bool noPreview,     bool noSelectTab,     bool noFocus,     bool readOnly,     bool isPreview)

SaveFile

public bool SaveFile(bool secureSave)

SaveSettings

Save active settings of the UI that are persisted in the configuration

public void SaveSettings()

SetEditorFocus

Helper method that sets editor focus

public void SetEditorFocus()

SetStatusIcon

Status the statusbar icon on the left bottom to some indicator

public void SetStatusIcon(FontAwesomeIcon icon,     Color color,     bool spin)

public void SetStatusIcon()

SetWindowTitle

Sets the Window Title followed by Markdown Monster (registration status) by default the filename is used and it's updated whenever tabs are changed.

Generally just call this when you need to have the title updated due to file name change that doesn't change the active tab.

public void SetWindowTitle(string title)

ShowFolderBrowser

Shows or hides the File Browser

public void ShowFolderBrowser(bool hide,     string folder)

ShowLeftSidebar

public void ShowLeftSidebar(bool hide)

ShowMessageOverlayAsync

Helper routine to show a Metro Dialog. Note this dialog popup is fully async!

public Task ShowMessageOverlayAsync(string title,     string message,     MessageDialogStyle style,     MetroDialogSettings settings)

ShowPreviewBrowser

Shows or hides the preview browser

public void ShowPreviewBrowser(bool hide,     bool refresh)

ShowRightSidebar

public void ShowRightSidebar(bool hide)

ShowStatus

public void ShowStatus(string message,     int milliSeconds,     FontAwesomeIcon icon,     Color color,     bool spin)

ShowStatusError

Displays an error message using common defaults for a timeout milliseconds

public void ShowStatusError(string message,     int timeout,     FontAwesomeIcon icon,     Color color)

ShowStatusProgress

Displays an Progress message using common defaults including a spinning icon

public void ShowStatusProgress(string message,     int timeout,     FontAwesomeIcon icon,     Color color,     bool spin)

ShowStatusSuccess

Shows a success message with a green check icon for the timeout

public void ShowStatusSuccess(string message,     int timeout,     FontAwesomeIcon icon,     Color color)

UpdateDocumentOutline

public void UpdateDocumentOutline(int editorLineNumber)

UpdateRecentDocumentsContextMenu

Creates/Updates the Recent Items Context list from recent file and recent folder configuration

public void UpdateRecentDocumentsContextMenu(RecentFileDropdownModes mode)

FavoritesTab

Hwnd

KeyBindings

LintingErrorTab

Model

PreviewBrowser

Manages the Preview Rendering in a WebBrowser Control

PreviewBrowserContainer

The Preview Browser Container Grid that contains the Web Browser control that handles the Document tied preview.

PreviewBrowserWindow

PreviewTab

The Preview Browser Tab if active that is used for image and URL previews (ie. the Preview without an associated editor)

Requirements

Namespace: MarkdownMonster
Assembly: markdownmonster.exe

© West Wind Technologies, 2019 • Updated: 01/06/19
Comment or report problem with topic