Update 20250219 - OfficeHandling

This commit is contained in:
Stefan Hutter
2025-02-19 22:18:44 +01:00
parent 8bd079b635
commit 986e225bd9
13 changed files with 73 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms;
using Database;
using Syncfusion.Windows.Forms.Tools;
using Syncfusion.WinForms.Input.Enums;
@@ -62,6 +63,10 @@ namespace OnDoc.Klassen
if (fc.filedatetime < DateTime.Now.AddSeconds(-5))
{
found = false;
word = false;
excel = false;
pdf = false;
Logging.Logging.Debug(fc.application + " / FileChek " + fc.filename + " / " + fc.filedatetime.ToString("yyyy-MM-dd hh:mm:ss") + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), "OnDoc.Processwatch", fc.dokumentid);
if (fc.application == "Word") { word = true; }
if (fc.application == "Excel") { excel = true; }
@@ -69,20 +74,33 @@ namespace OnDoc.Klassen
if (word)
{
Thread.Sleep(200);
Process[] localByName = Process.GetProcessesByName("WINWORD");
foreach (Process p in localByName)
{
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1) { found = true; }
save_to_db(fc);
}
foreach (Process p in localByName)
{
Logging.Logging.Debug(fc.dokumentid + "/" + p.MainWindowTitle, "", "");
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1)
{
found = true;
save_to_db(fc);
break;
}
}
}
if (excel)
{
Process[] localByName = Process.GetProcessesByName("EXCEL");
foreach (Process p in localByName)
{
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > 0) { found = true; }
save_to_db(fc);
if (p.MainWindowTitle.IndexOf(fc.dokumentid) > -1) {
found = true;
save_to_db(fc);
}
}
}
if (!found)