Example #1
0
        public static void ProcessGlobalMessage(int nId, MainForm mf)
        {
            if (mf == null)
            {
                throw new ArgumentNullException("mf");
            }

            IpcParamEx ipcMsg = LoadIpcInfoFile(nId);

            if (ipcMsg == null)
            {
                return;
            }

            if (ipcMsg.Message == CmdOpenDatabase)
            {
                mf.UIBlockAutoUnlock(true);
                mf.EnsureVisibleForegroundWindow(true, true);
                mf.UIBlockAutoUnlock(false);

                // Don't try to open another database while a dialog
                // is displayed (3489098)
                if (GlobalWindowManager.WindowCount > 0)
                {
                    return;
                }

                string[] vArgs = CommandLineArgs.SafeDeserialize(ipcMsg.Param0);
                if (vArgs == null)
                {
                    Debug.Assert(false); return;
                }

                CommandLineArgs args = new CommandLineArgs(vArgs);
                Program.CommandLineArgs.CopyFrom(args);

                mf.OpenDatabase(mf.IocFromCommandLine(), KeyUtil.KeyFromCommandLine(
                                    Program.CommandLineArgs), true);
            }
            else if (ipcMsg.Message == CmdOpenEntryUrl)
            {
                OpenEntryUrl(ipcMsg, mf);
            }
            else if (ipcMsg.Message == CmdIpcEvent)
            {
                try
                {
                    if (IpcUtilEx.IpcEvent == null)
                    {
                        return;
                    }

                    string strName = ipcMsg.Param0;
                    if (string.IsNullOrEmpty(strName))
                    {
                        Debug.Assert(false); return;
                    }

                    string[] vArgs = CommandLineArgs.SafeDeserialize(ipcMsg.Param1);
                    if (vArgs == null)
                    {
                        Debug.Assert(false); return;
                    }

                    CommandLineArgs clArgs = new CommandLineArgs(vArgs);

                    IpcEventArgs e = new IpcEventArgs(strName, clArgs);
                    IpcUtilEx.IpcEvent(null, e);
                }
                catch (Exception) { Debug.Assert(false); }
            }
            else
            {
                Debug.Assert(false);
            }
        }
Example #2
0
        public static void ProcessGlobalMessage(int nId, MainForm mf)
        {
            if(mf == null) throw new ArgumentNullException("mf");

            IpcParamEx ipcMsg = LoadIpcInfoFile(nId);
            if(ipcMsg == null) return;

            if(ipcMsg.Message == CmdOpenDatabase)
            {
                mf.UIBlockAutoUnlock(true);
                mf.EnsureVisibleForegroundWindow(true, true);
                mf.UIBlockAutoUnlock(false);

                // Don't try to open another database while a dialog
                // is displayed (3489098)
                if(GlobalWindowManager.WindowCount > 0) return;

                string[] vArgs = CommandLineArgs.SafeDeserialize(ipcMsg.Param0);
                if(vArgs == null) { Debug.Assert(false); return; }

                CommandLineArgs args = new CommandLineArgs(vArgs);
                Program.CommandLineArgs.CopyFrom(args);

                mf.OpenDatabase(mf.IocFromCommandLine(), KeyUtil.KeyFromCommandLine(
                    Program.CommandLineArgs), true);
            }
            else if(ipcMsg.Message == CmdOpenEntryUrl) OpenEntryUrl(ipcMsg, mf);
            else if(ipcMsg.Message == CmdIpcEvent)
            {
                try
                {
                    if(IpcUtilEx.IpcEvent == null) return;

                    string strName = ipcMsg.Param0;
                    if(string.IsNullOrEmpty(strName)) { Debug.Assert(false); return; }

                    string[] vArgs = CommandLineArgs.SafeDeserialize(ipcMsg.Param1);
                    if(vArgs == null) { Debug.Assert(false); return; }

                    CommandLineArgs clArgs = new CommandLineArgs(vArgs);

                    IpcEventArgs e = new IpcEventArgs(strName, clArgs);
                    IpcUtilEx.IpcEvent(null, e);
                }
                catch(Exception) { Debug.Assert(false); }
            }
            else { Debug.Assert(false); }
        }