Esempio n. 1
0
        private async void onSave(Document document)
        {
            try
            {
                EditPointsSpan currentLine =
                    document
                    .AsTextDocument()
                    .GetCurrentLineSpan();

                string text = currentLine.Text?.Trim();

                if (text == "//joke")
                {
                    JokeOfTheDayOptions options =
                        this.OptionsPage <JokeOfTheDayOptions>();

                    string joke =
                        await Jokes.JokeAsync(options.FirstName, options.LastName);

                    currentLine.Text = joke;
                    addJokeToList(joke);
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public void ReplaceSelectionWithJoke()
        {
            try
            {
                TextSelection       selection = VS.Instance.ActiveDocument.Selection;
                JokeOfTheDayOptions options   = this.OptionsPage <JokeOfTheDayOptions>();
                string joke = Jokes.Joke(options.FirstName, options.LastName);
                selection.Text = joke;

                addJokeToList(joke);
            }
            catch { }
        }