One struct defines the content of mapped Excel spreadsheet: the full name of this file and the sheet. Only the opened sheet is reserved by this struct.
コード例 #1
0
        /// <summary>
        /// Display current Room sheet information: Excel path
        /// </summary>
        private void UpdateRoomMapSheetInfo()
        {
            int       hashCode    = m_document.GetHashCode();
            SheetInfo xlsAndTable = new SheetInfo("", "");

            if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
            {
                roomExcelTextBox.Text = "Mapped Sheet: " + xlsAndTable.FileName + ": " + xlsAndTable.SheetName;
            }
        }
コード例 #2
0
 /// <summary>
 /// Get the sheet information of document.
 /// </summary>
 /// <param name="hashCode">The hash code of document.</param>
 /// <param name="sheetInfo">The mapped spread file and sheet information.</param>
 /// <returns>Indicates whether find the spread sheet mapped by this document.
 /// True if mapped spreadsheet information found, else false.</returns>
 public bool DocMappedSheetInfo(int hashCode, ref SheetInfo sheetInfo)
 {
     if (!DocMonitored(hashCode))
     {
         return(false);
     }
     else
     {
         return(m_docMapDict.TryGetValue(hashCode, out sheetInfo));
     }
 }
コード例 #3
0
 /// <summary>
 /// Update or reset the sheet information to which document is being mapped.
 /// </summary>
 /// <param name="hashCode">Hash code of document used as key to find mapped spreadsheet.</param>
 /// <param name="newSheetInfo">New value for spreadsheet.</param>
 public void UpdateSheeInfo(int hashCode, SheetInfo newSheetInfo)
 {
     if (!DocMonitored(hashCode))
     {
         m_docMapDict.Add(hashCode, newSheetInfo);
     }
     else
     {
         m_docMapDict.Remove(hashCode);
         m_docMapDict.Add(hashCode, newSheetInfo);
     }
 }
コード例 #4
0
        /// <summary>
        /// Import room spread sheet and display them in form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void importRoomButton_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog sfdlg = new OpenFileDialog())
            {
                // file dialog initialization
                sfdlg.Title            = "Import Excel File";
                sfdlg.Filter           = "Excel File(*.xls)|*.xls";
                sfdlg.RestoreDirectory = true;
                //
                // initialize the default file name
                int       hashCode    = m_document.GetHashCode();
                SheetInfo xlsAndTable = new SheetInfo(String.Empty, String.Empty);
                if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
                {
                    sfdlg.FileName = xlsAndTable.FileName;
                }
                //
                // import the select
                if (DialogResult.OK == sfdlg.ShowDialog())
                {
                    try
                    {
                        // create xls data source connector and retrieve data from it
                        m_dataBaseName = sfdlg.FileName;
                        XlsDBConnector xlsCon = new XlsDBConnector(m_dataBaseName);

                        // bind table data to grid view and ComboBox control
                        tablesComboBox.DataSource = xlsCon.RetrieveAllTables();

                        // close the connection
                        xlsCon.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tablesComboBox.DataSource = null;
                        MyMessageBox(ex.Message, MessageBoxIcon.Warning);
                    }
                }
            }
        }
コード例 #5
0
ファイル: EventsReactor.cs プロジェクト: AMEE/revit
 /// <summary>
 /// Update or reset the sheet information to which document is being mapped.
 /// </summary>
 /// <param name="hashCode">Hash code of document used as key to find mapped spreadsheet.</param>
 /// <param name="newSheetInfo">New value for spreadsheet.</param>
 public void UpdateSheeInfo(int hashCode, SheetInfo newSheetInfo)
 {
     if(!DocMonitored(hashCode))
     {
         m_docMapDict.Add(hashCode, newSheetInfo);
     }
     else
     {
         m_docMapDict.Remove(hashCode);
         m_docMapDict.Add(hashCode, newSheetInfo);
     }
 }
コード例 #6
0
ファイル: EventsReactor.cs プロジェクト: AMEE/revit
 /// <summary>
 /// Get the sheet information of document.
 /// </summary>
 /// <param name="hashCode">The hash code of document.</param>
 /// <param name="sheetInfo">The mapped spread file and sheet information.</param>
 /// <returns>Indicates whether find the spread sheet mapped by this document.
 /// True if mapped spreadsheet information found, else false.</returns>
 public bool DocMappedSheetInfo(int hashCode, ref SheetInfo sheetInfo)
 {
     if(!DocMonitored(hashCode))
     {
         return false;
     }
     else
     {
         return m_docMapDict.TryGetValue(hashCode, out sheetInfo);
     }
 }
コード例 #7
0
ファイル: RoomScheduleForm.cs プロジェクト: AMEE/revit
 /// <summary>
 /// Display current Room sheet information: Excel path
 /// </summary>
 private void UpdateRoomMapSheetInfo()
 {
     int hashCode = m_document.GetHashCode();
     SheetInfo xlsAndTable = new SheetInfo("", "");
     if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
     {
         roomExcelTextBox.Text = "Mapped Sheet: " + xlsAndTable.FileName + ": " + xlsAndTable.SheetName;
     }
 }
コード例 #8
0
ファイル: RoomScheduleForm.cs プロジェクト: AMEE/revit
        /// <summary>
        /// Import room spread sheet and display them in form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void importRoomButton_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog sfdlg = new OpenFileDialog())
            {
                // file dialog initialization
                sfdlg.Title = "Import Excel File";
                sfdlg.Filter = "Excel File(*.xls)|*.xls";
                sfdlg.RestoreDirectory = true;
                //
                // initialize the default file name
                int hashCode = m_document.GetHashCode();
                SheetInfo xlsAndTable = new SheetInfo(String.Empty, String.Empty);
                if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
                {
                    sfdlg.FileName = xlsAndTable.FileName;
                }
                //
                // import the select
                if (DialogResult.OK == sfdlg.ShowDialog())
                {
                    try
                    {
                        // create xls data source connector and retrieve data from it
                        m_dataBaseName = sfdlg.FileName;
                        XlsDBConnector xlsCon = new XlsDBConnector(m_dataBaseName);

                        // bind table data to grid view and ComboBox control
                        tablesComboBox.DataSource = xlsCon.RetrieveAllTables();

                        // close the connection
                        xlsCon.Dispose();
                    }
                    catch (Exception ex)
                    {
                        tablesComboBox.DataSource = null;
                        MyMessageBox(ex.Message, MessageBoxIcon.Warning);
                    }
                }
            }
        }