Exemplo n.º 1
0
        /// <summary>
        /// Set trace.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="options">The options.</param>
        public static void SetTrace(SourceLevels level, TraceOptions options)
        {
            if (listener == null)
            {
                listener = new BindingErrorTraceListener();
                PresentationTraceSources.DataBindingSource.Listeners.Add(listener);
            }

            listener.TraceOutputOptions = options;
            PresentationTraceSources.DataBindingSource.Switch.Level = level;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Close trace.
        /// </summary>
        public static void CloseTrace()
        {
            if (listener == null)
            {
                return;
            }

            listener.Flush();
            listener.Close();
            PresentationTraceSources.DataBindingSource.Listeners.Remove(listener);
            listener = null;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="container">Unity container.</param>
        public MainWindow(IUnityContainer container)
        {
            #if DEBUG
            // Trace binding errors.
            BindingErrorTraceListener.SetTrace();
            #endif

            Log.Debug("InitializeComponent of MainWindow.");
            this.InitializeComponent();

            // Fix issue with no windows border.
            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight - (3 * SystemParameters.FixedFrameHorizontalBorderHeight);

            Log.Debug("Initialization of MainViewModel.");
            var mainViewModel = container.Resolve <MainViewModel>();
            this.DataContext = mainViewModel;
            Log.Debug("MainViewModel was initialized.");
        }