private void buttonStart_Click(object sender, EventArgs e)
        {
            //test server connection/login gegevens
            try
            {
                NetCom.ServerResponse response = NetCom.WebRequest(new NetCom.ServerRequestSqlDateTime(), textBoxUserName.Text, textBoxPassword.Text, textBoxApiAddres.Text);
                if (response.IsErrorOccurred)
                {
                    if (MessageBox.Show(response.ErrorInfo.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop) == DialogResult.OK)
                    {
                        //buttonStart_Click(null, null); nee
                    }
                }
            }
            catch
            {
                if (MessageBox.Show("Kan Niet Met Server Verbinden", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop) == DialogResult.Retry)
                {
                    buttonStart_Click(null, null);
                }
                else
                {
                    return;
                }
                return;
            }

            //do
            try
            {
                FormMain form = new FormMain((string)listBox1.SelectedItem, textBoxApiAddres.Text, textBoxUserName.Text, textBoxPassword.Text, checkBoxStartWindowed.Checked);
                Visible = false;
                form.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            NetCom.ServerResponse response;

            try
            {
                response = NetCom.WebRequest(new NetCom.ServerRequestSqlDateTime(), textBoxUserName.Text, textBoxPassword.Text, textBoxApiAddres.Text);
                if (response.IsErrorOccurred)
                {
                    if (MessageBox.Show(response.ErrorInfo.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop) == DialogResult.OK)
                    {
                        //buttonStart_Click(null, null); nee
                        return;
                    }
                }
            }
            catch
            {
                if (MessageBox.Show("Kan Niet Met Server Verbinden", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop) == DialogResult.Retry)
                {
                    buttonStart_Click(null, null);
                }
                else
                {
                    return;
                }
                return;
            }

            //try {
            FormMenu form = new FormMenu(JsonConvert.DeserializeObject <DateTime>(JsonConvert.SerializeObject(response.Response)), textBoxUserName.Text, textBoxPassword.Text, textBoxApiAddres.Text);

            Visible = false;
            form.ShowDialog();
            // } catch (Exception ex) {
            //     MessageBox.Show(ex.Message, "dit had niet moeten gebeuren...");
            // }
        }
 private NetCom.ServerResponse webbbbrrrrrry(object request)
 {
     return(NetCom.WebRequest(request, _Username, _Password, _ApiAddres));
 }