Пример #1
0
 static SurfaceForm()
 {
     Instance = new SurfaceForm();
 }
Пример #2
0
        static void Main()
        {
            bool createdNew;
            using (new Mutex(true, "GestureSignDaemon", out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    //Application.SetCompatibleTextRenderingDefault(false);
                    try
                    {
                        Application.ThreadException += Application_ThreadException;
                        Logging.OpenLogFile();

                        if ("Built-in".Equals(AppConfig.CultureName) ||
                            !LocalizationProvider.Instance.LoadFromFile("Daemon", Properties.Resources.en))
                        {
                            LocalizationProvider.Instance.LoadFromResource(Properties.Resources.en);
                        }

                        TouchCapture.Instance.Load();
                        _surfaceForm = new SurfaceForm();

                        if (!StartTouchInputProvider()) return;

                        GestureManager.Instance.Load(TouchCapture.Instance);
                        ApplicationManager.Instance.Load(TouchCapture.Instance);
                        // Create host control class and pass to plugins
                        HostControl hostControl = new HostControl()
                        {
                            _ApplicationManager = ApplicationManager.Instance,
                            _GestureManager = GestureManager.Instance,
                            _TouchCapture = TouchCapture.Instance,
                            _PluginManager = PluginManager.Instance,
                            _TrayManager = TrayManager.Instance
                        };
                        PluginManager.Instance.Load(hostControl);
                        TrayManager.Instance.Load();

                        SynchronizationContext uiContext = SynchronizationContext.Current;
                        NamedPipe.Instance.RunNamedPipeServer("GestureSignDaemon", new MessageProcessor(uiContext));

                        //if (TouchCapture.Instance.MessageWindow.NumberOfTouchscreens == 0)
                        //{
                        //    MessageBox.Show(LocalizationProvider.Instance.GetTextValue("Messages.TouchscreenNotFound"),
                        //        LocalizationProvider.Instance.GetTextValue("Messages.TouchscreenNotFoundTitle"),
                        //        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        //    //return;
                        //}
                        Application.Run();
                    }
                    catch (Exception e)
                    {
                        Logging.LogException(e);
                        MessageBox.Show(e.ToString(), LocalizationProvider.Instance.GetTextValue("Messages.Error"),
                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        Application.Exit();
                    }
                }
                else
                {
                    Application.Exit();
                }
            }
        }