예제 #1
0
        private void PairList_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (ListViewItem item in pairList.SelectedItems)
            {
                SyncPairSettings sps = config.SyncPairs.Find(findPair => { return(findPair.EvernoteNotebook == item.Text); });
                if (sps != null)
                {
                    imapServer.Text       = sps.IMAPServer;
                    imapUsername.Text     = sps.IMAPUsername;
                    imapPassword.Text     = sps.IMAPPassword;
                    imapNotebook.Text     = sps.IMAPNotesFolder;
                    evernoteNotebook.Text = sps.EvernoteNotebook;
                }
            }

            deletePairButton.Enabled = pairList.SelectedItems.Count != 0;
        }
예제 #2
0
        private void ApplyPairButton_Click(object sender, EventArgs e)
        {
            if (evernoteNotebook.Text.Length == 0)
            {
                errorProvider.SetError(evernoteNotebook, "Please enter a valid notebook name");
                return;
            }

            if ((imapNotebook.Text.Length == 0) || (imapNotebook.Text == "/"))
            {
                errorProvider.SetError(imapNotebook, "Please set a subfolder for syncing the notes");
                return;
            }

            SyncPairSettings sps = config.SyncPairs.Find(findPair => { return(findPair.EvernoteNotebook == evernoteNotebook.Text); });

            if (sps == null)
            {
                sps = new SyncPairSettings();
            }
            else
            {
                config.SyncPairs.Remove(sps);
                sps.LastSyncTime = new DateTime(0);
            }

            sps.IMAPServer       = imapServer.Text;
            sps.IMAPUsername     = imapUsername.Text;
            sps.IMAPPassword     = imapPassword.Text;
            sps.IMAPNotesFolder  = imapNotebook.Text;
            sps.EvernoteNotebook = evernoteNotebook.Text;
            config.SyncPairs.Add(sps);

            pairList.Items.Clear();
            foreach (SyncPairSettings sp in config.SyncPairs)
            {
                pairList.Items.Add(sp.EvernoteNotebook);
            }

            pairList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            pairList.Update();
        }
예제 #3
0
        private void DeletePairButton_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem item in pairList.SelectedItems)
            {
                SyncPairSettings sps = config.SyncPairs.Find(findPair => { return(findPair.EvernoteNotebook == item.Text); });
                if (sps != null)
                {
                    config.SyncPairs.Remove(sps);
                }
            }

            pairList.Items.Clear();
            foreach (SyncPairSettings sp in config.SyncPairs)
            {
                pairList.Items.Add(sp.EvernoteNotebook);
            }

            pairList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            pairList.Update();
        }
예제 #4
0
        private void ApplyPairButton_Click(object sender, EventArgs e)
        {
            if (evernoteNotebook.Text.Length == 0)
            {
                errorProvider.SetError(evernoteNotebook, "Please enter a valid notebook name");
                return;
            }

            if ((imapNotebook.Text.Length == 0) || (imapNotebook.Text == "/"))
            {
                errorProvider.SetError(imapNotebook, "Please set a subfolder for syncing the notes");
                return;
            }

            SyncPairSettings sps = config.SyncPairs.Find(findPair => { return findPair.EvernoteNotebook == evernoteNotebook.Text; });
            if (sps == null)
            {
                sps = new SyncPairSettings();
            }
            else
            {
                config.SyncPairs.Remove(sps);
                sps.LastSyncTime = new DateTime(0);
            }

            sps.IMAPServer = imapServer.Text;
            sps.IMAPUsername = imapUsername.Text;
            sps.IMAPPassword = imapPassword.Text;
            sps.IMAPNotesFolder = imapNotebook.Text;
            sps.EvernoteNotebook = evernoteNotebook.Text;
            config.SyncPairs.Add(sps);

            pairList.Items.Clear();
            foreach (SyncPairSettings sp in config.SyncPairs)
            {
                pairList.Items.Add(sp.EvernoteNotebook);
            }

            pairList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            pairList.Update();
        }