Example #1
0
        private void ButtonSaveGist_Click(object sender, RoutedEventArgs e)
        {
            Model.ActiveItem.code = Addin.GetMarkdown();

            GistItem gist;

            ShowStatus("Saving Gist...");
            if (!Model.SaveAsNewGist)
            {
                gist = GistClient.UpdateGist(Model.ActiveItem, Model.Configuration.GithubUserToken);
            }
            else
            {
                gist = GistClient.PostGist(Model.ActiveItem, Model.Configuration.GithubUserToken);
            }

            if (gist != null && !gist.hasError)
            {
                ShowStatus("Gist has been saved...", 5000);
                mmFileUtils.ShowExternalBrowser(gist.htmlUrl);
                Close();
            }
            else
            {
                SetStatusIcon(FontAwesomeIcon.Warning, Colors.Orange);
                ShowStatus("Gist was not saved - failed to save as Gist.", 7000);
            }
        }
        private void ButtonSaveGist_Click(object sender, RoutedEventArgs e)
        {
            Model.ActiveItem.code = Addin.GetMarkdown();

            GistItem gist;

            ShowStatus("Saving Gist...");
            if (!Model.SaveAsNewGist)
            {
                gist = GistClient.UpdateGist(Model.ActiveItem, Model.Configuration.GithubUserToken);
            }
            else
            {
                gist = GistClient.PostGist(Model.ActiveItem, Model.Configuration.GithubUserToken);
            }

            if (gist != null && !gist.hasError)
            {
                ShowStatus("Gist has been saved...", 5000);
                mmFileUtils.ShowExternalBrowser(gist.htmlUrl);
                Close();
            }
            else
            {
                mmApp.Log(gist.errorMessage);

                SetStatusIcon(FontAwesomeIcon.ExclamationCircle, Colors.Firebrick);
                ShowStatus("Failed to save as Gist. Refer to error log for more detail.", 7000);
            }
        }