示例#1
0
        private void treeView1_ItemActivate(object sender, EventArgs e)
        {
            var o = treeView1.SelectedObject;

            if (o == null)
            {
                return;
            }

            if (o is ArchivalDataLoadInfo dli)
            {
                new ExecuteCommandViewLoggedData(Activator, new LogViewerFilter(LoggingTables.DataLoadRun)
                {
                    Run = dli.ID
                }).Execute();
            }
            else
            if (o is LoadEventsTreeView_Category cat)
            {
                new ExecuteCommandViewLoggedData(Activator, new LogViewerFilter(cat.AssociatedTable)
                {
                    Run = cat.RunId
                }).Execute();
            }
            else
            if (o is IHasSummary s)
            {
                WideMessageBox.Show(s);
            }
        }
示例#2
0
        public void SetLookupTableInfo(TableInfo t, bool setComboBox = true)
        {
            if (t != null && t.IsTableValuedFunction)
            {
                WideMessageBox.Show("Lookup table not valid", "Table '" + t + "' is a TableValuedFunction, you cannot use it as a lookup table");
                return;
            }

            if (setComboBox)
            {
                cbxLookup.SelectedItem = t;
            }

            olvLookupColumns.ClearObjects();

            if (t != null)
            {
                olvLookupColumns.AddObjects(t.ColumnInfos);

                SetStage(LookupCreationStage.DragAPrimaryKey);

                pk1.IsValidGetter = c => c.TableInfo_ID == t.ID;
                pk2.IsValidGetter = c => c.TableInfo_ID == t.ID;
                pk3.IsValidGetter = c => c.TableInfo_ID == t.ID;

                fk1.IsValidGetter = c => c.TableInfo_ID != t.ID;
                fk2.IsValidGetter = c => c.TableInfo_ID != t.ID;
                fk3.IsValidGetter = c => c.TableInfo_ID != t.ID;
            }
            else
            {
                SetStage(LookupCreationStage.ChooseLookupTable);
            }
        }
示例#3
0
        private void btnFetchData_Click(object sender, EventArgs e)
        {
            fetchDataResultedInNoErrors = true;
            var fetcher = new DiffDatabaseDataFetcher(_batchSizeToGet, _toInterrogate, _dataLoadRunID, _timeout);

            fetcher.FetchData(this);

            dgInserts.DataSource = fetcher.Inserts;

            if (fetcher.Updates_New == null || fetcher.Updates_Replaced == null)
            {
                diffDataTables1.Clear();
            }
            else
            {
                diffDataTables1.PopulateWith(fetcher.Updates_New, fetcher.Updates_Replaced);
            }

            //if user is already viewing the updates we will need to re-highlight
            if (tabControl1.SelectedTab == tpViewUpdates)
            {
                diffDataTables1.HighlightDiffCells();
            }

            //we didn't see any errors so probably everything was fine
            if (fetchDataResultedInNoErrors)
            {
                WideMessageBox.Show("Data Ready", "Data ready for you to view in the Inserts / Updates tabs", WideMessageBoxTheme.Help);
            }
        }
示例#4
0
        public void Test_WideMessageBox_LargeStrings()
        {
            StringBuilder sb = new StringBuilder();

            //send wide message box a million characters
            for (int i = 0; i < 1_000_000; i++)
            {
                sb.Append("f");
            }

            var s    = sb.ToString();
            var args = new WideMessageBoxArgs(s, s, s, s, WideMessageBoxTheme.Help);

            //it is important that the args retain the original length e.g. so user can copy to clipboard the text
            Assert.AreEqual(1_000_000, args.Title.Length);
            Assert.AreEqual(1_000_000, args.Message.Length);

            var wmb = new WideMessageBox(args);

            //pretend like we launched it
            LastUserInterfaceLaunched = wmb;

            //the title and body should be a reasonable length
            Assert.AreEqual(WideMessageBox.MAX_LENGTH_TITLE, GetControl <Label>().Single().Text.Length);
            Assert.AreEqual(WideMessageBox.MAX_LENGTH_BODY, GetControl <RichTextBox>().Single().Text.Length);

            //when shown on screen it should not go off the edge of the screen

            //find the widest screen
            var availableWidth = Screen.AllScreens.Select(sc => sc.Bounds.Width).Max();

            Assert.LessOrEqual(wmb.Width, availableWidth);
        }
示例#5
0
        public void Test_WideMessageBox_TinyStrings()
        {
            var args = new WideMessageBoxArgs("1", "2", "3", "4", WideMessageBoxTheme.Help);

            //it is important that the args retain the original length e.g. so user can copy to clipboard the text
            Assert.AreEqual(1, args.Title.Length);
            Assert.AreEqual(1, args.Message.Length);

            var wmb = new WideMessageBox(args);

            // simulate showing the control without actually blocking/firing
            var onShow = typeof(WideMessageBox).GetMethod("OnShown", BindingFlags.NonPublic | BindingFlags.Instance);

            onShow.Invoke(wmb, new[] { new EventArgs() });

            //pretend like we launched it
            LastUserInterfaceLaunched = wmb;

            //the title and body should be a reasonable length
            Assert.AreEqual(1, GetControl <Label>().Single().Text.Length);
            Assert.AreEqual(1, GetControl <RichTextBox>().Single().Text.Length);

            //dialog shouldn't go thinner than 600 pixels
            Assert.AreEqual(600, wmb.Width);
        }
示例#6
0
        void lbCohortDatabaseTable_ButtonClick(object sender, CellClickEventArgs e)
        {
            var ecd = e.Model as ExtractableCohortDescription;

            if (e.Column == olvViewLog && ecd != null)
            {
                WideMessageBox.Show("Cohort audit log", ecd.Cohort.AuditLog, WideMessageBoxTheme.Help);
            }
        }
示例#7
0
        private void btnPrimaryKeyCompositeHelp_Click(object sender, EventArgs e)
        {
            WideMessageBox.Show("Lookup help",
                                @"Usually you only need one primary key/foreign key relationship e.g. M=Male, F=Female in which z_GenderLookup..Sex is the primary key and Demography..PatientGender is the foreign key.  However sometimes you need additional lookup joins.

For example:
if the Drug Code 'TIB' is reused in Tayside and Fife healthboard with different meanings then the primary key/foreign key would of the Lookup table would have to be both the 'Code' (TIB) and the 'Prescribing Healthboard' (T or F).

Only define secondary columns if you really need them! if any of the key fields do not match between the Lookup table and the Dataset table then no lookup description will be recorded",
                                null, true, null, WideMessageBoxTheme.Help);
        }
示例#8
0
        public static void Show(string title, string message, string environmentDotStackTrace = null, bool isModalDialog = true, string keywordNotToAdd = null, WideMessageBoxTheme theme = WideMessageBoxTheme.Exception)
        {
            WideMessageBox wmb = new WideMessageBox(new WideMessageBoxArgs(title, message, environmentDotStackTrace, keywordNotToAdd, theme));

            if (isModalDialog)
            {
                wmb.ShowDialog();
            }
            else
            {
                wmb.Show();
            }
        }
示例#9
0
        private void tlvConfiguration_ItemActivate(object sender, EventArgs e)
        {
            var o = tlvConfiguration.SelectedObject as ICompileable;

            if (o != null)
            {
                if (o.CrashMessage != null)
                {
                    ViewCrashMessage(o);
                }
                else
                {
                    WideMessageBox.Show("Build Log", o.Log, WideMessageBoxTheme.Help);
                }
            }
        }
示例#10
0
        public void Test_WideMessageBox_TinyStrings()
        {
            var args = new WideMessageBoxArgs("1", "2", "3", "4", WideMessageBoxTheme.Help);

            //it is important that the args retain the original length e.g. so user can copy to clipboard the text
            Assert.AreEqual(1, args.Title.Length);
            Assert.AreEqual(1, args.Message.Length);

            var wmb = new WideMessageBox(args);

            //pretend like we launched it
            LastUserInterfaceLaunched = wmb;

            //the title and body should be a reasonable length
            Assert.AreEqual(1, GetControl <Label>().Single().Text.Length);
            Assert.AreEqual(1, GetControl <RichTextBox>().Single().Text.Length);

            //dialog shouldn't go thinner than 600 pixels
            Assert.AreEqual(600, wmb.Width);
        }
示例#11
0
        public bool OnCheckPerformed(CheckEventArgs args)
        {
            //if there is a fix suggest it to the user
            if (args.ProposedFix != null)
            {
                return(ShowYesNoMessageBoxToApplyFix(_dialog, args.Message, args.ProposedFix));
            }

            //else show an Exception
            if (args.Ex != null)
            {
                ExceptionViewer.Show(args.Ex);
            }
            else
            if (args.Result == CheckResult.Fail)
            {
                WideMessageBox.Show(args.Message, "", environmentDotStackTrace: Environment.StackTrace);
            }

            return(false);
        }
示例#12
0
        private void BuildRightClickMenu(ICompileable c)
        {
            if (c != null)
            {
                var menu = new ContextMenuStrip();

                menu.Items.Add(
                    BuildItem("View Sql", c, a => !string.IsNullOrWhiteSpace(a.CountSQL),
                              a => WideMessageBox.Show($"Sql {c}", a.CountSQL, WideMessageBoxTheme.Help))
                    );


                menu.Items.Add(
                    new ToolStripMenuItem("View Crash Message", null,
                                          (s, e) => ViewCrashMessage(c))
                {
                    Enabled = c.CrashMessage != null
                });

                menu.Items.Add(
                    new ToolStripMenuItem("View Build Log", null,
                                          (s, e) => WideMessageBox.Show($"Build Log {c}", c.Log, WideMessageBoxTheme.Help)));

                menu.Items.Add(
                    BuildItem("View Results", c, a => a.Identifiers != null,
                              a =>
                {
                    Activator.ShowWindow(new DataTableViewerUI(a.Identifiers, $"Results {c}"));
                })
                    );

                tlvConfiguration.ContextMenuStrip = menu;
            }
            else
            {
                tlvConfiguration.ContextMenuStrip = null;
            }
        }
示例#13
0
        private void olvComponents_CellRightClick(object sender, CellRightClickEventArgs e)
        {
            var model = (AdvertisedPipelineComponentTypeUnderContext)e.Model;

            ContextMenuStrip RightClickMenu = new ContextMenuStrip();

            if (model != null)
            {
                if (!model.IsCompatible())
                {
                    RightClickMenu.Items.Add("Component incompatible", null, (s, v) => WideMessageBox.Show(model.ToString(), model.GetReasonIncompatible(), WideMessageBoxTheme.Help));
                }
            }

            //show it
            if (RightClickMenu.Items.Count != 0)
            {
                RightClickMenu.Show(this, e.Location);
            }
        }
示例#14
0
 public override void Execute()
 {
     base.Execute();
     WideMessageBox.Show(_title, _help, WideMessageBoxTheme.Help);
 }