internal void Init(bool read)
 {
     if (read)
     {
         server = new NamedPipeListenServer(ProcessKeyTag + ProcessKey, OnAcceptMessage);
         Task.Factory.StartNew(() =>
         {
             server.Run();
         });
     }
     else
     {
         client = new NamedPipeClient(".", ProcessKeyTag + ProcessKey);
     }
 }
Ejemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            Execute.InitializeWithDispatcher();

            //手动关闭模式
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            NamedPipeListenServer server = new NamedPipeListenServer("Play.Server")
            {
                ProcessMessage = ProcessMessage
            };

            server.Run();
        }
Ejemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            NamedPipeListenServer server = new NamedPipeListenServer("Play.Server")
            {
                ProcessMessage = ProcessMessage
            };

            server.Run();

            play = new Player();
            play.InDeskTop();
            Application.Run(play);
        }
Ejemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Execute.InitializeWithDispatcher();

            //全局捕获异常
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            NamedPipeListenServer server = new NamedPipeListenServer("Play.Server")
            {
                ProcessMessage = ProcessMessage
            };

            server.Run();

            //解码器初始化
            Core.Initialize();

            //程序路径
            var currentAssembly  = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;

            if (Directory.Exists(Path.Combine(currentDirectory, "libvlc")))
            {
                play = new Player()
                {
                    Width    = Screen.PrimaryScreen.Bounds.Width,
                    Height   = Screen.PrimaryScreen.Bounds.Height,
                    Location = new Point(0, 0)
                };
                Application.Run(play);
            }
            else
            {
                MessageBox.Show("缺少视频解码器,前往官网下载.");
                Process.Start("http://www.dmskin.com");
                Application.Exit();
            }
        }