示例#1
0
        public void GetNotebooks(object arguments)
        {
            string[] inputs      = (string[])arguments;
            string   username    = inputs[0];
            string   password    = inputs[1];
            string   savePath    = inputs[2];
            string   edamBaseUrl = @"https://www.evernote.com";

            UserStore.Client userStore = EvernoteHelper.GetUserStoreClient(edamBaseUrl);
            if (EvernoteHelper.VerifyEDAM(userStore) == false)
            {
                return;
            }

            try
            {
                AuthenticationResult authResult = EvernoteHelper.Authenticate(username, password, consumerKey, consumerSecret, "www.evernote.com", userStore);
                enNotebooks = ReadEvernoteNotebooks(edamBaseUrl, authResult);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControls(true);
                return;
            }

            if (rdoExportSelected.Checked)
            {
                NotebookSelection nbSelect = new NotebookSelection();
                nbSelect.ShowDialog(enNotebooks);
                enNotebooks = nbSelect.nbListKeep;
                if (enNotebooks.Count == 0)
                {
                    MessageBox.Show("There were no notebooks selected and will stop processing.", "Notebooks Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    EnableControls(true);
                    return;
                }
            }

            try
            {
                AuthenticationResult authResult = EvernoteHelper.Authenticate(username, password, consumerKey, consumerSecret, "www.evernote.com", userStore);
                enNotebooks = ReadEvernoteNotes(edamBaseUrl, authResult);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControls(true);
                return;
            }
            Create(arguments);
        }
示例#2
0
文件: Form1.cs 项目: bvp/en2ki
        public void GetNotebooks(object arguments)
        {
            string[] inputs = (string[])arguments;
            string username = inputs[0];
            string password = inputs[1];
            string savePath = inputs[2];
            string edamBaseUrl = @"https://www.evernote.com";

            UserStore.Client userStore = EvernoteHelper.GetUserStoreClient(edamBaseUrl);
            if (EvernoteHelper.VerifyEDAM(userStore) == false) return;

            try
            {
                AuthenticationResult authResult = EvernoteHelper.Authenticate(username, password, consumerKey, consumerSecret, "www.evernote.com", userStore);
                enNotebooks = ReadEvernoteNotebooks(edamBaseUrl, authResult);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControls(true);
                return;
            }

            if (rdoExportSelected.Checked)
            {
                NotebookSelection nbSelect = new NotebookSelection();
                nbSelect.ShowDialog(enNotebooks);
                enNotebooks = nbSelect.nbListKeep;
                if (enNotebooks.Count == 0)
                {
                    MessageBox.Show("There were no notebooks selected and will stop processing.", "Notebooks Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    EnableControls(true);
                    return;
                }
            }

            try
            {
                AuthenticationResult authResult = EvernoteHelper.Authenticate(username, password, consumerKey, consumerSecret, "www.evernote.com", userStore);
                enNotebooks = ReadEvernoteNotes(edamBaseUrl, authResult);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControls(true);
                return;
            }
            Create(arguments);
        }