示例#1
0
        private void subscribeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listViewUploadList.SelectedItems.Count > 0)
            {
                bool erg = true;

                for (int i = 0; i < listViewUploadList.SelectedItems.Count; i++)
                {
                    _dbManager.SetCurrentProviderByKeyname(listViewUploadList.SelectedItems[i].SubItems[0].Text);

                    //check connection
                    bool isConnection = _dbManager.TryConnection();

                    //Add subsriber to uploadlist
                    if (isConnection)
                    {
                        _dbManager.AddDBSubscriber();
                    }

                    listViewUploadList.Items[listViewUploadList.SelectedItems[i].Index].ImageIndex = isConnection ? 0 : 1;
                    listViewUploadList.SelectedItems[i].SubItems[1].Text = isConnection ? "True" : "False";

                    erg = erg && isConnection;
                }

                if (!erg)
                {
                    MessageBox.Show($"Some providers are not valid for subscribtion - please check the connections");
                    return;
                }
            }

            //Fill Uploadlistview
            FillListViewUpload();


            m_statusStripLabelErgebnis.Text      = "Subscribtion added!";
            m_statusStripLabelErgebnis.ForeColor = Color.Blue;
        }