0

我有 ac# winform 应用程序,我想移植它以在我的新 Raspberry PI 3 上运行。我处于呻吟模式,因为我认为我的应用程序会运行。根本不是这样。我的 winform 应用程序使用夸脱。net、aforge 库和常见的 .net 库,例如system.configuration. 我虽然会从我的日志类开始,因为有人提到如果需要更改任何内容,非 UI 代码应该很容易转换。这看起来我将不得不重新发明轮子。具体来说,请查看下面的函数。任何使用的代码system.configuration不管用。有没有更简单的方法可以让我的应用程序正常工作,或者我必须从字面上转换几乎所有的代码。aforge 库甚至会在 PI 上工作吗?quart.net 能用吗?现在我想放弃并购买一台运行“正确”窗口的小型 Windows PC。

C# Winform 代码

class Logging
{

    public void Write_To_Log_File(String Message, String Procedure, String Error_Code, String Error_String)
    {
        try
        {
            // If the log file is bigger than allowed size then archive
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {

                FileInfo file = new FileInfo(@ConfigurationManager.AppSettings["LogSavePath"]);
                if (file.Length > Convert.ToInt32(ConfigurationManager.AppSettings["FileLogSizeLimit"]))
                {
                    // Rename the file
                    File.Move(@ConfigurationManager.AppSettings["LogSavePath"], @ConfigurationManager.AppSettings["LogSavePath"] + string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now) + ".csv");
                }

            }
            // If log file does not exist then create it and add the headers
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {
            }
            else
            {
                // Create the file
                System.IO.File.Create("LogSavePath");
                // Add data
                string[] Headers = { "Time" + "," + "_Message" + "," + "Procedure" + "," + "Error_Code" + "," + "Error_String" };
                System.IO.File.AppendAllLines(@ConfigurationManager.AppSettings["LogSavePath"], Headers);
            }
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {
                string[] Log = { DateTime.Now.ToString() + "," + Message + "," + Procedure + "," + Error_Code + "," + Error_String };
                System.IO.File.AppendAllLines(@ConfigurationManager.AppSettings["LogSavePath"], Log);
            }

        }
        catch
        {

        }
    }
}
4

1 回答 1

2

为此,微软推出了 Windows 10 IoT Core Porting Tool。这可以帮助您从 Win32 应用和库迁移到 Windows 10 IoT Core 应用。更多详细信息:https ://developer.microsoft.com/en-us/windows/iot/win10/tools/iotapiportingtool

于 2016-04-24T11:09:22.353 回答