コード例 #1
0
 private void btnClearFromCache_Click(object sender, EventArgs e)
 {
     try
     {
         GetCacheManager().DeleteCacheEntryIfAny(AggregateConfiguration, AggregateOperation.ExtractableAggregateResults);
         MessageBox.Show(
             "Cached results deleted, they should no longer appear on the website (subject to website page level caching in IIS etc of course)");
         btnClearFromCache.Enabled = false;
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
コード例 #2
0
        private void PopulateAsEmptyDescriptionsChart()
        {
            try
            {
                CatalogueItem[] catalogueItems = GetCatalogueItems();

                if (!catalogueItems.Any())
                {
                    chart1.DataSource   = null;
                    chart1.Visible      = false;
                    lblNoIssues.Visible = true;

                    return;
                }

                int countPopulated    = 0;
                int countNotPopulated = 0;

                foreach (CatalogueItem ci in catalogueItems)
                {
                    if (string.IsNullOrWhiteSpace(ci.Description))
                    {
                        countNotPopulated++;
                    }
                    else
                    {
                        countPopulated++;
                    }
                }

                DataTable dt = new DataTable();
                dt.Columns.Add("Count");
                dt.Columns.Add("State");

                dt.Rows.Add(new object[] { countNotPopulated, "Missing (" + countNotPopulated + ")" });
                dt.Rows.Add(new object[] { countPopulated, "Populated (" + countPopulated + ")" });

                chart1.Series[0].XValueMember  = dt.Columns[1].ColumnName;
                chart1.Series[0].YValueMembers = dt.Columns[0].ColumnName;

                chart1.DataSource = dt;
                chart1.DataBind();
                chart1.Visible      = true;
                lblNoIssues.Visible = false;
            }
            catch (Exception e)
            {
                ExceptionViewer.Show(this.GetType().Name + " failed to load data", e);
            }
        }
コード例 #3
0
        /// <summary>
        /// The left list contains ExtractionInformation from the Data Catalogue, this is columns in the database which could be extracted
        /// The right list contains ExtractableColumn which is a more advanced class that contains runtime configurations such as order to be outputed in etc.
        /// </summary>
        private void SetupUserInterface()
        {
            //clear the UI
            olvAvailable.ClearObjects();
            olvSelected.ClearObjects();

            //get the catalogue and then all the items
            ICatalogue cata;

            try
            {
                cata = _dataSet.Catalogue;
            }
            catch (Exception e)
            {
                //catalogue has probably been deleted!
                ExceptionViewer.Show("Unable to find Catalogue for ExtractableDataSet", e);
                return;
            }

            //on the left

            HashSet <IColumn> toAdd = new HashSet <IColumn>();

            //add all the extractable columns from the current Catalogue
            foreach (ExtractionInformation e in cata.GetAllExtractionInformation(ExtractionCategory.Any))
            {
                toAdd.Add(e);
            }

            //plus all the Project Specific columns
            foreach (ExtractionInformation e in _config.Project.GetAllProjectCatalogueColumns(ExtractionCategory.ProjectSpecific))
            {
                toAdd.Add(e);
            }

            //add the stuff that is in Project Catalogues so they can pick these too
            olvAvailable.AddObjects(toAdd.ToArray());

            //on the right

            //add the already included ones on the right
            ConcreteColumn[] allExtractableColumns = _config.GetAllExtractableColumnsFor(_dataSet);

            //now get all the ExtractableColumns that are already configured for this configuration (previously)
            olvSelected.AddObjects(allExtractableColumns);

            RefreshDisabledObjectStatus();
        }
コード例 #4
0
        void OlvOnCellEditFinishing(object sender, CellEditEventArgs e)
        {
            if (e.RowObject == null)
            {
                return;
            }

            if (e.Column != _columnThatSupportsRenaming)
            {
                return;
            }

            //don't let them rename things to blank names
            if (string.IsNullOrWhiteSpace((string)e.NewValue))
            {
                e.Cancel = true;
                return;
            }

            var name = e.RowObject as INamed;

            try
            {
                if (name != null)
                {
                    var cmd = new ExecuteCommandRename(_activator, name, (string)e.NewValue);

                    if (cmd.IsImpossible)
                    {
                        MessageBox.Show(cmd.ReasonCommandImpossible);
                    }
                    else
                    {
                        cmd.Execute();
                    }
                }
            }
            catch (Exception exception)
            {
                e.Cancel = true;
                ExceptionViewer.Show(exception);

                //reset it to what it was before
                if (name != null)
                {
                    name.Name = (string)e.Value;
                }
            }
        }
コード例 #5
0
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var exception = e.ExceptionObject as Exception;

            if (exception == null)
            {
                return;
            }

            LogWriter.Log(exception, "Current Domain Unhandled Exception - Unknow");

            var errorViewer = new ExceptionViewer(exception);

            errorViewer.ShowDialog();
        }
コード例 #6
0
ファイル: ValidationSetupUI.cs プロジェクト: rkm/RDMP
        private void Save()
        {
            try
            {
                var final = Validator.SaveToXml();
                _catalogue.ValidatorXML = final;
                _catalogue.SaveToDatabase();
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }

            Publish(_catalogue);
        }
コード例 #7
0
ファイル: SelectedDataSetsMenu.cs プロジェクト: lulzzz/RDMP
 private void GenerateExtractionGraphs(params AggregateConfiguration[] graphsToExecute)
 {
     try
     {
         foreach (AggregateConfiguration graph in graphsToExecute)
         {
             var args = new ExtractionAggregateGraphObjectCollection(_selectedDataSet, graph);
             new ExecuteCommandExecuteExtractionAggregateGraph(_activator, args).Execute();
         }
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
コード例 #8
0
ファイル: RDMPBootStrapper.cs プロジェクト: lulzzz/RDMP
        public void Show(bool requiresDataExportDatabaseToo)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Scintilla.SetDestroyHandleBehavior(true);

            //tell me when you blow up somewhere in the windows API instead of somewhere sensible
            Application.ThreadException += (sender, args) => ExceptionViewer.Show(args.Exception, false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += (sender, args) => ExceptionViewer.Show((Exception)args.ExceptionObject, false);

            try
            {
                //show the startup dialog
                Startup startup = new Startup(_environmentInfo);
                if (!String.IsNullOrWhiteSpace(catalogueConnection) && !String.IsNullOrWhiteSpace(dataExportConnection))
                {
                    startup.RepositoryLocator = new LinkedRepositoryProvider(catalogueConnection, dataExportConnection);
                    startup.RepositoryLocator.CatalogueRepository.TestConnection();
                    startup.RepositoryLocator.DataExportRepository.TestConnection();
                }
                var startupUI = new StartupUI(startup);
                startupUI.ShowDialog();

                if (startup.RepositoryLocator == null)
                {
                    MessageBox.Show("Platform databases could not be reached.  Application will exit");
                    return;
                }

                //launch the main application form T
                _mainForm = new T();

                typeof(T).GetMethod("SetRepositoryLocator").Invoke(_mainForm, new object[] { startup.RepositoryLocator });

                if (startupUI.DoNotContinue)
                {
                    return;
                }

                Application.Run(_mainForm);
            }
            catch (Exception e)
            {
                ExceptionViewer.Show(e);
            }
        }
コード例 #9
0
ファイル: PathLinkLabel.cs プロジェクト: lulzzz/RDMP
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (!string.IsNullOrWhiteSpace(Text))
            {
                try
                {
                    UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(new DirectoryInfo(Text));
                }
                catch (Exception exception)
                {
                    ExceptionViewer.Show(exception);
                }
            }
        }
コード例 #10
0
        public override void Execute()
        {
            base.Execute();

            try
            {
                WordDataReleaseFileGenerator generator = new WordDataReleaseFileGenerator(_extractionConfiguration, Activator.RepositoryLocator.DataExportRepository);

                //null means leave word file on screen and dont save
                generator.GenerateWordFile(null);
            }
            catch (Exception e)
            {
                ExceptionViewer.Show(e);
            }
        }
コード例 #11
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            Exception tag = Tag as Exception;

            if (PopupMessagesIfAny(tag))
            {
                return;
            }

            if (tag != null)
            {
                ExceptionViewer.Show(tag);
            }
        }
コード例 #12
0
ファイル: ProgressUI.cs プロジェクト: rkm/RDMP
        void olvProgressEvents_ItemActivate(object sender, EventArgs e)
        {
            var model = olvProgressEvents.SelectedObject as ProgressUIEntry;

            if (model != null)
            {
                if (model.Exception != null)
                {
                    ExceptionViewer.Show(model.Message, model.Exception, false);
                }
                else
                {
                    WideMessageBox.Show("Progress Message", model.Message, model.Args.StackTrace, false, theme: model.GetTheme());
                }
            }
        }
コード例 #13
0
        public override void Execute()
        {
            base.Execute();

            try
            {
                var clone = _extractionConfiguration.DeepCloneWithNewIDs();

                Publish((DatabaseEntity)clone.Project);
                Emphasise(clone, int.MaxValue);
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }
        }
コード例 #14
0
        private void btnSynchronize_Click(object sender, EventArgs e)
        {
            try
            {
                bool isSync = new TableInfoSynchronizer(_tableInfo).Synchronize(new MakeChangePopup(new YesNoYesToAllDialog()));

                if (isSync)
                {
                    MessageBox.Show("TableInfo is synchronized");
                }
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }
        }
コード例 #15
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            try
            {
                FormGeneralBindings.Start(MainGrid);
            }
            catch (Exception ex)
            {
                ExceptionViewer.Show(ex, "Rhino Initialization Issue.");
            }

            EventAggregatorSingleton.I.GetEvent <BindBeginCommandEvent>().Subscribe(BindBeginCommandEventHandler, ThreadOption.UIThread);
            EventAggregatorSingleton.I.GetEvent <BindEndCommandEvent>().Subscribe(BindEndCommandEventHandler, ThreadOption.UIThread);
            EventAggregatorSingleton.I.GetEvent <BindMessageEvent>().Subscribe(BindMessageEventHandler, ThreadOption.UIThread);
            EventAggregatorSingleton.I.GetEvent <BindGenericCommandEvent>().Subscribe(BindGenericCommandEventHandler);
        }
コード例 #16
0
ファイル: ChecksUI.cs プロジェクト: lulzzz/RDMP
        void olvChecks_ItemActivate(object sender, EventArgs e)
        {
            var args = olvChecks.SelectedObject as CheckEventArgs;

            if (args != null)
            {
                if (args.Ex != null)
                {
                    ExceptionViewer.Show(args.Message, args.Ex);
                }
                else
                {
                    WideMessageBox.Show(args, false);
                }
            }
        }
コード例 #17
0
        private void GetUpdatesAsync()
        {
            Task t = new Task(() =>
            {
                try
                {
                    using (var mgr = UpdateManager.GitHubUpdateManager(Url, prerelease: true).Result)
                    {
                        var entry   = mgr.CheckForUpdate().Result;
                        _updateInfo = entry;
                        AddReleases(entry.ReleasesToApply);
                    }
                }
                catch (AggregateException ex)
                {
                    var invalid = ex.GetExceptionIfExists <InvalidOperationException>();

                    if (invalid != null && invalid.Message.Contains("Sequence contains no elements"))
                    {
                        AddReleases(new List <ReleaseEntry>());
                    }
                    else
                    {
                        ExceptionViewer.Show(ex);
                    }
                }
                catch (InvalidOperationException ex)
                {
                    if (ex.Message.Contains("Sequence contains no elements"))
                    {
                        AddReleases(new List <ReleaseEntry>());
                    }
                    else
                    {
                        ExceptionViewer.Show(ex);
                    }
                }
                catch (Exception ex)
                {
                    ExceptionViewer.Show(ex);
                }

                FinishedLoading();
            });

            t.Start();
        }
コード例 #18
0
ファイル: UpdaterUI.cs プロジェクト: HDRUK/RDMP
        private void InstallAsync(ReleaseEntry entry)
        {
            pbLoading.Visible = true;

            var t = new Task(() =>
            {
                try
                {
                    using (var mgr = UpdateManager.GitHubUpdateManager(RepoUrl, prerelease: true).Result)
                    {
                        if (entry.Version > _currentVersion)
                        {
                            _updateInfo = mgr.CheckForUpdate().Result;

                            mgr.DownloadReleases(new[] { entry }, OnProgress).Wait();

                            var updatePath = mgr.ApplyReleases(_updateInfo, OnProgress).Result;

                            Task.Run(() => Process.Start(new ProcessStartInfo(Path.Combine(updatePath, "ResearchDataManagementPlatform.exe"))));
                            Application.Exit();
                        }
                        else
                        {
                            var setupFile = Path.Combine(Environment.CurrentDirectory, "..", "packages", "Setup.exe");
                            new WebClient().DownloadFile(entry.BaseUrl + "Setup.exe", setupFile);
                            var proc = new Process()
                            {
                                StartInfo = new ProcessStartInfo(setupFile)
                            };
                            proc.EnableRaisingEvents = true;
                            proc.Exited += (s, e) => Application.Exit();
                            proc.Start();
                            proc.WaitForExit();
                        }
                    }
                }
                catch (Exception ex)
                {
                    ExceptionViewer.Show(ex);
                }

                FinishedLoading();
            });

            t.Start();
        }
コード例 #19
0
        private void RefreshUIFromDatabase()
        {
            try
            {
                ticketingControl1.ReCheckTicketingSystemInCatalogue();
            }
            catch (Exception e)
            {
                ExceptionViewer.Show(e);
            }

            splitContainer1.Enabled   = true;
            ticketingControl1.Enabled = true;

            ticketingControl1.TicketText = _catalogue.Ticket;

            tbFolder.Text = _catalogue.Folder.Path;

            if (_catalogue.Explicit_consent == null)
            {
                ddExplicitConsent.Text = "";
            }
            else if (_catalogue.Explicit_consent == true)
            {
                ddExplicitConsent.Text = "Yes";
            }
            else
            {
                ddExplicitConsent.Text = "No";
            }

            c_tbLastRevisionDate.Text = _catalogue.Last_revision_date.ToString();
            tbDatasetStartDate.Text   = _catalogue.DatasetStartDate.ToString();

            c_tbAPIAccessURL.Text = _catalogue.API_access_URL != null?_catalogue.API_access_URL.ToString() : "";

            c_tbBrowseUrl.Text = _catalogue.Browse_URL != null?_catalogue.Browse_URL.ToString() : "";

            c_tbBulkDownloadUrl.Text = _catalogue.Bulk_Download_URL != null?_catalogue.Bulk_Download_URL.ToString() : "";

            c_tbQueryToolUrl.Text = _catalogue.Query_tool_URL != null?_catalogue.Query_tool_URL.ToString() : "";

            c_tbSourceUrl.Text = _catalogue.Source_URL != null?_catalogue.Source_URL.ToString() : "";

            c_tbDetailPageURL.Text = _catalogue.Detail_Page_URL != null?_catalogue.Detail_Page_URL.ToString() : "";
        }
コード例 #20
0
        private ParameterCollectionUIOptions Create(CohortIdentificationConfiguration cohortIdentificationConfiguration)
        {
            var builder = new CohortQueryBuilder(cohortIdentificationConfiguration);

            try
            {
                builder.RegenerateSQL();
            }
            catch (QueryBuildingException ex)
            {
                ExceptionViewer.Show("There was a problem resolving all the underlying parameters in all your various Aggregates, the following dialogue is reliable only for the Globals", ex);
            }

            var paramManager = builder.ParameterManager;

            return(new ParameterCollectionUIOptions(UseCaseCohortIdentificationConfiguration, cohortIdentificationConfiguration, ParameterLevel.Global, paramManager));
        }
コード例 #21
0
        private void btnPreviewSource_Click(object sender, EventArgs e)
        {
            var pipeline = CreateAndInitializePipeline();

            if (pipeline != null)
            {
                try
                {
                    DataTableViewerUI dtv = new DataTableViewerUI(((IDataFlowSource <DataTable>)pipeline.SourceObject).TryGetPreview(), "Preview");
                    SingleControlForm.ShowDialog(dtv);
                }
                catch (Exception exception)
                {
                    ExceptionViewer.Show("Preview Generation Failed", exception);
                }
            }
        }
コード例 #22
0
        public LicenseUI()
        {
            InitializeComponent();

            try
            {
                _main       = new License("LICENSE");
                _thirdParth = new License("LIBRARYLICENSES");

                rtLicense.Text           = _main.GetLicenseText();
                rtThirdPartyLicense.Text = _thirdParth.GetLicenseText();
            }
            catch (Exception ex)
            {
                ExceptionViewer.Show(ex);
            }
        }
コード例 #23
0
        public void ShowError(Exception exception, string message, string title = "")
        {
            var exceptionViewer  = new ExceptionViewer(message, exception);
            var baseDialogWindow = new BaseDialogWindow
            {
                Title   = string.IsNullOrEmpty(title) ? "Error" : title,
                Content = exceptionViewer,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                ResizeMode            = ResizeMode.CanResizeWithGrip,
                MinHeight             = 400,
                MinWidth             = 500,
                ShowMinButton        = false,
                ShowMaxRestoreButton = false
            };

            baseDialogWindow.ShowDialog();
        }
コード例 #24
0
        void tlvTableInfoMigrations_CellEditFinishing(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            try
            {
                var col = e.RowObject as ColumnInfo;

                if (col == null)
                {
                    return;
                }

                var plan = _planManager.GetPlanForColumnInfo(col);

                if (e.Column == olvMigrationPlan)
                {
                    plan.Plan = (Plan)e.NewValue;
                }

                if (e.Column == olvDilution)
                {
                    var cbx = (ComboBox)e.Control;
                    plan.Dilution = (IDilutionOperation)cbx.SelectedItem;
                }

                if (e.Column == olvDestinationExtractionCategory)
                {
                    var cbx = (ComboBox)e.Control;
                    if ((string)cbx.SelectedItem == "Clear")
                    {
                        plan.ExtractionCategoryIfAny = null;
                    }
                    else
                    {
                        ExtractionCategory c;
                        ExtractionCategory.TryParse((string)cbx.SelectedItem, out c);
                        plan.ExtractionCategoryIfAny = c;
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }

            Check();
        }
コード例 #25
0
        public void SetupForAllCohorts(IActivateItems activator)
        {
            try
            {
                if (!haveSubscribed)
                {
                    activator.RefreshBus.EstablishLifetimeSubscription(this);
                    haveSubscribed = true;
                }

                ReFetchCohortDetailsAsync();
            }
            catch (Exception e)
            {
                ExceptionViewer.Show(this.GetType().Name + " could not load Cohorts:" + Environment.NewLine + ExceptionHelper.ExceptionToListOfInnerMessages(e), e);
            }
        }
コード例 #26
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                // Forces the DataContext AFTER the initialization. Necessary because some elements in the AppSS reference FrameworkElements within the window.
                this.DataContext = AppSS.I;
                // Sets the Context of the Additional Content
                Window_CustomOverlay.SetAdditionalContent_DataContext(AppSS.I);
            }
            catch (Exception e)
            {
                ExceptionViewer ev = ExceptionViewer.Show(e);
                Application.Current.Shutdown(1);
            }
        }
コード例 #27
0
        private void OpenVisualStudio(string filename, int lineNumber)
        {
            try
            {
                Clipboard.SetText(Path.GetFileName(filename) + ":" + lineNumber);

                var viewer = new ViewSourceCodeDialog(filename, lineNumber, Color.LawnGreen);
                viewer.ShowDialog();
            }
            catch (FileNotFoundException)
            {
                //there is no source code in the zip file
            }
            catch (Exception ex)
            {
                ExceptionViewer.Show(ex);
            }
        }
コード例 #28
0
        void _populateLoadHistory_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            llLoading.Visible = false;
            pbLoading.Visible = false;

            if (e.Error != null)
            {
                ExceptionViewer.Show(e.Error);
            }

            if (e.Cancelled)
            {
                ClearObjects();
                return;
            }

            AddObjects(_populateLoadHistoryResults);
        }
コード例 #29
0
        private void btnDeleteKeyLocation_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show(
                        "You are about to delete the RDMPs record of where the key file is to decrypt passwords, if you do this all currently configured password will become inaccessible (EVEN IF YOU CREATE A NEW KEY, YOU WILL NOT BE ABLE TO GET THE CURRENT PASSWORDS BACK), are you sure you want to do this?",
                        "Confirm deleting location of decryption key file", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
                {
                    _location.DeleteKey();
                }

                SetEnabledness();
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }
        }
コード例 #30
0
ファイル: ActivateItems.cs プロジェクト: HDRUK/RDMP
        protected override ICoreChildProvider GetChildProvider()
        {
            //constructor call in base class
            if (PluginUserInterfaces == null)
            {
                return(null);
            }

            //Dispose the old one
            ICoreChildProvider temp = null;

            //prefer a linked repository with both
            if (RepositoryLocator.DataExportRepository != null)
            {
                try
                {
                    temp = new DataExportChildProvider(RepositoryLocator, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as DataExportChildProvider);
                }
                catch (Exception e)
                {
                    ExceptionViewer.Show(e);
                }
            }

            //there was an error generating a data export repository or there was no repository specified

            //so just create a catalogue one
            if (temp == null)
            {
                temp = new CatalogueChildProvider(RepositoryLocator.CatalogueRepository, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as CatalogueChildProvider);
            }

            // first time
            if (CoreChildProvider == null)
            {
                CoreChildProvider = temp;
            }
            else
            {
                CoreChildProvider.UpdateTo(temp);
            }

            return(CoreChildProvider);
        }