Exemple #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // get application GUID as defined in AssemblyInfo.cs

            // unique id for global mutex - Global prefix means it is global to the machine
            string mutexId = string.Format("Global\\{{{0}}}", appGuid);

            using (var mutex = new Mutex(false, mutexId))
            {
                try
                {
                    if (!mutex.WaitOne(0, false))
                    {
                        //signal existing app via named pipes
                        JSONobject j = new JSONobject();
                        j.action = "dial";
                        j.data = new Data();
                        j.data.telnr = args[0].Remove(0, 4).Trim('/');

                        Pipe p  = new Pipe("OTMPipe");
                        p.send(JsonConvert.SerializeObject(j));
                        Environment.Exit(0);
                    }
                    else
                    {
                        // handle protocol with this instance
                        Program.f = new frm_main();
                        Application.Run(f);

                    }
                }
                finally
                {
                    mutex.ReleaseMutex();
                }
            }
        }
Exemple #2
0
        private void makeCall()
        {
            Debug.WriteLine("Making call to " + this.data);
            JSONobject j = new JSONobject();
            j.action = "dial";
            j.data = new Data();
            j.data.telnr = this.formatNumber(this.data + "");

            this.form.setTextLine(2, j.data.telnr);
            this.form.changeState("ringing");
            //this.udp.sendCMD(JsonConvert.SerializeObject(j));
        }