Beispiel #1
0
        Journaling m_dataBuffer; // A reference of Journaling.

        #endregion Fields

        #region Constructors

        // Methods
        /// <summary>
        /// Constructor of JournalingForm
        /// </summary>
        /// <param name="dataBuffer">A reference of Journaling class</param>
        public JournalingForm(Journaling dataBuffer)
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            //Get a reference of ModelLines
            m_dataBuffer = dataBuffer;

            // Bind the data source of the typeComboBox and levelComboBox
            typeComboBox.DataSource = m_dataBuffer.WallTypes;
            typeComboBox.DisplayMember = "Name";
            levelComboBox.DataSource = m_dataBuffer.Levels;
            levelComboBox.DisplayMember = "Name";
        }
        private void StopServiceHostStorage()
        {
            try
            {
                _logger.Info("StopServiceHostStorage -> stopping service document storage...");
                Journaling.WriteJournaling(LoggingSource.BiblosDS_WindowsService_WCFHost,
                                           "StopServiceHostStorage", string.Empty, "Stop", LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Trace,
                                           null, null, null);

                if (_serviceHostStorage != null)
                {
                    _serviceHostStorage.Close();
                    _serviceHostStorage = null;
                }
            }
            catch (Exception ex)
            {
                _logger.Error("StopServiceHostStorage -> error on stop service document storage", ex);
                Logging.WriteLogEvent(LoggingSource.BiblosDS_WindowsService_WCFHost, "StopServiceHostStorage",
                                      string.Concat("Error occured when stop service document storage : ", ex.ToString()), LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Managed_Error);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
                                               ref string message,
                                               ElementSet elements)
        {
            try
            {
                Transaction tran = new Transaction(commandData.Application.ActiveUIDocument.Document, "Journaling");
                tran.Start();
                // Create a real operate class
                Journaling deal = new Journaling(commandData);
                deal.Run();     // The main deal operation
                tran.Commit();

                // if everything goes well, return succeeded.
                return Autodesk.Revit.UI.Result.Succeeded;
            }
            catch (Exception ex)
            {
                // If there is something wrong, give error information and return failed
                message = ex.Message;
                return Autodesk.Revit.UI.Result.Failed;
            }
        }
        private void StartServiceHostPreservation()
        {
            try
            {
                _logger.Info("StartServiceHostPreservation -> hosting and start service preservation...");
                Journaling.WriteJournaling(LoggingSource.BiblosDS_WindowsService_WCFHost, "StartServiceHostPreservation", string.Empty, "Start",
                                           LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Trace, null, null, null);

                if (_serviceHostPreservation != null)
                {
                    _serviceHostPreservation.Close();
                }

                _serviceHostPreservation = new ServiceHost(typeof(ServicePreservation));
                _serviceHostPreservation.Open();
                _logger.Info("StartServiceHostPreservation -> service preservation started correctly");
            }
            catch (Exception ex)
            {
                _logger.Error("StartServiceHostPreservation -> error on start service preservation", ex);
                Logging.WriteLogEvent(LoggingSource.BiblosDS_WindowsService_WCFHost, "StartServiceHostPreservation",
                                      string.Concat("Error occured when start service preservation : ", ex.ToString()), LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Errors);
            }
        }