コード例 #1
0
    private void InitializeDatabaseOperation(bool unattended)
    {
        ConnectionDialogForm form = new ConnectionDialogForm();

        form.Initialize(_databaseOperation, unattended, _unattendedConnectionStringFromCmdLine);

        if (GenericHelper.IsUserInteractive())
        {
            form.ShowDialog();
        }
        else
        {
            form.OkButtonClick();
        }

        Application.DoEvents();

        if (form.ConnectionChanged)
        {
            _databaseOperation = form.GetDatabaseOperation();

            ChangeConnectionForm form1 = new ChangeConnectionForm();
            form1.Initialize(_databaseOperation, this);
        }
        else
        {
            if (_databaseOperation == null)
            {
                Environment.Exit(-1);
            }
        }
    }
コード例 #2
0
    private void ChangeConnectionToolStripMenuItem_Click(object sender, EventArgs e)
    {
        dataViewUserControl1.CloseSearchForm();

        DatabaseOperation previousConnection = new DatabaseOperation();

        previousConnection.ChangeConnection(_databaseOperation.GetConnectionString());
        string previousSessionId = GenericHelper.GetSessionIdFromTableName();

        ConnectionDialogForm form = new ConnectionDialogForm();

        form.ShowInTaskbar = false;
        form.Initialize(_databaseOperation, false, null);

        if (GenericHelper.IsUserInteractive())
        {
            form.ShowDialog();
        }
        else
        {
            form.OkButtonClick();
        }

        Application.DoEvents();

        if (form.ConnectionChanged)
        {
            Enabled = false;

            dataViewUserControl1.SetFilter1Applied(false);
            dataViewUserControl1.SetFilter2Applied(false);

            ChangeConnectionForm form1 = new ChangeConnectionForm();
            form1.ShowInTaskbar = false;
            form1.Initialize(_databaseOperation, this, previousConnection, form.ShiftPressed, inputSourceUserControl1.GetManuallyUseSession(), previousSessionId);

            GenericHelper.KillPreviousConnection(previousConnection, previousSessionId);

            Enabled = true;

            inputSourceUserControl1.SetManuallyUseSession(false);
            inputSourceUserControl1.HandleListView(false, null);
            inputSourceUserControl1.SetImportNew(true);
            DataViewUserControl1_ShowInputSourceEvent();

            SetTracingFunctionality();
        }

        previousConnection.Dispose();
    }