示例#1
0
        public LoggerForm(FlashSocket socket)
        {
            InitializeComponent();

            //
            // Component initialization.
            //

            cbClasses.SelectedIndex = 0;
            cbNamespaces.SelectedIndex = 0;
            cbLogLevel.SelectedIndex = 0;

            //
            // Create necessary variables
            //
            m_logger = new FlashLogger();
            m_entries = new FlashLogEntryCollection();

            //
            // Create child windows
            //
            frmProperties = new EntryPropertiesForm();

            //
            // Set up delegation
            //
            socket.DataRecieved +=
                new FlashSocket.DataRecievedHandler(m_logger.FlashSocket_DataRecieved);
            m_logger.LogEntries.ClassAdded += new FlashLogEntryCollection.CriteriaAddedHandler(
                Log_ClassAdded);
            m_logger.LogEntries.NamespaceAdded += new FlashLogEntryCollection.CriteriaAddedHandler(
                Log_NamespaceAdded);
            m_logger.LogEntries.EntryAdded += new FlashLogEntryCollection.EntryAddedHandler(
                Log_EntryAdded);

            //
            // Set up the grid
            //
            SetupGrid();
            gridLog.Selection.FocusRowEntered +=
                new SourceGrid2.RowEventHandler(gridLog_FocusRowEntered);

            //
            // Layout variables
            //
            m_grid_delta_x = this.Width - gridLog.Width;
            m_grid_delta_y = this.Height - gridLog.Height;
        }
        /// <summary>
        /// Filters and returns a copy of the collection.
        /// </summary>
        /// <param name="filters"></param>
        /// <returns></returns>
        public FlashLogEntryCollection GetFilteredSet(LogFilter[] filters)
        {
            FlashLogEntryCollection ret = new FlashLogEntryCollection();

            //
            // Cycle through the entries to determine which
            // entries match the criteria imposed.
            //
            foreach (FlashLogEntry entry in this)
            {
                if (PassesFilters(entry, filters))
                    ret.Add(entry);
            }

            return ret;
        }
示例#3
0
 /// <summary>
 /// Fired when the LogEntries collection has a namespace added.
 /// 
 /// This has the effect of adding the namespace to the filter dropdown.
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="newNamespace"></param>
 private void Log_NamespaceAdded(FlashLogEntryCollection collection, string newNamespace)
 {
     this.cbNamespaces.Items.Add(newNamespace);
 }
示例#4
0
 /// <summary>
 /// Fired when the Log collection adds an entry.
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="newEntry"></param>
 private void Log_EntryAdded(FlashLogEntryCollection collection, FlashLogEntry newEntry)
 {
     m_entries.Add(newEntry);
     gridLog.Invoke(new ObjectEventHandler(AddLogEntryToGrid), new object[1] {newEntry});
 }
示例#5
0
 /// <summary>
 /// Fired when the LogEntries collection has a class added.
 /// 
 /// This has the effect of adding the class to the filter dropdown.
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="newClass"></param>
 private void Log_ClassAdded(FlashLogEntryCollection collection, string newClass)
 {
     this.cbClasses.Items.Add(newClass);
 }
示例#6
0
 /// <summary>
 /// Creates a new instance of FlashLogger.
 /// </summary>
 public FlashLogger()
 {
     m_entries = new FlashLogEntryCollection();
 }