private void AddTraceMessage(string message)
 {
     if (DgvFiles.InvokeRequired)
     {
         DgvFiles.Invoke(new Action(() => _AddTraceMessage(message)));
     }
     else
     {
         _AddTraceMessage(message);
     }
 }
示例#2
0
        /// <summary>
        /// Waits 3 seconds, checks if the file still exists and then adds it to the queue.
        /// This is neccessary because:
        /// 1.) Arc needs some time to complete writing the log file. The watcher gets triggered as soon as the writing starts.
        /// 2.) When Arc is configured to use ZIP compression, the log file is still created as usual, but after the file is written
        ///     it is then zipped and deleted again. Therefore the watcher gets triggered twice, first for the .evtc and then for the .zip.
        /// 3.) Zipping the file also needs time, so we have to wait a bit there too.
        /// </summary>
        /// <param name="path"></param>
        private async void AddDelayed(string path)
        {
            await Task.Delay(3000).ConfigureAwait(false);

            if (File.Exists(path))
            {
                if (DgvFiles.InvokeRequired)
                {
                    DgvFiles.Invoke(new Action(() => AddLogFiles(new string[] { path })));
                }
                else
                {
                    AddLogFiles(new string[] { path });
                }
            }
        }