Example #1
0
        public override void SetDatabaseObject(IActivateItems activator, CatalogueItem databaseObject)
        {
            _catalogueItem = databaseObject;

            if (_scintillaDescription == null)
            {
                var f = new ScintillaTextEditorFactory();
                _scintillaDescription      = f.Create(null, null, null, true, false, activator.CurrentDirectory);
                _scintillaDescription.Font = System.Drawing.SystemFonts.DefaultFont;
                panel1.Controls.Add(_scintillaDescription);
            }

            base.SetDatabaseObject(activator, databaseObject);


            if (_catalogueItem.ExtractionInformation != null)
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandActivate(activator, _catalogueItem.ExtractionInformation), "Go To Extraction Information");
            }
            else
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandMakeCatalogueItemExtractable(activator, _catalogueItem), "Make Extractable");
            }

            if (_catalogueItem.ColumnInfo_ID != null)
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, _catalogueItem.ColumnInfo, 0, true));
            }
        }
Example #2
0
        private void LoadFile()
        {
            _bLoading = true;
            try
            {
                if (_scintilla == null)
                {
                    ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory();
                    _scintilla = factory.Create(new RDMPCombineableFactory());
                    groupBox1.Controls.Add(_scintilla);
                    _scintilla.SavePointLeft      += ScintillaOnSavePointLeft;
                    ObjectSaverButton1.BeforeSave += objectSaverButton1_BeforeSave;
                }

                SetupAutocomplete();

                try
                {
                    _scintilla.Text = File.ReadAllText(_processTask.Path);
                    _scintilla.SetSavePoint();
                }
                catch (Exception e)
                {
                    CommonFunctionality.Fatal("Could not open file " + _processTask.Path, e);
                }
            }
            finally
            {
                _bLoading = false;
            }
        }
Example #3
0
        public override void SetDatabaseObject(IActivateItems activator, Lookup databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            _keyColumn         = databaseObject.PrimaryKey;
            _descriptionColumn = databaseObject.Description;
            _tableInfo         = _keyColumn.TableInfo;

            lblCode.Text        = _keyColumn.GetRuntimeName();
            lblDescription.Text = _descriptionColumn.GetRuntimeName();

            ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory();

            _scintilla = factory.Create();

            gbScintilla.Controls.Add(_scintilla);

            try
            {
                SendQuery();
            }
            catch (System.Exception ex)
            {
                CommonFunctionality.Fatal("Could not connect to database", ex);
            }
        }
        public GenerateClassCodeFromTableUI()
        {
            InitializeComponent();

            var factory = new ScintillaTextEditorFactory();

            _codeEditor          = factory.Create(null, SyntaxLanguage.CSharp);
            _codeEditor.ReadOnly = false;
            panel1.Controls.Add(_codeEditor);
        }
Example #5
0
        public TypeTextOrCancelDialog(DialogArgs args, int maxCharacters, string startingTextForInputBox = null, bool allowBlankText = false, bool multiLine = false)
        {
            _allowBlankText = allowBlankText;
            _multiline      = multiLine;

            InitializeComponent();

            var header = args.WindowTitle;


            if (header != null && header.Length > WideMessageBox.MAX_LENGTH_TITLE)
            {
                header = header.Substring(0, WideMessageBox.MAX_LENGTH_TITLE);
            }

            taskDescriptionLabel1.SetupFor(args);

            this.Text = header;
            this.textBox1.MaxLength = maxCharacters;

            if (_multiline)
            {
                var editor = new ScintillaTextEditorFactory();
                _scintilla              = editor.Create(null, SyntaxLanguage.None, null, true, false);
                _scintilla.Dock         = DockStyle.Fill;
                _scintilla.TextChanged += _scintilla_TextChanged;
                _scintilla.KeyDown     += _scintilla_KeyDown;
                _scintilla.Text         = startingTextForInputBox;
                _scintilla.WrapMode     = WrapMode.Word;

                pTextEditor.Controls.Remove(textBox1);
                pTextEditor.Controls.Add(_scintilla);

                //Move cursor to the end of the textbox
                this.ActiveControl        = _scintilla;
                _scintilla.SelectionStart = _scintilla.TextLength;

                this.textBox1.Anchor     = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                this.textBox1.ScrollBars = ScrollBars.Vertical;
                this.Width = 740;

                //Update the tooltip for the OK button
                toolTip.SetToolTip(btnOk, "Press to Save (SHIFT + ENTER)");
            }
            else
            {
                textBox1.Text = startingTextForInputBox;
                Width         = Math.Max(540, Math.Min(740, taskDescriptionLabel1.PreferredWidth));

                this.ActiveControl = textBox1;
            }

            SetEnabledness();
        }
        public ViewCohortIdentificationConfigurationUI()
        {
            InitializeComponent();

            var factory = new ScintillaTextEditorFactory();

            QueryEditor = factory.Create(new RDMPCommandFactory());
            this.Controls.Add(QueryEditor);

            AssociatedCollection = RDMPCollection.Cohort;
        }
        public TagElevationXmlUI()
        {
            InitializeComponent();

            btnOk.Click     += Btn_Click;
            btnCancel.Click += Btn_Click;

            var factory = new ScintillaTextEditorFactory();

            queryEditor = factory.Create(null, "xml");
            pEditor.Controls.Add(queryEditor);


            var autoComplete = new AutocompleteMenu();

            autoComplete.ImageList = new ImageList();
            autoComplete.ImageList.Images.Add(CatalogueIcons.File);
            autoComplete.MaximumSize = new System.Drawing.Size(300, 500);

            autoComplete.AddItem(new SubstringAutocompleteItem("TagElevationRequest")
            {
                ImageIndex = 0
            });
            autoComplete.AddItem(new SubstringAutocompleteItem("ColumnName")
            {
                ImageIndex = 0
            });
            autoComplete.AddItem(new SubstringAutocompleteItem("ElevationPathway")
            {
                ImageIndex = 0
            });
            autoComplete.AddItem(new SubstringAutocompleteItem("Conditional")
            {
                ImageIndex = 0
            });
            autoComplete.AddItem(new SubstringAutocompleteItem("ConditionalPathway")
            {
                ImageIndex = 0
            });
            autoComplete.AddItem(new SubstringAutocompleteItem("ConditionalRegex")
            {
                ImageIndex = 0
            });

            foreach (string keyword in DicomDictionary.Default.Select(e => e.Keyword).Distinct())
            {
                autoComplete.AddItem(new SubstringAutocompleteItem(keyword));
            }

            autoComplete.TargetControlWrapper = new ScintillaWrapper(queryEditor);

            btnRunChecks.Click += (s, e) => RunChecks();
        }
Example #8
0
        public TagElevationXmlUI()
        {
            InitializeComponent();

            btnOk.Click     += Btn_Click;
            btnCancel.Click += Btn_Click;

            var factory = new ScintillaTextEditorFactory();

            queryEditor = factory.Create(null, "xml");
            pEditor.Controls.Add(queryEditor);

            btnRunChecks.Click += (s, e) => RunChecks();
        }
        public ViewSQLAndResultsWithDataGridUI()
        {
            InitializeComponent();

            ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory();

            _scintilla = factory.Create();
            splitContainer1.Panel1.Controls.Add(_scintilla);
            _scintilla.TextChanged += _scintilla_TextChanged;
            _scintilla.KeyUp       += ScintillaOnKeyUp;
            DoTransparencyProperly.ThisHoversOver(ragSmiley1, dataGridView1);

            btnExecuteSql.Click += (s, e) => RunQuery();
            btnResetSql.Click   += btnResetSql_Click;

            dataGridView1.CellDoubleClick += dataGridView1_CellDoubleClick;
        }
Example #10
0
        public override void SetDatabaseObject(IActivateItems activator, Catalogue databaseObject)
        {
            if (_scintillaDescription == null)
            {
                var f = new ScintillaTextEditorFactory();
                _scintillaDescription          = f.Create(null, SyntaxLanguage.None, null, true, false, activator.CurrentDirectory);
                _scintillaDescription.Font     = System.Drawing.SystemFonts.DefaultFont;
                _scintillaDescription.WrapMode = WrapMode.Word;
                panel1.Controls.Add(_scintillaDescription);
            }

            base.SetDatabaseObject(activator, databaseObject);

            _catalogue = databaseObject;

            RefreshUIFromDatabase();
        }
        public ViewSQLAndResultsWithDataGridUI()
        {
            InitializeComponent();

            ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory();

            _scintilla = factory.Create();
            splitContainer1.Panel1.Controls.Add(_scintilla);
            _scintilla.TextChanged += _scintilla_TextChanged;
            _scintilla.KeyUp       += ScintillaOnKeyUp;

            btnExecuteSql.Click += (s, e) => RunQuery();
            btnResetSql.Click   += btnResetSql_Click;

            dataGridView1.CellDoubleClick += dataGridView1_CellDoubleClick;

            _serverHeader             = new ToolStripLabel("Server:");
            _databaseTypeIconProvider = new DatabaseTypeIconProvider();
        }
Example #12
0
        public override void SetDatabaseObject(IActivateItems activator, CatalogueItem databaseObject)
        {
            _catalogueItem = databaseObject;

            if (_scintillaDescription == null)
            {
                var f = new ScintillaTextEditorFactory();
                _scintillaDescription          = f.Create(null, SyntaxLanguage.None, null, true, false, activator.CurrentDirectory);
                _scintillaDescription.Font     = System.Drawing.SystemFonts.DefaultFont;
                _scintillaDescription.WrapMode = WrapMode.Word;
                panel1.Controls.Add(_scintillaDescription);
            }

            base.SetDatabaseObject(activator, databaseObject);


            if (_catalogueItem.ExtractionInformation == null)
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandMakeCatalogueItemExtractable(activator, _catalogueItem), "Make Extractable");
            }
        }
Example #13
0
        public override void SetDatabaseObject(IActivateItems activator, Catalogue databaseObject)
        {
            if (_scintillaDescription == null)
            {
                var f = new ScintillaTextEditorFactory();
                _scintillaDescription      = f.Create(null, null, null, true, false, activator.CurrentDirectory);
                _scintillaDescription.Font = System.Drawing.SystemFonts.DefaultFont;
                panel1.Controls.Add(_scintillaDescription);
            }

            base.SetDatabaseObject(activator, databaseObject);

            _catalogue = databaseObject;

            CommonFunctionality.AddHelp(tbFolder, "CatalogueFolder");

            CommonFunctionality.AddHelp(cbDeprecated, "IMightBeDeprecated.IsDeprecated");
            CommonFunctionality.AddHelp(cbColdStorage, "ICatalogue.IsColdStorageDataset");
            CommonFunctionality.AddHelp(cbInternal, "ICatalogue.IsInternalDataset");


            RefreshUIFromDatabase();
        }
        public void SetCollection(IActivateItems activator, IPersistableObjectCollection collection)
        {
            _collection = (IViewSQLAndResultsCollection)collection;

            CommonFunctionality.ClearToolStrip();

            btnExecuteSql.Image = activator.CoreIconProvider.GetImage(RDMPConcept.SQL, OverlayKind.Execute);

            var overlayer = new IconOverlayProvider();

            btnResetSql.Image = overlayer.GetOverlay(FamFamFamIcons.text_align_left, OverlayKind.Problem);

            if (_scintilla == null)
            {
                // figure out what DBMS we are targetting
                var syntax = _collection.GetQuerySyntaxHelper();

                // Create the SQL editor for that language
                ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory();
                _scintilla = factory.Create(null, SyntaxLanguage.SQL, syntax);
                splitContainer1.Panel1.Controls.Add(_scintilla);
                _scintilla.TextChanged += _scintilla_TextChanged;
                _scintilla.KeyUp       += ScintillaOnKeyUp;

                // Setup autocomplete menu for the DBMS language
                _autoComplete = new AutoCompleteProviderWin(syntax);
                _collection.AdjustAutocomplete(_autoComplete);
                _autoComplete.RegisterForEvents(_scintilla);
            }

            SetItemActivator(activator);

            CommonFunctionality.Add(btnExecuteSql);
            CommonFunctionality.Add(btnResetSql);

            foreach (var c in _timeoutControls.GetControls())
            {
                CommonFunctionality.Add(c);
            }

            foreach (DatabaseEntity d in _collection.GetToolStripObjects())
            {
                CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, d, 0, true));
            }

            CommonFunctionality.Add(new ToolStripSeparator());
            CommonFunctionality.Add(_serverHeader);

            try
            {
                var dap = _collection.GetDataAccessPoint();
                _serverHeader.Text  = $"Server: {dap.Server} Database: {dap.Database}";
                _serverHeader.Image = _databaseTypeIconProvider.GetImage(dap.DatabaseType);
            }
            catch (Exception)
            {
                _serverHeader.Text = "Server:Unknown";
            }


            RefreshUIFromDatabase();
        }