Beispiel #1
0
        private void editPop3Item()
        {
            tabControl.SelectTab("tabPagePOP3");

            ListView.SelectedIndexCollection selectedItems = this.listViewPOP3.SelectedIndices;
            if (selectedItems != null && selectedItems.Count > 0)
            {
                HostConfigObject currentPop3Obj = SettingsObject.ListPOP3[selectedItems[0]];
                POP3Window window = new POP3Window(currentPop3Obj);
                DialogResult result = window.ShowDialog();
                if (result == DialogResult.OK)
                {
                    HostConfigObject newPop3Obj = window.getHostConfigObject();
                    if (newPop3Obj != null)
                    {
                        // Remove old object from collection
                        SettingsObject.ListPOP3.Remove(currentPop3Obj);

                        // Add new object to collection
                        SettingsObject.ListPOP3.Add(newPop3Obj);

                        // Remove old listview entry
                        this.listViewPOP3.Items.RemoveAt(selectedItems[0]);

                        // Add new listview entry
                        ListViewItem item = new ListViewItem(new string[] { "", newPop3Obj.Description, newPop3Obj.Host, newPop3Obj.Username });
                        item.Checked = newPop3Obj.Active;
                        this.listViewPOP3.Items.Add(item);
                        this.listViewPOP3.Sort();
                    }
                }
            }
        }
Beispiel #2
0
        private void addPop3Item()
        {
            tabControl.SelectTab("tabPagePOP3");
            POP3Window window = new POP3Window();
            DialogResult result = window.ShowDialog();
            if (result == DialogResult.OK)
            {
                HostConfigObject hostObj = window.getHostConfigObject();
                if (hostObj != null)
                {
                    // Add to local collection
                    SettingsObject.ListPOP3.Add(hostObj);

                    // Add to listview
                    ListViewItem item = new ListViewItem(new string[] { "", hostObj.Description, hostObj.Host, hostObj.Username });
                    item.Checked = true;
                    this.listViewPOP3.Items.Add(item);
                    this.listViewPOP3.Sort();
                }
            }
        }