} // end ShowPanel /// <summary> /// Removes the current panel and displays the new one. If it is the first /// panel, then the Back Button is disabled. /// </summary> /// <param name="newPanel">New Panel to be displayed.</param> /// <param name="bGoingBack">Indicates whether or not the user is going back</param> private void ShowPanel(WizardControlPanel newPanel, bool bGoingBack) { Cursor.Current = Cursors.WaitCursor; // Raise the ShowPanel event so that wizard knows what panel is about to be displayed. newPanel.RaiseShowPanelEvent(EventArgs.Empty); SuspendLayout(); // If the user is on a screen that is set to be skipped if the user decides to // go back, then the back button should not even be enabled. if (newPanel.SkipOnBack) { _btnBack.Enabled = false; } // end if if (_iCurrentPanel > 0 || bGoingBack) { // Removing the last added control, which should always be the wizard's panel. Controls.RemoveAt(Controls.Count - 1); } // end if newPanel.Location = new Point(0, 72); Controls.Add(newPanel); newPanel.Focus(); ResumeLayout(false); Cursor.Current = Cursors.Default; } // end ShowPanel
} // end Run #endregion #region Event Handlers #region ShowEnvironmentPanel /// <summary> /// Show Panel event for the Environment selection Panel, which sets the /// Database Connection based on the RFSmart Version 3 installation. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowEnvironmentPanel(WizardControlPanel sender, EventArgs e) { EnvironmentPanel envPanel = sender as EnvironmentPanel; if (envPanel != null) { envPanel.LoadEnvironments(new DAL("DataExporter-RFS")); } // end if } // end ShowEnvironmentPanel
} // end UncheckSelectAll #endregion #region LeaveEnvironmentPanel /// <summary> /// Leave Panel event for the EnvironmentPanel, which is used to ensure that the user has /// selected at least one RFSmart Version 3 environment. If an environment is not selected, /// the user will be shown an error message. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns>Returns true if the user has selected at least one RFSmart Version 3 environment; /// otherwise, false.</returns> private bool LeaveEnvironmentPanel(WizardControlPanel sender, EventArgs e) { if (SetSelectedEnvs() > 0) { return (true); } // end if else { MessageBox.Show("Please select at least one Environment for which the data\n" + "will be exported.", "Environment Error"); return (false); } // end else } // end LeaveEnvironmentPanel
} // end ShowDirectoryDialog #endregion #region ValidateExportFilePathProvided /// <summary> /// LeavePanel Event Handler, which validates that an Export File was specified before the user /// leaves the panel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns>Returns true if an export file was specified; otherwise, false.</returns> private bool ValidateExportFilePathProvided(WizardControlPanel sender, EventArgs e) { // Checking to ensure that an export file path has been specified if (_txtExportFilePath.Text.Trim().Length == 0) { MessageBox.Show(this, "Please specify a directory to which the export data will be exported.", "Missing Export Path", MessageBoxButtons.OK, MessageBoxIcon.Error); return (false); } // end if else { return (true); } // end else } // end ValidateExportFilePathProvided
} // end RaiseNextButtonClick #endregion #endregion #region FindPanel /// <summary> /// Find the panel within the array of panels. /// </summary> /// <param name="panel">Panel for which to search</param> /// <returns>Returns the index of the panel's location if found; otherwise, -1</returns> protected int FindPanel(WizardControlPanel panel) { int iPanelLoc; bool bFound = false; // Interating through the array of Panels seaching for the starting point for (iPanelLoc = 0; iPanelLoc < _wizSeq.Length; iPanelLoc++) { if (panel.Equals(_wizSeq[iPanelLoc])) { bFound = true; break; } // end if } // end for return (bFound ? iPanelLoc : -1); } // end FindPanel
} // end Show /// <summary> /// Show the wizard starting at the specified panel. /// </summary> /// <param name="startPanel"></param> public void Show(WizardControlPanel startPanel) { int iStartPanel; // If the panel was not found, notify the user; otherwise, show the wizard with panel iStartPanel = FindPanel(startPanel); if (iStartPanel == -1) { System.Windows.Forms.MessageBox.Show(this, "Unable to locate the starting point of the wizard!", "Startup Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // end if else { Show(iStartPanel); } // end else } // end Show
} // end IntializeComponent #endregion #region InitializeSequence /// <summary> /// Initializes the Wizard's sequence by setting the _wizSeq array with /// the panels in the order in which they should appear to the user. /// </summary> protected override void InitializeSequence() { //******************************************************************** // NOTE: If you add a new panel to the sequence, you should also // add it to the _wizPnls enumerator. //******************************************************************** _wizSeq = new WizardControlPanel[] { new IntroPanel("Welcome to the ICS, Inc. RFSmart Data " + "Exporter. This tool is to be used to " + "export data from RFSmart System tables " + "and ERP Business tables."), new EnvironmentPanel("RFSmart Version 3 Environment(s) for " + "which the data will be exported"), new ExportFilePathPanel(), new SummaryPanel(), new ProgressPanel(), new FinishedPanel("RFSmart Version 3 data export") }; //******************************************************************** } // end InitializeSequence
} // end ShowSummaryPanel #endregion #region ShowProgressPanel /// <summary> /// ShowPanel event for the ProgressPanel, which added a completed event to notify the wizard /// when the conversion is complete, and starts the conversion. /// </summary> /// <param name="sender">Progress Panel</param> /// <param name="e"></param> private void ShowProgressPanel(WizardControlPanel sender, EventArgs e) { ProgressPanel progressPanel = sender as ProgressPanel; SetActiveView(false); Cursor = System.Windows.Forms.Cursors.WaitCursor; if (progressPanel != null) { // Adding the completed event to notify the wizard when the conversion is complete progressPanel.Completed += new CompletedEventHandler(ConstructResults); // Starting the data export by calling the ProgressPanel's StartExport method passing // the Data Access Layer for RFSmart Version 3, the selected environment from which the // data will be exported, and the file to which the data will be exported. progressPanel.StartTask(new DataExporter(EnvironmentPnl.DataAccessLayer, EnvironmentPnl.Environments, ExpFilePathPnl.ExportFilePath)); } // end if } // end ShowProgressPanel
} // end ConstructResults #endregion #region ShowFinishedPanel /// <summary> /// Show Panel event handler for the Finished panel, which should set the results of the /// conversion. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowFinishedPanel(WizardControlPanel sender, EventArgs e) { ((FinishedPanel) sender).DisplayResults(); } // end ShowFinishedPanel
} // end ShowEnvironmentPanel #endregion #region ShowSummaryPanel /// <summary> /// Show Panel event for the Summary Panel, which sets the Summary of the SummaryPanel. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowSummaryPanel(WizardControlPanel sender, System.EventArgs e) { ((SummaryPanel) sender).Summary = ConstructSummary(); } // end ShowSummaryPanel
} // end ShowPreviousPanel #endregion #region ShowPanel /// <summary> /// Removes the current panel and displays the new one. If it is the first /// panel, then the Back Button is disabled. /// </summary> /// <param name="newPanel">New Panel to be displayed.</param> private void ShowPanel(WizardControlPanel newPanel) { ShowPanel(newPanel, false); } // end ShowPanel
} // end ShowPreviousPanel /// <summary> /// Displays the specified previous panel to the user. /// </summary> /// <param name="prevPanel">Previous Panel to be displayed to the user.</param> protected void ShowPreviousPanel(WizardControlPanel prevPanel) { ShowPreviousPanel(FindPanel(prevPanel)); } // end ShowPreviousPanel
} // end ShowNextPanel /// <summary> /// Displays the specified next panel to the user. /// </summary> /// <param name="nextPanel">Next Panel to be displayed to the user.</param> protected void ShowNextPanel(WizardControlPanel nextPanel) { ShowNextPanel(FindPanel(nextPanel)); } // end ShowNextPanel
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.MainPanel = new System.Windows.Forms.Panel(); this.WriterEditor = new WriterEditor(); this.ControllerEditor = new ControllerEditor(); this.DataOperationsEditor = new DataOperationsEditor(); this.DataManagerEditor = new DataManagerEditor(); this.DataObjectsEditor = new DataObjectsEditor(); this.ReaderEditor = new ReaderEditor(); this.DatabasesEditor = new DatabasesEditor(); this.ProjectEditor = new ProjectEditorControl(); this.StoredProcedureEditor = new StoredProcedureEditor(); this.WizardControlPanel = new WizardControlPanel(); this.WizardStatusControl = new WizardStatusControl(); this.MainPanel.SuspendLayout(); this.SuspendLayout(); // // MainPanel // this.MainPanel.Controls.Add(this.StoredProcedureEditor); this.MainPanel.Controls.Add(this.WriterEditor); this.MainPanel.Controls.Add(this.ControllerEditor); this.MainPanel.Controls.Add(this.DataOperationsEditor); this.MainPanel.Controls.Add(this.DataManagerEditor); this.MainPanel.Controls.Add(this.DataObjectsEditor); this.MainPanel.Controls.Add(this.ReaderEditor); this.MainPanel.Controls.Add(this.DatabasesEditor); this.MainPanel.Controls.Add(this.ProjectEditor); this.MainPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.MainPanel.Location = new System.Drawing.Point(172, 0); this.MainPanel.Name = "MainPanel"; this.MainPanel.Size = new System.Drawing.Size(680, 308); this.MainPanel.TabIndex = 2; // // WriterEditor // this.WriterEditor.BackColor = System.Drawing.Color.Transparent; this.WriterEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.WriterEditor.Location = new System.Drawing.Point(0, 0); this.WriterEditor.Name = "WriterEditor"; this.WriterEditor.Size = new System.Drawing.Size(680, 308); this.WriterEditor.TabIndex = 9; // // ControllerEditor // this.ControllerEditor.BackColor = System.Drawing.Color.Transparent; this.ControllerEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.ControllerEditor.Location = new System.Drawing.Point(0, 0); this.ControllerEditor.Name = "ControllerEditor"; this.ControllerEditor.Size = new System.Drawing.Size(680, 308); this.ControllerEditor.TabIndex = 7; // // DataOperationsEditor // this.DataOperationsEditor.BackColor = System.Drawing.Color.Transparent; this.DataOperationsEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.DataOperationsEditor.Location = new System.Drawing.Point(0, 0); this.DataOperationsEditor.Name = "DataOperationsEditor"; this.DataOperationsEditor.Size = new System.Drawing.Size(680, 308); this.DataOperationsEditor.TabIndex = 6; // // DataManagerEditor // this.DataManagerEditor.BackColor = System.Drawing.Color.Transparent; this.DataManagerEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.DataManagerEditor.Location = new System.Drawing.Point(0, 0); this.DataManagerEditor.Name = "DataManagerEditor"; this.DataManagerEditor.Size = new System.Drawing.Size(680, 308); this.DataManagerEditor.TabIndex = 5; // // DataObjectsEditor // this.DataObjectsEditor.BackColor = System.Drawing.Color.Transparent; this.DataObjectsEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.DataObjectsEditor.Location = new System.Drawing.Point(0, 0); this.DataObjectsEditor.Name = "DataObjectsEditor"; this.DataObjectsEditor.Size = new System.Drawing.Size(680, 308); this.DataObjectsEditor.TabIndex = 4; // // ReaderEditor // this.ReaderEditor.BackColor = System.Drawing.Color.Transparent; this.ReaderEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.ReaderEditor.Location = new System.Drawing.Point(0, 0); this.ReaderEditor.Name = "ReaderEditor"; this.ReaderEditor.Size = new System.Drawing.Size(680, 308); this.ReaderEditor.TabIndex = 8; // // DatabasesEditor // this.DatabasesEditor.BackColor = System.Drawing.Color.Transparent; this.DatabasesEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.DatabasesEditor.Location = new System.Drawing.Point(0, 0); this.DatabasesEditor.Name = "DatabasesEditor"; this.DatabasesEditor.SelectedDatabase = null; this.DatabasesEditor.Size = new System.Drawing.Size(680, 308); this.DatabasesEditor.TabIndex = 2; // // ProjectEditor // this.ProjectEditor.BackColor = System.Drawing.Color.Transparent; this.ProjectEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.ProjectEditor.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ProjectEditor.Location = new System.Drawing.Point(0, 0); this.ProjectEditor.Name = "ProjectEditor"; this.ProjectEditor.Size = new System.Drawing.Size(680, 308); this.ProjectEditor.TabIndex = 0; // // StoredProcedureEditor // this.StoredProcedureEditor.BackColor = System.Drawing.Color.Transparent; this.StoredProcedureEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.StoredProcedureEditor.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.StoredProcedureEditor.Location = new System.Drawing.Point(0, 0); this.StoredProcedureEditor.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.StoredProcedureEditor.Name = "StoredProcedureEditor"; this.StoredProcedureEditor.Size = new System.Drawing.Size(680, 308); this.StoredProcedureEditor.TabIndex = 11; // // WizardControlPanel // this.WizardControlPanel.BackColor = System.Drawing.Color.Transparent; this.WizardControlPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.WizardControlPanel.Dock = System.Windows.Forms.DockStyle.Bottom; this.WizardControlPanel.Font = new System.Drawing.Font("Arial Rounded MT Bold", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.WizardControlPanel.Location = new System.Drawing.Point(172, 308); this.WizardControlPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.WizardControlPanel.Name = "WizardControlPanel"; this.WizardControlPanel.Size = new System.Drawing.Size(680, 52); this.WizardControlPanel.TabIndex = 1; // // WizardStatusControl // this.WizardStatusControl.BackColor = System.Drawing.Color.LightSteelBlue; this.WizardStatusControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.WizardStatusControl.Dock = System.Windows.Forms.DockStyle.Left; this.WizardStatusControl.Location = new System.Drawing.Point(0, 0); this.WizardStatusControl.Name = "WizardStatusControl"; this.WizardStatusControl.SelectedButton = null; this.WizardStatusControl.Size = new System.Drawing.Size(172, 360); this.WizardStatusControl.TabIndex = 0; // // ProjectWizardControl // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.Linen; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.MainPanel); this.Controls.Add(this.WizardControlPanel); this.Controls.Add(this.WizardStatusControl); this.Name = "ProjectWizardControl"; this.Size = new System.Drawing.Size(852, 360); this.MainPanel.ResumeLayout(false); this.ResumeLayout(false); }