/// <summary> /// Copy Constructor /// </summary> public GadgetParameters(GadgetParameters parameters) { MainVariableNames = parameters.MainVariableNames; MainVariableName = parameters.MainVariableName; columnNames = parameters.columnNames; GadgetStatusUpdate = parameters.GadgetStatusUpdate; inputVariableList = parameters.inputVariableList; CustomFilter = parameters.CustomFilter; CustomSortColumnName = parameters.CustomSortColumnName; ShouldIncludeFullSummaryStatistics = parameters.ShouldIncludeFullSummaryStatistics; ShouldUseAllPossibleValues = parameters.ShouldUseAllPossibleValues; ShouldShowCommentLegalLabels = parameters.ShouldShowCommentLegalLabels; ShouldSortHighToLow = parameters.ShouldSortHighToLow; ShouldIncludeMissing = parameters.ShouldIncludeMissing; CrosstabVariableName = parameters.CrosstabVariableName; WeightVariableName = parameters.WeightVariableName; StrataVariableNames = parameters.StrataVariableNames; ShouldIgnoreRowLimits = parameters.ShouldIgnoreRowLimits; }
/// <summary> /// Handles the DoWorker event for the worker /// </summary> /// <param name="sender">Object that fired the event</param> /// <param name="e">.NET supplied event parameters</param> private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { bool needsRefresh = false; if (e != null && e.Argument is bool) { needsRefresh = !((bool)e.Argument); } isPopulatingDataSet = true; RequestUpdateStatusDelegate requestUpdateStatus = new RequestUpdateStatusDelegate(RequestUpdateStatusMessage); CheckForCancellationDelegate checkForCancellation = new CheckForCancellationDelegate(IsCancelled); SetGadgetStatusHandler setGadgetProgress = new SetGadgetStatusHandler(RequestProgressUpdate); GadgetParameters inputs = new GadgetParameters(); inputs.GadgetStatusUpdate += new GadgetStatusUpdateHandler(requestUpdateStatus); inputs.GadgetCheckForCancellation += new GadgetCheckForCancellationHandler(checkForCancellation); inputs.GadgetCheckForProgress += new SetGadgetStatusHandler(setGadgetProgress); try { dashboardHelper.UserVarsNeedUpdating = true; dashboardHelper.PopulateDataSet(inputs); } catch (System.Data.EvaluateException) { this.Dispatcher.BeginInvoke(new SendNotificationMessageHandler(SendNotificationMessage), "The specified data filter is no longer valid.", true, NotificationButtonType.OK, true, 10); } catch (Exception ex) { Epi.WPF.Dashboard.Dialogs.MsgBox.ShowException(ex); } e.Result = needsRefresh; }
/// <summary> /// Constructs the gadget /// </summary> protected virtual void Construct() { strataGridList = new List<Grid>(); strataPanelList = new List<StackPanel>(); strataExpanderList = new List<Expander>(); strataCount = 0; GadgetOptions = new GadgetParameters(); GadgetOptions.InputVariableList = new Dictionary<string, string>(); GadgetOptions.ShouldIncludeFullSummaryStatistics = false; GadgetOptions.ShouldIncludeMissing = false; GadgetOptions.ShouldSortHighToLow = false; GadgetOptions.ShouldUseAllPossibleValues = false; GadgetOptions.StrataVariableNames = new List<string>(); GadgetOptions.PSUVariableName = string.Empty; GadgetOptions.CustomFilter = string.Empty; if (this.DashboardHelper != null) { this.dataFilters = new Epi.WPF.Dashboard.DataFilters(this.DashboardHelper); } object el = this.FindName("headerPanel"); if (el != null) { Controls.GadgetHeaderPanel headerPanel = el as Controls.GadgetHeaderPanel; headerPanel.GadgetCloseButtonClicked += new GadgetCloseButtonHandler(CloseGadget); headerPanel.GadgetOutputCollapseButtonClicked += new GadgetOutputCollapseButtonHandler(CollapseOutput); headerPanel.GadgetOutputExpandButtonClicked += new GadgetOutputExpandButtonHandler(ExpandOutput); headerPanel.GadgetConfigButtonClicked += new GadgetConfigButtonHandler(ShowHideConfigPanel); headerPanel.GadgetDescriptionButtonClicked += new GadgetDescriptionButtonHandler(ShowHideDescriptionPanel); headerPanel.GadgetFilterButtonClicked += new GadgetFilterButtonHandler(ShowCustomFilterDialog); } el = this.FindName("messagePanel"); if (el != null) { Controls.GadgetMessagePanel messagePanel = el as Controls.GadgetMessagePanel; messagePanel.MessagePanelType = Controls.MessagePanelType.StatusPanel; messagePanel.Text = string.Empty; messagePanel.Visibility = System.Windows.Visibility.Collapsed; } el = this.FindName("descriptionPanel"); if (el != null) { Controls.GadgetDescriptionPanel descriptionPanel = el as Controls.GadgetDescriptionPanel; if (!string.IsNullOrEmpty(CustomOutputDescription) && !CustomOutputHeading.Equals("(none)")) { descriptionPanel.Text = CustomOutputDescription; descriptionPanel.PanelMode = Controls.GadgetDescriptionPanel.DescriptionPanelMode.DisplayMode; } else { descriptionPanel.PanelMode = Controls.GadgetDescriptionPanel.DescriptionPanelMode.Collapsed; } } }