示例#1
0
        public void Configure(IWin32Window Parent, ServerSettings Settings, string ServerDirectory)
        {
            ConfigureDialog configure   = new ConfigureDialog();
            SecurityOptions options     = null;
            string          optionsFile = DicomSecurity.GetOptionsFile(ServerDirectory);


            DicomSecurity.InitializeSecurity(ServerDirectory, Settings.AETitle);
            try
            {
                options = AddInUtils.DeserializeFile <SecurityOptions>(optionsFile);
            }
            catch
            {
                options = new SecurityOptions();
            }

            configure.Text = Settings.AETitle + " Security Options";
            configure.propertyGridOptions.SelectedObject = options;
            // SetupOwnerWindow(new HandleRef(this, Parent.Handle), new HandleRef(this, configure.Handle));
            if (configure.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AddInUtils.Serialize <SecurityOptions>(options, optionsFile);
                }
                catch { }
            }
        }
            private void toolStripButtonEditServer_Click ( object sender, EventArgs e )
            {
               try
               {
                  EditServiceDialog dialog ;
                  
                  
                  dialog = new EditServiceDialog ( ) ;

                  dialog.Settings    = AddInUtils.Clone <ServerSettings> ( WorkstationService.Settings ) ;
                  dialog.ServiceName = ServiceManager.ServiceName ;
                  dialog.Mode        = EditServiceDialog.EditMode.EditServer ;
                  
                  if ( dialog.ShowDialog ( this ) == DialogResult.OK )
                  {
                     WorkstationService.Settings = dialog.Settings ;
                     
                     LEADStorageServiceAELabel.Text = WorkstationService.Settings.AETitle ;
                     IpAddressLabel.Text            = WorkstationService.Settings.IpAddress ;
                     ServerPortLabel.Text           = WorkstationService.Settings.Port.ToString ( ) ;
                     
                     OnWorkstationServiceChanged ( this, new WorkstationServiceEventArgs ( WorkstationService.ServiceName, WorkstationService ) ) ;
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  ThreadSafeMessager.ShowError (  exception.Message ) ;
               }
            }
示例#3
0
        public static void InitializeSecurity(string ServerDirectory, string DisplayName)
        {
            CheckServerDirectory(ServerDirectory, DisplayName);
            string optionsFile = GetOptionsFile(ServerDirectory);

            try
            {
                if (File.Exists(optionsFile))
                {
                    _securityOptions = AddInUtils.DeserializeFile <SecurityOptions>(optionsFile);
                }
            }
            catch
            {
                _securityOptions = new SecurityOptions();
            }

            // If any of the options have changed, then rewrite
            // This code gets executed the first time the security addin is loaded
            // This is used to locate the certificate files (CA.pem, server.pem) and prepend the directory
            // If this happens, then we change the password to "test"
            // After the security options have loaded the first time, the code below never executes
            if (_securityOptions.FixFileNames(ServerDirectory))
            {
                try
                {
                    _securityOptions.KeyFilePassword = "******";
                    AddInUtils.Serialize <SecurityOptions>(_securityOptions, optionsFile);
                }
                catch (Exception)
                {
                }
            }
        }
            private void toolStripButtonAddAeTitle_Click ( object sender, EventArgs e )
            {
               try
               {
                  EditAeTitleDialog dialog ;
                  
                  
                  dialog = new EditAeTitleDialog ( ) ;

                  if ( dialog.ShowDialog ( this ) == DialogResult.OK )
                  {
                     AeInfo newAeInfo = AddInUtils.Clone<AeInfo> ( dialog.AeInfo ) ;
                     
                     
                     newAeInfo.Address = newAeInfo.Address ;
                     
                     try
                     {
                        WorkstationService.SendMessage ( MessageNames.AddAeTitle, newAeInfo ) ;
                     }
                     catch ( Exception ex )
                     {
                        ThreadSafeMessager.ShowError (  "Error sending message.\n" + ex.Message ) ;
                     }
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  ThreadSafeMessager.ShowError (  exception.Message ) ;
               }
            }
示例#5
0
        private void SetGateWayLicense()
        {
            if (null == ServerState.Instance.ServerService)
            {
                return;
            }

            AdvancedSettings serverSettings = AdvancedSettings.Open(ServerState.Instance.ServerService.ServiceDirectory);
            List <string>    gatewaysList   = serverSettings.GetAddInCustomData <List <string> >(typeof(GatewaySettingsPresenter).Name, typeof(GatewayServer).Name);

            if (null == gatewaysList)
            {
                gatewaysList = new List <string>();
            }

            ServerState.Instance.ServiceAdmin.LoadServices(gatewaysList);

            foreach (string gatewayService in gatewaysList)
            {
                if (ServerState.Instance.ServiceAdmin.Services.ContainsKey(gatewayService))
                {
                    DicomService gateway    = ServerState.Instance.ServiceAdmin.Services[gatewayService];
                    string       configFile = Path.Combine(gateway.ServiceDirectory, "settings.xml");

                    gateway.Settings.LicenseFile = ServerState.Instance.ServerService.Settings.LicenseFile;
                    AddInUtils.Serialize <ServerSettings>(gateway.Settings, configFile);
                }
            }
        }
示例#6
0
        private void PropertyMapperDialog_Shown(object sender, EventArgs e)
        {
            CodeParameter2 fromParameter = m_currentMethod.Parameters.Item(1) as CodeParameter2;
            string         returnType    = m_currentMethod.Type.AsFullName;
            string         fromType      = fromParameter.Type.AsFullName;

            lblFromClass.Text = fromType;
            lblToClass.Text   = returnType;
            try
            {
                InitListView(lstFromProperties, CodeModelUtils.GetPropertiesFromType(fromParameter.Type.CodeType));
            }
            catch (NotImplementedException)
            {
                AddInUtils.ShowError("The method parameter '" + fromParameter.Type.AsString + "' could not be found in the code model.  Please be sure the type exists and the project has been successfully built.");
                this.DialogResult = DialogResult.Cancel;
            }
            try
            {
                InitListView(lstToProperties, CodeModelUtils.GetPropertiesFromType(m_currentMethod.Type.CodeType));
            }
            catch (NotImplementedException)
            {
                AddInUtils.ShowError("The method return type '" + m_currentMethod.Type.AsString + "' could not be found in the code model.  Please be sure the type exists and the project has been successfully built.");
                this.DialogResult = DialogResult.Cancel;
            }

            //InitTreeView(treeView1, CodeModelUtils.GetPropertiesFromType(fromParameter.Type.CodeType));
            RefreshView();
            if (m_addInSettings.PropertyMapperAutoMapOnOpen)
            {
                AutoMap();
            }
        }
示例#7
0
        /// <summary>
        /// Fired when the confirm choices screen of the wizard is shown.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void wizardPageConfirmChoices_ShowFromNext(object sender, EventArgs e)
        {
            lstChoiceOverview.Items.Clear();

            AddInUtils.InsertListViewItem(lstChoiceOverview, "Application Name", txtApplicationName.Text, "General Settings");
            AddInUtils.InsertListViewItem(lstChoiceOverview, "Database Type", ddlDatabaseType.SelectedItem.ToString(), "General Settings");

            if (cbShowAdvancedOptions.Checked)
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "AndroMDA Launcher", ddlAndroMDABootstrap.SelectedItem.ToString(), "General Settings");
                AddInUtils.InsertListViewItem(lstChoiceOverview, "AndroMDA Version", txtAndroMDAVersion.Text, "General Settings");
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Use zipped model file", cbUseZippedModel.Checked ? "Yes" : "No", "General Settings");
            }

            AddInUtils.InsertListViewItem(lstChoiceOverview, "Common Project", usrCommonProject.ProjectName, "Project Settings");
            AddInUtils.InsertListViewItem(lstChoiceOverview, "Core Project", usrCoreProject.ProjectName, "Project Settings");

            if (cbCreateSchemaExport.Checked)
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Schema Export Project", txtSchemaExportProject.Text, "Project Settings");
            }
            else
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Generate Schema Export Project", cbCreateSchemaExport.Checked ? "Yes" : "No", "Project Settings");
            }

            if (cbConfigureUnitTestingProject.Checked)
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Testing Project", usrTestProject.ProjectName, "Project Settings");
            }
            else
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Generate Testing Project", cbConfigureUnitTestingProject.Checked ? "Yes" : "No", "Project Settings");
            }

            if (cbConfigureWebProject.Checked)
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Web Project", usrWebProject.ProjectName, "Web Settings");
                if (cbConfigureWebCommonProject.Checked)
                {
                    AddInUtils.InsertListViewItem(lstChoiceOverview, "Web Common Project", usrWebCommonProject.ProjectName, "Web Settings");
                }
                else
                {
                    AddInUtils.InsertListViewItem(lstChoiceOverview, "Configure Web Common Project", cbConfigureWebCommonProject.Checked ? "Yes" : "No", "Web Settings");
                }
                AddInUtils.InsertListViewItem(lstChoiceOverview, "NHibernate Configuration", cbUseNHibernateConfig.Checked ? "Stored in nhibernate.config" : "Stored in web.config", "Web Settings");
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Membership Support", cbAddMembershipSupport.Checked ? "Yes" : "No", "Web Settings");
            }
            else
            {
                AddInUtils.InsertListViewItem(lstChoiceOverview, "Configure Web Project", cbConfigureWebProject.Checked ? "Yes" : "No", "Web Settings");
            }
        }
示例#8
0
        public void Save()
        {
            string timeStamp   = "{0:yyyy-MM-dd_hh-mm-ss-tt}".FormatWith(DateTime.Now);
            string sopInstance = Dataset.GetValue <string>(DicomTag.SOPInstanceUID, string.Empty);
            string name        = string.Format("Store-{0}-{1}.fail", sopInstance, timeStamp);
            string fileName    = Path.Combine(Module.FailureDirectory, name);
            string dsFileName  = Path.Combine(Module.FailureDirectory, "{0}-{1}.dcm".FormatWith(sopInstance, timeStamp));

            FileName = dsFileName;
            AddInUtils.Serialize(this, fileName);
            Dataset.Save(dsFileName, DicomDataSetSaveFlags.None);
        }
示例#9
0
        /// <summary>
        /// Extract the data from :
        /// - Excel table
        /// and create a csv file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDynamicExtract_Click(object sender, RibbonControlEventArgs e)
        {
            var excelHandle = AddInUtils.GetExcelWindowHandle();

            //userInputOption = GetUserInputOption(excelHandle);
            bool secondWindowResult = false;

            // ask for data input type
            using (var frmDESelectInput = new frmDESelectInput())
            {
                do
                {
                    if (frmDESelectInput.ShowDialog(excelHandle) == DialogResult.Cancel)
                    {
                        frmDESelectInput.Close();
                        return;
                    }

                    //frmDESelectInput.Hide();

                    // get what the user selected from the frmDESelectInput
                    // 1 = Tabular Form radio button
                    userInputOption = frmDESelectInput.UserSelection;

                    // user didn't press "Cancel" on the data input type form
                    if (userInputOption > 0)
                    {
                        switch (userInputOption)
                        {
                        // user selected the Tabular Form radio button
                        case 1:
                            // the user chose "Yes"
                            processTabularFormInput(excelHandle, frmDESelectInput);

                            break;

                        // user selected option 2 radio button
                        case 2:
                            processOption2Input(excelHandle, frmDESelectInput);
                            break;
                        }
                    }
                }while (_secondWindowClosed == true);

                frmDESelectInput.Close();
            }
        }
示例#10
0
 public TestStatus RunFix()
 {
     if (!HasFix)
     {
         return(TestStatus.Error);
     }
     try
     {
         this.PerformFix();
         return(RunTest());
     }
     catch (Exception e)
     {
         AddInUtils.ShowError("The fix was not able to complete: " + e.Message);
     }
     return(TestStatus.Error);
 }
示例#11
0
            private void toolStripButtonEditAeTitle_Click ( object sender, EventArgs e )
            {
               try
               {
                  EditAeTitleDialog dialog ;
                  string oldAe ;
                  
                  
                  if ( AeTitlesListView.SelectedItems.Count == 0 )
                  {
                     return ;
                  }
                  
                  dialog = new EditAeTitleDialog ( ) ;
                  
                  dialog.AeInfo = AddInUtils.Clone<AeInfo> ( AeTitlesListView.SelectedItems [ 0 ].Tag as AeInfo ) ;
                  
                  oldAe  = dialog.AeInfo.AETitle ;

                  if ( dialog.ShowDialog ( this ) == DialogResult.OK )
                  {
                     try
                     {
                        AeInfo newAeInfo = AddInUtils.Clone<AeInfo> ( dialog.AeInfo ) ;
                        
                        
                        newAeInfo.Address = newAeInfo.Address ;
                        
                        WorkstationService.SendMessage ( MessageNames.UpdateAeTitle,
                                                         oldAe, 
                                                         newAeInfo ) ;
                     }
                     catch (Exception ex)
                     {
                        ThreadSafeMessager.ShowError (  "Error sending message.\n" + ex.Message ) ;
                     }
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  ThreadSafeMessager.ShowError (  exception.Message ) ;
               }
            }
示例#12
0
        public void Configure(IWin32Window Parent, ServerSettings Settings, string ServerDirectory)
        {
            ConfigureDialog configure = new ConfigureDialog();

            string optionsFile = HL7ServerMWL.GetOptionsFile(ServerDirectory);

            HL7ServerMWL.InitializeOptions(ServerDirectory, Settings.AETitle);

            configure.Text = Settings.AETitle + " HL7 Server Options";
            //configure.propertyGridOptions.SelectedObject = options;
            // SetupOwnerWindow(new HandleRef(this, Parent.Handle), new HandleRef(this, configure.Handle));
            if (configure.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    AddInUtils.Serialize <HL7Options>(HL7ServerMWL.HL7Options, optionsFile);
                }
                catch { }
            }
        }
        public static void InitializeOptions(string ServerDirectory, string DisplayName)
        {
            CheckServerDirectory(ServerDirectory, DisplayName);
            string optionsFile = GetOptionsFile(ServerDirectory);

            try
            {
                if (File.Exists(optionsFile))
                {
                    _hl7Options = AddInUtils.DeserializeFile <HL7Options>(optionsFile);
                }
                else
                {
                    AddInUtils.Serialize <HL7Options>(_hl7Options, optionsFile);
                }
            }
            catch
            {
                _hl7Options = new HL7Options();
            }
        }
示例#14
0
        /// <summary>
        ///     Implements the OnConnection method of the IDTExtensibility2 interface.
        ///     Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param term='application'>
        ///     Root object of the host application.
        /// </param>
        /// <param term='connectMode'>
        ///     Describes how the Add-in is being loaded.
        /// </param>
        /// <param term='addInInst'>
        /// Object representing this Add-in.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
        {
            // Store the Excel host application. Exit if host was not Excel.
            m_xlApp = application as Excel.Application;
            if (m_xlApp == null)
            {
                return;
            }

            // If an addInInst object given of the type COMAddin then it was loaded as COM add-in.
            // If addInInst is the same object as myself, then I'm loaded as Automation add-in.
            if (addInInst != this)
            {
                // Attach myself to the add-in object.
                // In that way I can call functions of this object from VBA using the add-in collection.
                Office.COMAddIn cai = addInInst as Office.COMAddIn;
                cai.Object = this;

                // Now install menu item and add event handler.
                m_menuItem        = AddInUtils.AddMenuItem(m_xlApp, cai, m_menuName, m_menuItemCaption, m_menuItemKey);
                m_menuItem.Click += new Office._CommandBarButtonEvents_ClickEventHandler(MyMenuHandler);
            }
        }
示例#15
0
 /// <summary>
 ///     Implements the OnDisconnection method of the IDTExtensibility2 interface.
 ///     Receives notification that the Add-in is being unloaded.
 /// </summary>
 /// <param term='disconnectMode'>
 ///      Describes how the Add-in is being unloaded.
 /// </param>
 /// <param term='custom'>
 ///      Array of parameters that are host application specific.
 /// </param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
 {
     AddInUtils.RemoveMenuItem(m_xlApp, disconnectMode, m_menuName, m_menuItemCaption);
 }
示例#16
0
            void __LEADWorkstationService_Message 
            ( 
               object sender, 
               MessageEventArgs e 
            )
            {
               try
               {
                  ServiceMessage message ;
                  
                  
                  if ( WorkstationService != ( sender as DicomService ) )
                  {
                     return ;
                  }
                  
                  message = AddInUtils.Clone <ServiceMessage> ( e.Message ) ;

                  switch ( message.Message )
                  {
                     case MessageNames.AddAeTitle:
                     {
                        
                        if ( message.Success )
                        {
                           AddAe ( message.Data [ 0 ] as AeInfo ) ; 
                        }
                        else
                        {
                           ThreadSafeMessager.ShowError ( 
                                                          "Error Adding AE Title.\n" + message.Error ) ;
                        }
                     }
                     break;
                     
                     case MessageNames.GetAeTitles:
                     {
                        if ( message.Success )
                        {
                           LoadAes ( message.Data [ 0 ] as List <AeInfo> ) ;
                        }
                        else
                        {
                           ThreadSafeMessager.ShowError ( 
                                                          "Error Getting AE Titles.\n" +  message.Error ) ;
                        }
                     }
                     break ;
                     
                     case MessageNames.UpdateAeTitle:
                     {
                        if ( !message.Success )
                        {
                            ThreadSafeMessager.ShowError ( 
                                                           "Error Updating AE Title.\n" + message.Error ) ;
                            
                            UpdateAe ( message.Data [ 0 ] as string, 
                                       message.Data [ 1 ] as AeInfo, 
                                       true ) ;
                        }
                        else
                        {
                           UpdateAe ( message.Data [ 0 ] as string, 
                                      message.Data [ 1 ] as AeInfo, 
                                      false ) ;
                        }
                     }
                     break ;
                     
                     case MessageNames.RemoveAeTitle:
                     {
                        if (!message.Success)
                        {
                           ThreadSafeMessager.ShowError ( 
                                                          "Error Removing AE Title\n" + message.Error ) ;
                        }
                        else
                        {
                           RemoveAe ( message.Data [ 0] as string ) ;
                        }
                     }
                     break ;
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  throw ;
               }
            }
示例#17
0
        //private int GetUserInputOption(Win32Window excelHandle)
        //{
        //    // ask for data input type
        //    using (var frmDESelectInput = new frmDESelectInput())
        //    {
        //        if (frmDESelectInput.ShowDialog(excelHandle) == DialogResult.Cancel)
        //        {
        //            frmDESelectInput.Close();

        //            // user pressed "Cancel"
        //            return 0;
        //        }

        //        // get what the user selected from the frmDESelectInput
        //        // 1 = Tabular Form radio button
        //        return frmDESelectInput.UserSelection;
        //    }
        //}

        //private void decideHowToProcessUserInput(Win32Window excelHandle)
        //{
        //    switch (userInputOption)
        //    {
        //        // user selected the Tabular Form radio button
        //        case 1:
        //            // the user chose "Yes"
        //            processTabularFormInput(excelHandle);

        //            break;

        //        // user selected option 2 radio button
        //        case 2:
        //            processOption2Input(excelHandle);
        //            break;
        //    }
        //}

        /// <summary>
        /// Take data from the current sheet of the Excel table, process it and dump the results to a csv file
        /// </summary>
        private void processTabularFormInput(Win32Window excelHandle, frmDESelectInput fDESelectInput)
        {
            //Interop.Workbook wb = AddInUtils.GetActiveWorkbook_IfExists();
            //Interop.Worksheet activeWS = AddInUtils.GetActiveWorksheet_IfExists();

            bool keepWindow2 = false;

            try
            {
                //MessageBox.Show(excelHandle, $"You have selected radio button {userInputOption}", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                string             inputTableName;
                Interop.ListObject inputTable             = null;
                char          InputCSVlistSeparatorParsed = '!';
                bool          boolVarTableHeaderInExport;
                string        csvUsrIinputListSeparator = String.Empty;
                bool          AggregateTableRowsSwitch;
                List <string> excelTableColumnsDataTypes = new List <string>();

                var wb       = AddInUtils.GetActiveWorkbook_IfExists();
                var activeWS = AddInUtils.GetActiveWorksheet_IfExists();

                // ask for table name
                using (wb)
                    using (activeWS)
                        using (var frmDETInputTableName = new frmDETInputTableName())
                        {
                            do
                            {
                                if (frmDETInputTableName.ShowDialog(fDESelectInput) == DialogResult.Cancel)
                                {
                                    frmDETInputTableName.Close();

                                    _secondWindowClosed = true;

                                    return;
                                }

                                inputTableName             = frmDETInputTableName.GetInputTableName();
                                boolVarTableHeaderInExport = frmDETInputTableName.IncludeTableHeaderValuesInExportFile();
                                csvUsrIinputListSeparator  = frmDETInputTableName.GetCSVlistSeparator();
                                AggregateTableRowsSwitch   = frmDETInputTableName.GetAggregationSwitchValue();

                                // check the table name so it's not empty, whitespace or null
                                if (String.IsNullOrEmpty(inputTableName) || String.IsNullOrWhiteSpace(inputTableName))
                                {
                                    MessageBox.Show(excelHandle, "Please enter a table name of at least 1 visible character.",
                                                    "", MessageBoxButtons.OK, MessageBoxIcon.Error);

                                    keepWindow2 = true;
                                }
                                else
                                {
                                    keepWindow2 = false;
                                }

                                if (keepWindow2 == false)
                                {
                                    ////MessageBox.Show(excelHandle, $"table name {inputTableName}", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                    InputCSVlistSeparatorParsed = Parser.GetListSeparatorFromUserInput(csvUsrIinputListSeparator);

                                    var numOfTablesInCurrentWorkbook = AddInUtils.currentWorkbookTableCount(wb);

                                    //MessageBox.Show(excelHandle, $"tables in workbook {numOfTablesInCurrentWorkbook}", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                    if (numOfTablesInCurrentWorkbook == 0 || numOfTablesInCurrentWorkbook == null)
                                    {
                                        MessageBox.Show(excelHandle, $"There are no tables in your current workbook. Please create at least one table in order to use this form of data input.",
                                                        "", MessageBoxButtons.OK,
                                                        MessageBoxIcon.Error);

                                        keepWindow2 = true;
                                    }
                                    else
                                    {
                                        keepWindow2 = false;
                                    }

                                    if (keepWindow2 == false)
                                    {
                                        inputTable = AddInUtils.ReturnInputTableFromWorkbook(wb, inputTableName);

                                        // if the input table was not found
                                        if (inputTable == null)
                                        {
                                            MessageBox.Show(excelHandle, $"The input table could not be found. Please create at least one table with the specified name in order to use this form of data input.",
                                                            "", MessageBoxButtons.OK,
                                                            MessageBoxIcon.Error);

                                            keepWindow2 = true;
                                        }
                                        else
                                        {
                                            keepWindow2 = false;
                                        }
                                    }

                                    if (keepWindow2 == false)
                                    {
                                        // the column data types are in the excelTableColumnsDataTypes var
                                        AddInUtils.GetExcelTableColumnDataTypes(excelHandle, wb, inputTable, out excelTableColumnsDataTypes);

                                        // change from default type to new type
                                        using (var frmDEShowExcelTableColumnsDataType = new frmDEShowExcelTableColumnsDataType(excelTableColumnsDataTypes,
                                                                                                                               AggregateTableRowsSwitch,
                                                                                                                               inputTable))
                                        {
                                            if (frmDEShowExcelTableColumnsDataType.ShowDialog(frmDETInputTableName) != DialogResult.Cancel)
                                            {
                                                keepWindow2 = false;

                                                // close form 2
                                                frmDETInputTableName.Close();

                                                // user input for each column store in Transform.usrInputForAggregationProcess

                                                // based on user input aggregate rows or not
                                                TextProcessor.SaveExcelTableToCSVFile(inputTable, boolVarTableHeaderInExport, InputCSVlistSeparatorParsed,
                                                                                      AggregateTableRowsSwitch, wb, activeWS);

                                                // erase all the user info about each column.
                                                // From my brief search System.Collections.Generic.Dictionary does not implement IDisposable interface
                                                Transform.usrInputForAggregationProcess.Clear();
                                            }
                                            else
                                            {
                                                keepWindow2 = true;

                                                // close form 3
                                                frmDEShowExcelTableColumnsDataType.Close();
                                            }
                                        }
                                    }
                                }
                            }while (keepWindow2 == true);

                            // don't come back to window 1
                            _secondWindowClosed = false;
                        }
            }
            catch (Exception ex)
            {
                MessageBox.Show(excelHandle, "Error occured: " + ex.Message, "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // NOT WORKING
                //if (wb != null) Marshal.ReleaseComObject(wb);
                //if (activeWS != null) Marshal.ReleaseComObject(activeWS);
            }
        }