private void FormCentralConnections_Load(object sender, EventArgs e)
 {
     _listConnectionGroups = ConnectionGroups.GetDeepCopy();
     comboConnectionGroups.Items.Add("All");
     comboConnectionGroups.Items.AddRange(_listConnectionGroups.Select(x => x.Description).ToArray());
     comboConnectionGroups.SelectedIndex = 0;          //Default to all.
     FillGrid();
 }
Exemple #2
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(this, Lans.g(this, "Delete this entire connection group?"), "", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         return;
     }
     ConnGroupAttaches.DeleteForGroup(ConnectionGroupCur.ConnectionGroupNum);
     ConnectionGroups.Delete(ConnectionGroupCur.ConnectionGroupNum);
     DialogResult = DialogResult.OK;
 }
Exemple #3
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MessageBox.Show(Lans.g(this, "Please enter a description."));
         return;
     }
     ConnectionGroupCur.Description = textDescription.Text;
     ConnectionGroups.Update(ConnectionGroupCur);            //was already inserted if new
     DialogResult = DialogResult.OK;
 }
Exemple #4
0
 private void FormCentralConnectionGroupEdit_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (ConnectionGroupCur.IsNew)
     {
         ConnGroupAttaches.DeleteForGroup(ConnectionGroupCur.ConnectionGroupNum);
         ConnectionGroups.Delete(ConnectionGroupCur.ConnectionGroupNum);
     }
 }
 private void FormCentralConnectionGroups_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (comboConnectionGroup.SelectedIndex == 0)
     {
         Prefs.UpdateLong(PrefName.ConnGroupCEMT, 0);
     }
     else
     {
         Prefs.UpdateLong(PrefName.ConnGroupCEMT, _listCentralConnGroups[comboConnectionGroup.SelectedIndex - 1].ConnectionGroupNum);
     }
     ConnectionGroups.Sync(_listCentralConnGroups);            //Reflect all changes in the database.
 }
Exemple #6
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            ConnectionGroup connGroup = new ConnectionGroup();

            connGroup.Description        = "Group";   //in case they close the window without clicking ok
            connGroup.ConnectionGroupNum = ConnectionGroups.Insert(connGroup);
            connGroup.IsNew = true;
            FormCentralConnectionGroupEdit FormCCGE = new FormCentralConnectionGroupEdit();

            FormCCGE.ConnectionGroupCur = connGroup;
            FormCCGE.ShowDialog();
            //if cancel, deleted inside
            FillGrid();
        }
        private void menuGroups_Click(object sender, EventArgs e)
        {
            ConnectionGroup connGroupCur = null;

            if (comboConnectionGroups.SelectedIndex > 0)
            {
                connGroupCur = _listConnectionGroups[comboConnectionGroups.SelectedIndex - 1];
            }
            FormCentralConnectionGroups FormCCG = new FormCentralConnectionGroups();

            FormCCG.ShowDialog();
            ConnectionGroups.RefreshCache();
            FillComboGroups(connGroupCur == null ? 0 : connGroupCur.ConnectionGroupNum);          //Reselect the connection group that the user had before.
            FillGrid();
        }
 ///<summary>Refreshes _listConnectionGroups with the current cache (could have been updated) and then selects the conn group passed in.</summary>
 private void FillComboGroups(long connGroupNum)
 {
     _listConnectionGroups = ConnectionGroups.GetDeepCopy();
     comboConnectionGroups.Items.Clear();
     comboConnectionGroups.Items.Add("All");
     comboConnectionGroups.SelectedIndex = 0;
     for (int i = 0; i < _listConnectionGroups.Count; i++)
     {
         comboConnectionGroups.Items.Add(_listConnectionGroups[i].Description);
         if (_listConnectionGroups[i].ConnectionGroupNum == connGroupNum)
         {
             comboConnectionGroups.SelectedIndex = i + 1;                //0 is "All"
         }
     }
 }
        private void FormCentralConnectionGroups_Load(object sender, EventArgs e)
        {
            _listCentralConnGroups = ConnectionGroups.GetDeepCopy();
            long defaultConnGroupNum = PrefC.GetLong(PrefName.ConnGroupCEMT);

            comboConnectionGroup.Items.Clear();
            comboConnectionGroup.Items.Add(Lan.g(this, "All"));
            comboConnectionGroup.SelectedIndex = 0;          //Select all by default.
            //Fill in the list of conn groups and update the selected index of the combo box if needed.
            for (int i = 0; i < _listCentralConnGroups.Count; i++)
            {
                comboConnectionGroup.Items.Add(_listCentralConnGroups[i].Description);
                if (_listCentralConnGroups[i].ConnectionGroupNum == defaultConnGroupNum)
                {
                    comboConnectionGroup.SelectedIndex = i + 1;
                }
            }
            FillGrid();
        }
Exemple #10
0
        private void FillGrid()
        {
            _listCentralConnGroups = ConnectionGroups.GetAll();
            //Get all conn group attaches because we will be using all of them in order to show counts.
            List <ConnGroupAttach> listConnGroupAttaches = ConnGroupAttaches.GetAll();
            //always fills combo, too, since it's the same list
            long defaultConnGroupNum = PrefC.GetLong(PrefName.ConnGroupCEMT);

            comboConnectionGroup.Items.Clear();
            comboConnectionGroup.Items.Add(Lan.g(this, "All"));
            comboConnectionGroup.SelectedIndex = 0;          //Select all by default.
            //Fill in the list of conn groups and update the selected index of the combo box if needed.
            for (int i = 0; i < _listCentralConnGroups.Count; i++)
            {
                comboConnectionGroup.Items.Add(_listCentralConnGroups[i].Description);
                if (_listCentralConnGroups[i].ConnectionGroupNum == defaultConnGroupNum)
                {
                    comboConnectionGroup.SelectedIndex = i + 1;
                }
            }
            //grid-----------------------------------------------------------------------------------------------------
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lans.g(this, "Group Name"), 280);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lans.g(this, "Conns"), 0);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < _listCentralConnGroups.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(_listCentralConnGroups[i].Description);
                row.Cells.Add(listConnGroupAttaches.FindAll(x => x.ConnectionGroupNum == _listCentralConnGroups[i].ConnectionGroupNum).Count.ToString());
                //row.Tag=connGroup;//Not really used currently, but we may want to add filtering later.
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #11
0
        private void FormCentralConnections_Load(object sender, EventArgs e)
        {
            checkIsAutoLogon.Checked    = PrefC.GetBool(PrefName.CentralManagerIsAutoLogon);
            checkUseDynamicMode.Checked = PrefC.GetBool(PrefName.CentralManagerUseDynamicMode);
            _listConnectionGroups       = ConnectionGroups.GetAll();
            comboConnectionGroups.Items.Add("All");
            comboConnectionGroups.Items.AddRange(_listConnectionGroups.Select(x => x.Description).ToArray());
            comboConnectionGroups.SelectedIndex = 0;          //Default to all.
            if (IsSelectionMode)
            {
                groupPrefs.Visible    = false;
                butAdd.Visible        = false;
                groupOrdering.Visible = false;
            }
            else
            {
                butOK.Visible  = false;
                butCancel.Text = "Close";
            }
            _listConnsAll = CentralConnections.GetConnections();
            //fix any bad item orders
            bool foundBad = false;

            for (int i = 0; i < _listConnsAll.Count; i++)
            {
                if (_listConnsAll[i].ItemOrder != i)
                {
                    foundBad = true;
                    _listConnsAll[i].ItemOrder = i;
                    CentralConnections.Update(_listConnsAll[i]);
                }
            }
            if (foundBad)
            {
                _listConnsAll = CentralConnections.GetConnections();
            }
            FillGrid();
        }
        private void butAdd_Click(object sender, EventArgs e)
        {
            ConnectionGroup connGroup = new ConnectionGroup();

            connGroup.Description        = "";
            connGroup.ConnectionGroupNum = ConnectionGroups.Insert(connGroup);
            FormCentralConnectionGroupEdit FormCCGE = new FormCentralConnectionGroupEdit();

            FormCCGE.ConnectionGroupCur = connGroup;
            FormCCGE.IsNew = true;
            FormCCGE.ShowDialog();
            if (FormCCGE.DialogResult == DialogResult.OK)
            {
                if (FormCCGE.ConnectionGroupCur == null)
                {
                    ConnectionGroups.Delete(connGroup.ConnectionGroupNum);
                }
                else
                {
                    _listCentralConnGroups.Add(connGroup);
                }
            }
            FillGrid();
        }