static Logger() { // Set log level LogLevel = (Status)Properties.Settings.Default.LogLevel; // Get working AppData Local directory string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MultiTablePro"); if (Debugger.IsAttached) // Seperate directory for debugger { path = Path.Combine(path, "Debug"); } // Enter logs subdirectory & create if it doesn't exist. path = Path.Combine(path, "Logs"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Create log filename with timestamp LogFilePath = Path.Combine(path, string.Format("mtp-{0}.log", DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"))); // Start log writer GHelper.SafeThreadStart(() => StartLogWriter()); // Application exit event Application.Current.Exit += Application_Exit; // Clean log files older than 6 months GHelper.SafeThreadStart(() => CleanLogs()); }
/// <summary> /// Starts the Window Manager /// </summary> public void Start() { lock (Table.ActionQueue) // Empty queue for new run { Table.ActionQueue = new ConcurrentQueue <Table>(); } IsRunning = true; // Start table manager GHelper.SafeThreadStart(() => ManageTables()); // Start Window Mover GHelper.SafeThreadStart(() => RunMoveWindowQueue()); // Start handlers PSLogHandler.Start(); if (Config.Active.BwinSupportEnabled) { BwinHandler.Start(); } }