コード例 #1
0
    private bool InputSourceUserControl1_ShowDataViewEvent(bool handleColumns, bool importFromExistingTable, bool connectToExistingSession, bool connectToCurrentSession)
    {
        bool success = true;

        if (handleColumns || _customColumnsChanged)
        {
            success = dataViewUserControl1.HandleColumns(importFromExistingTable);
        }

        if (importFromExistingTable)
        {
            if (handleColumns)
            {
                ConfigHandler.ImportStartTime = DateTime.Now;

                ImportSessionForm form = new ImportSessionForm();
                form.Initialize(_databaseOperation, inputSourceUserControl1.GetImportSessionInfoList());

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

                ConfigHandler.ImportEndTime = DateTime.Now;
            }
        }

        if (connectToExistingSession || (_customColumnsChanged && connectToCurrentSession))
        {
            _customColumnsChanged = false;
            dataViewUserControl1.SetFilter1Applied(false);
            dataViewUserControl1.SetFilter2Applied(false);
            dataViewUserControl1.ReloadDataViewer(true, true, !IsSortingColumnStillActive());
        }

        if (_customColumnsChanged)
        {
            _customColumnsChanged = false;
            dataViewUserControl1.SetFilter2Applied(false);
            inputSourceUserControl1.SetImportNew(true);
        }

        if (handleColumns)
        {
            dataViewUserControl1.SetFilter1Applied(false);
            dataViewUserControl1.ReloadDataViewer(true, false, !IsSortingColumnStillActive());
        }

        inputSourceUserControl1.Visible            = false;
        dataViewUserControl1.Visible               = true;
        showHiddenColumnsToolStripMenuItem.Enabled = true;
        standardColumnsToolStripMenuItem.Enabled   = true;
        exportToolStripMenuItem.Enabled            = true;
        timelineToolStripMenuItem.Enabled          = true;

        return(success);
    }
コード例 #2
0
    private void DisableColumnsNotInImportTables()
    {
        List <int> indexesToDisable = new List <int>();

        for (int i = 0; i < _lastImportedSessions.Count; i++)
        {
            List <string> nonDefaultColumnNames = ImportSessionForm.GetNonDefaultColumns(_databaseOperation, _lastImportedSessions[i]);

            for (int j = 0; j < ColumnHelper.ColumnCollection.Columns.Count; j++)
            {
                if (ColumnHelper.ColumnCollection.Columns[j].Enabled)
                {
                    bool found = false;

                    foreach (string nonDefaultColumnName in nonDefaultColumnNames)
                    {
                        if (ColumnHelper.ColumnCollection.Columns[j].Name == nonDefaultColumnName)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        indexesToDisable.Add(j);
                    }
                }
            }
        }

        foreach (int indexToDisable in indexesToDisable)
        {
            ColumnHelper.ColumnCollection.Columns[indexToDisable].Enabled = false;
        }
    }