[英]Porting winform application to run on raspberry PI
我有一个要移植到我的新Raspberry PI 3上的ac#winform应用程序。我处于mo吟模式,因为我认为我的应用程序将可以运行。 根本不是这样。 我的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
{
}
}
}
为此,Microsoft启动了Windows 10 IoT核心移植工具。 这可以帮助您从Win32应用程序和库迁移到Windows 10 IoT核心版应用程序。 此处有更多详细信息: https : //developer.microsoft.com/zh-cn/windows/iot/win10/tools/iotapiportingtool
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.