single-instance

Simple Communication between 2 instances of application

牧云@^-^@ 提交于 2019-12-12 17:12:58
问题 I have a WPF application that can take a few optional command line arguments. This application is also a single instance application (using a mutex to close any instances if one is already open). What I want for it to do though, is if something tries to open the application with some cmd line args, that the application will do what it's suppose to do with those (in my application it opens different dialogs based on the cmd line). What is the easiest way to achieve this? In psedo code here is

How to prevent open my application more than one time? [duplicate]

半城伤御伤魂 提交于 2019-12-12 15:56:09
问题 This question already has answers here : Closed 7 years ago . 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? 回答1: I've always done this at the application's entry point: bool onlyInstance = false; Mutex m = new Mutex(true, "MyUniqueMutextName", out onlyInstance); if (!onlyInstance) { return; } GC.KeepAlive(m); 回答2: There are several related questions on Stack

Re-start shell script without creating a new process in Linux

余生颓废 提交于 2019-12-12 01:33:00
问题 I have a shell file which I execute then, at the end, I get the possibility to press ENTER and run it again. The problem is that each time I press ENTER a new process is created and after 20 or 30 rounds I get 30 PIDs that will finally mess up my Linux. So, my question is: how can I make the script run always in the same process, instead of creating a new one each time I press ENTER ? Code: #!/bin/bash echo "Doing my stuff here!" # Show message read -sp "Press ENTER to re-start" # Clear

Android singletop singleinstance and singletask

泄露秘密 提交于 2019-12-09 16:52:02
问题 I've an design issue in implementing different types of launchmode for different activities. I've 5 Activities. VideoList VideoDetail FavoritesList VideoSearch VideoPlayer When the user starts the app it goes to VideoList that displays list of videos. Clicking on any of the Videos take them to VideoDetails.There are two button in that page. Play Button and Add to Favorites Button. I've a Footer bar on all the pages. Footer bar contains three image button. 1 HOME - Takes the user to first page

Run one instance of java application [duplicate]

你说的曾经没有我的故事 提交于 2019-12-08 04:50:45
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to implement a single instance Java application? is there a way to run only one instance of Java application so only I have one process? . is it possible to do it in java? 回答1: A simple way to have one instance is to use a service port. ServerSocket ss = new ServerSocket(MY_PORT); The benefit of using this approach instead of a locking a file is that you communicate to the instance already running and even

java.lang.InstantiationException: can't instantiate class … no empty constructor

浪尽此生 提交于 2019-12-07 10:33:07
问题 I have found topics with similar questions like mine but cant find the answer I am looking for so far. my application consists of a FragmentActivity which hosts a ViewPagerAdapter (child of FragmentPagerAdapter) with a fragment in each tab. My ViewPagerAdapter is instantiated in the OnCreateView function of the parent activity _adapter = new ViewPagerAdapter(getApplicationContext() , getSupportFragmentManager() , numOfTabs , status); The ViewPagerAdapter implements the minimum required

boost::interprocess::named_mutex vs CreateMutex

喜夏-厌秋 提交于 2019-12-07 06:52:08
问题 I want to switch from CreatMutex to boost::interprocess::named_mutex to limit my application to a single instance. Both methods works when the application runs and ends just fine. However, the lock is not released when the application crashes and using boost::interprocess::named_mutex . I could resolve that issue by using two name_mutex but I don't really understand the issue. Why is the lock for boost::interprocess::named_mutex not released when the application crashes but it is release with

How should I scope dependency injection of Entity Framework DbContext in a web app? (InstancePerHttpRequest vs SingleInstance)

岁酱吖の 提交于 2019-12-07 04:35:22
问题 I have read that DbContext object should be created as InstancePerHttpRequest, not SingleInstance, because of its thread-unsafe nature and it might consume too much resource between requets which makes sence. But I am using Repository objects which uses DbContext instance. Should I make them InstancePerHttpRequest or make them SingleInstance and use DependencyResolver to get the current DbContext. What would the best object creation design be, for Autofac (or any other DI), DbContext,

Application.Restart() + Single Instance conflict in windows application

匆匆过客 提交于 2019-12-06 12:27:13
问题 Hi Friends, I have a windows application where i controls single instance. When this application updates using clickonce, application will restart after applying updates. The application restarts but fails to continue as, IsFirstInstance = false condition. But Application.Restart() documentation says it shutdowns running app and creates new instance. Single instance class is given below: using System; using System.Diagnostics; using System.Runtime.Remoting; using System.Runtime.Remoting

What is the best way to make a single instance application in Compact Framework?

若如初见. 提交于 2019-12-05 05:41:30
问题 I've seen all the answers for the standard framework What is the correct way to create a single instance application? Prevent multiple instances of a given app in .NET? What is the best way to make a single instance application in .net? How do I check whether another process with the same name exists using the compact framework? The 3 parameter constructor is not supported by the CF Process GetProcessByName is not supported by the CF 回答1: OpenNETCF gives you class OpenNETCF.Threading