Beispiel #1
0
        private void DisplayLogWindow()
        {
            if (logUC == null)
            {
                logUC = new FormLog();
                logUC.DisposeEvent += HandleLogWindowClose;
                //To show trace on screen. Might need a switch later.
                logMemoListerner = new MemoTraceListener(logUC.Box);
                Trace.Listeners.Add(logMemoListerner);
                System.Drawing.Size  size     = Settings.Default.LogWinSize;
                System.Drawing.Point position = Settings.Default.LogWinPosition;
                if (size.Height < 250)
                {
                    size.Height = 250;
                }

                if (size.Width < 250)
                {
                    size.Width = 250;
                }

                logUC.Location = position;
                logUC.Size     = size;
                logUC.Show();
            }
        }
Beispiel #2
0
        private void HandleLogWindowClose(object sender, EventArgs e)
        {
            LocationSizeChangedEventArgs ev = e as LocationSizeChangedEventArgs;

            logUC = null;
            Trace.Listeners.Remove(logMemoListerner);
            logMemoListerner = null;
            if (ev != null)
            {
                Settings.Default.LogWinPosition = ev.Location;
                Settings.Default.LogWinSize     = ev.Size;
                Settings.Default.Save();
            }
        }