private void ApplyUserSettingsToWindow(LayoutWindow window, GeneralSettingsPageGrid settings)
 {
     if (window == null || settings == null)
     {
         return;
     }
     window.SetGridNumberBase(settings.OptionViewerGridBase);
 }
        public void OnUserSettingsChanged()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            GeneralSettingsPageGrid settings = EditorUtils.GetGeneralSettings();
            LayoutWindow            win      = EditorUtils.GetLayoutWindow(false);

            ApplyUserSettingsToWindow(win, settings);
        }
        public async System.Threading.Tasks.Task ParseAtCurrentLocationAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            OutputLog.Clear();

            EditorUtils.SaveActiveDocument();

            DocumentLocation location = GetCurrentLocation();

            if (location == null)
            {
                string msg = "Unable to retrieve current document position.";
                OutputLog.Error(msg);
                ParseMessageWindow.Display(new ParseMessageContent(msg));
            }

            ProjectProperties properties = GetProjectData();

            if (properties == null)
            {
                string msg = "Unable to retrieve the project configuration";
                OutputLog.Error(msg);
                ParseMessageWindow.Display(new ParseMessageContent(msg));
                return;
            }

            GeneralSettingsPageGrid settings = EditorUtils.GetGeneralSettings();

            parser.PrintCommandLine = settings.OptionParserShowCommandLine;

            //TODO ~ ramonv ~ add parsing queue to avoid multiple queries at the same time

            LayoutWindow prewin = EditorUtils.GetLayoutWindow(false);

            if (prewin != null)
            {
                prewin.SetProcessing();
            }

            ParseResult result = await parser.ParseAsync(properties, location);

            //Only create or focus the window if we have a valid result
            LayoutWindow win = EditorUtils.GetLayoutWindow(result.Status == ParseResult.StatusCode.Found);

            if (win != null)
            {
                win.SetResult(result);

                if (result.Status == ParseResult.StatusCode.Found)
                {
                    EditorUtils.FocusWindow(win);
                }
            }

            DisplayResult(result);
        }