I've seen all the other questions regarding creating a single instance app using WPF and I've chosen to use the Microsoft's approach as described here: https://codereview.stackexchange.com/a/25667 This is working fine, but now I'd like to using Caliburn.Micro on this application and this code does not play well with caliburn. How can I have a single instance wpf application us
我已经看到关于使用WPF创建单个实例应用程序的所有其他问题,并且我已经选择使用Microsoft的方法,如下所述:https://codereview.stackexchange.com/a/25667 这工作正常,但现在我想在此应用程序上使用Caliburn.Micro,并且此代码与caliburn无法正常工作。 如何使用caliburn micro获得单个实例wpf应用程序? 这个要求非常简单:.net 4.5和每个用户会话只有一个应用程序实例 谢谢 我在我的主要方法中使用一个有名互斥体
I've a C# application that displays a login form when launched and displays the main form after users are authenticated. I used Mutex to restrict that only one instance of my application runs. And, this works fine for only the Login form. Once the main form is displayed, it doesn't restrict users from reopening the Login form. I was looking for a solution by which the Login screen cou
我有一个C#应用程序,它在启动时显示登录表单,并在用户通过身份验证后显示主窗体。 我使用Mutex来限制我的应用程序只运行一个实例。 而且,这只适用于登录表单。 一旦显示主窗体,它不会限制用户重新打开登录窗体。 我一直在寻找一种解决方案,一旦主窗体已经打开,登录屏幕无法显示。 这是我的Program.cs [STAThread] static void Main() { bool mutexCreated=true; using (Mutex mutex = ne
We have developed some long running C# console applications which will be run by Windows Scheduled tasks. These applications might be run on many different server machines on intranet/extranet. We cannot ensure that they run on one machine because each application might need access to some resources, which are available only on a certain machine. Still, all these applications are using a com
我们开发了一些长时间运行的C#控制台应用程序,这些应用程序将由Windows计划任务运行。 这些应用程序可能在Intranet / Extranet上的许多不同的服务器上运行。 我们无法确保它们在一台机器上运行,因为每个应用程序可能需要访问某些仅在特定机器上可用的资源。 尽管如此,所有这些应用程序都使用通用的WCF服务来访问数据库。 我们需要确保在任何时候只有一个应用程序正在运行。 由于这些应用可能位于不同的外联网计算机
I have console application and would like to run it as Windows service. VS2010 has project template which allow to attach console project and build Windows service. I would like to not add separated service project and if possible integrate service code into console application to keep console application as one project which could run as console application or as windows service if run for exa
我有控制台应用程序,并希望将其作为Windows服务运行。 VS2010有项目模板,可以连接控制台项目并构建Windows服务。 我不想添加分离的服务项目,并且如果可能的话,将服务代码集成到控制台应用程序中,以将控制台应用程序作为一个可以作为控制台应用程序运行的项目,或者,例如,如果使用交换机从命令行运行, 也许有人可以建议可以快速简单地将c#控制台应用程序转换为服务的类库或代码片段? 我通常使用以下技术来运行与
In order to allow only a single instance of an application running I'm using mutex. The code is given below. Is this the right way to do it? Are there any flaws in the code? How to show the already running application when user tries to open the application the second time. At present (in the code below), I'm just displaying a message that another instance is already running. s
为了仅允许正在运行的应用程序的单个实例使用互斥锁。 代码如下。 这是做到这一点的正确方法吗? 代码中是否有缺陷? 当用户第二次尝试打开应用程序时如何显示已经运行的应用程序。 目前(在下面的代码中),我只是显示另一个实例已经运行的消息。 static void Main(string[] args) { Mutex _mut = null; try { _mut = Mutex.OpenExisting(AppDomain.CurrentDomain.Friendly
This question already has an answer here: What is the correct way to create a single-instance application? 35 answers this is from this answer which is a duplicate of this one. You check in your app's entry constructor for whether or not the app is already running. static void Main() { Process currentProcess = Process.GetCurrentProcess(); var runningProcess = (from process in
这个问题在这里已经有了答案: 创建单实例应用程序的正确方法是什么? 35个答案 这是来自这个答案,这是这个答案的重复。 您检查您的应用程序的条目构造函数是否已在运行该应用程序。 static void Main() { Process currentProcess = Process.GetCurrentProcess(); var runningProcess = (from process in Process.GetProcesses() where process.Id != cu
This question already has an answer here: What is the correct way to create a single-instance application? 35 answers I use this: https://code.msdn.microsoft.com/windowsapps/CSWinFormSingleInstanceApp-d1791628 It's single instance, and supports command line args. My program is started like this: [STAThread] static void Main(String [] args) { Application.EnableVisualStyles();
这个问题在这里已经有了答案: 创建单实例应用程序的正确方法是什么? 35个答案 我使用这个:https://code.msdn.microsoft.com/windowsapps/CSWinFormSingleInstanceApp-d1791628 它是单一实例,并支持命令行参数。 我的程序是这样开始的: [STAThread] static void Main(String [] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 mf = new Form
Possible Duplicate: What is the correct way to create a single instance application? How to implement single instance per machine application? I have a Winform-app which takes one parameter as an argument. static class Program { [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefau
可能重复: 创建单个实例应用程序的正确方法是什么? 如何实现每台机器应用程序的单个实例? 我有一个Winform应用程序,它将一个参数作为参数。 static class Program { [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Gauges(args)); } } 该程序
Possible Duplicates: What is the correct way to create a single instance application? What is a good pattern for using a Global Mutex in C#? Suppose i have created an exe i want that exe must run only once ..how it is possible please give suggestion If I understand your problem correctly this has nothing to do with having a singleton implementation. You simply need to check if your execu
可能重复: 创建单个实例应用程序的正确方法是什么? 在C#中使用Global Mutex有什么好的模式? 假设我已经创建了一个exe文件,我希望这个exe文件只能运行一次..如果有可能,请给出建议 如果我正确理解你的问题,这与单身实施无关。 您只需检查您的可执行文件是否正在运行。 您可以通过调用Process.GetProcesses()或Process.GetProcessesByName(NameOfExecutable)并检查返回值来完成此操作。 或者使用其他人建
Possible Duplicate: What is the correct way to create a single instance application? How can I define my application to open only one time after click on its exe file over and over? 我一直在应用程序的入口处完成此操作: bool onlyInstance = false; Mutex m = new Mutex(true, "MyUniqueMutextName", out onlyInstance); if (!onlyInstance) { return; } GC.KeepAlive(m); There are several related
可能重复: 创建单个实例应用程序的正确方法是什么? 我怎样才能定义我的应用程序打开一次后打开它的exe文件一遍又一遍? 我一直在应用程序的入口处完成此操作: bool onlyInstance = false; Mutex m = new Mutex(true, "MyUniqueMutextName", out onlyInstance); if (!onlyInstance) { return; } GC.KeepAlive(m); 有关单个实例应用程序堆栈溢出的几个相关问题: 这似乎是最合适的:创建单实例应用程序的正确方法