protected virtual void Dispose(bool disposing)
        {
            if (isDisposed == false)
            {
                isDisposed = true;

                if (disposing)
                {
                    if (channel != null)
                    {
                        channel.Dispose();
                        channel = null;
                    }

                    if (session != null)
                    {
                        session.Dispose();
                        session = null;
                    }
                }
            }
        }
        public void StartLogging()
        {
            CheckDisposed();

            // If no session exists, create one.
            // NOTE: There are use cases where an application
            // may want to create only a channel for sessions outside
            // of the application itself. See MSDN for details. This
            // sample is the common scenario of an app logging events
            // which it wants to place in its own log file, so it creates
            // a session and channel as a pair. The channel is created
            // during construction of this LoggingScenario class so
            // it already exsits by the time this function is called.
            if (session == null)
            {
                session = new Windows.Foundation.Diagnostics.LoggingSession(DEFAULT_SESSION_NAME);
            }

            // This sample adds the channel at level "warning" to
            // demonstrated how messages logged at more verbose levels
            // are ignored by the session.
            session.AddLoggingChannel(channel, LoggingLevel.Warning);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (isDisposed == false)
            {
                isDisposed = true;

                if (disposing)
                {
                    if (channel != null)
                    {
                        channel.Dispose();
                        channel = null;
                    }

                    if (session != null)
                    {
                        session.Dispose();
                        session = null;
                    }
                }
            }
        }
        public void StartLogging()
        {
            CheckDisposed();

            // If no session exists, create one.
            // NOTE: There are use cases where an application
            // may want to create only a channel for sessions outside
            // of the application itself. See MSDN for details. This
            // sample is the common scenario of an app logging events
            // which it wants to place in its own log file, so it creates
            // a session and channel as a pair. The channel is created 
            // during construction of this LoggingScenario class so 
            // it already exsits by the time this function is called. 
            if (session == null)
            {
                session = new Windows.Foundation.Diagnostics.LoggingSession(DEFAULT_SESSION_NAME);
            }

            // This sample adds the channel at level "warning" to 
            // demonstrated how messages logged at more verbose levels
            // are ignored by the session. 
            session.AddLoggingChannel(channel, LoggingLevel.Warning);
        }