Beispiel #1
0
        private void buttonRemoteAdd_Click(object sender, EventArgs e)
        {
            FormRemoteVnc formVnc = new FormRemoteVnc();

            formVnc.Text = "Add Remote Data";
            if (formVnc.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                // add to database
                remoteVncPresenter.AddVnc(
                    formVnc.DisplayName,
                    formVnc.RemoteIp,
                    formVnc.RemotePort);
            }
        }
Beispiel #2
0
        private void buttonRemoteEdit_Click(object sender, EventArgs e)
        {
            Dictionary <int, FormRemoteVnc> updatedList = new Dictionary <int, FormRemoteVnc>();

            foreach (DataGridViewRow row in dataGridViewRemote.Rows)
            {
                if (row.Cells[0].Value != null &&
                    (bool)row.Cells[0].Value)
                {
                    // show the form user
                    int    vncDataId  = (int)row.Cells[1].Value;
                    string vncLabel   = (string)row.Cells[2].Value;
                    string remoteIp   = (string)row.Cells[3].Value;
                    int    remotePort = (int)row.Cells[4].Value;

                    FormRemoteVnc formVnc = new FormRemoteVnc();
                    formVnc.Text        = "Edit Remote Data";
                    formVnc.DisplayName = vncLabel;
                    formVnc.RemoteIp    = remoteIp;
                    formVnc.RemotePort  = remotePort;

                    if (formVnc.ShowDialog(this) == System.Windows.Forms.DialogResult.OK &&
                        formVnc.IsDirty)
                    {
                        updatedList.Add(vncDataId, formVnc);
                    }
                }
            }

            foreach (KeyValuePair <int, FormRemoteVnc> data in updatedList)
            {
                // add to database
                remoteVncPresenter.EditVnc(
                    data.Key,
                    data.Value.DisplayName,
                    data.Value.RemoteIp,
                    data.Value.RemotePort);
            }
        }