Загрузка данных


    public static void OpenTextFile(string filePath)
    {
        if (string.IsNullOrWhiteSpace(filePath))
            throw new ArgumentException("Путь к файлу не указан.", nameof(filePath));

        string fullPath = Path.GetFullPath(filePath);

        if (!File.Exists(fullPath))
            throw new FileNotFoundException("Файл не найден.", fullPath);

        var startInfo = new ProcessStartInfo
        {
            FileName = "kwrite",
            UseShellExecute = false,
            CreateNoWindow = true
        };

        startInfo.ArgumentList.Add(fullPath);

        Process? process = Process.Start(startInfo);

        // Важно: НЕ вызываем WaitForExit().
        // Dispose не закрывает KWrite, а только освобождает объект Process в вашем приложении.
        process?.Dispose();
    }