我有一个以隐藏模式运行的应用程序。在新版本中,我需要更新数据库,这就是为什么我需要显示某种形式以从用户那里获取一些数据以进行更新的原因。我使用 Form.ShowDialog
方法但出现错误。据说是错误的
"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application".
我想我需要以其他方式显示形式,但我不知道该怎么做。
当我运行它时它运行良好,我想我应该手动将其称为服务器。但是当另一个服务启动时 代码:
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(path);
startInfo.WorkingDirectory = ServerModel.ServerInfo.ServerDir;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process.Start(startInfo);
发生此错误。
最佳答案
我建议使用 Windows 气球通知,因为它们不是为了显示来自隐藏应用的消息。
参见 this link供引用。
关于c# - 隐藏应用程序中的 Form.ShowDialog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21475141/