//replay
 void Btn_replayClick(object sender, EventArgs e)
 {
     if (m_client == null || m_client.m_user == null)
     {
         return;
     }
     RoomTool.RunGame(m_client.m_user.GamePath, "-r");
 }
 void Btn_joinClick(object sender, EventArgs e)
 {
     if (m_client == null)
     {
         return;
     }
     RoomTool.Start(m_server, m_client.m_user, "random");
 }
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_CurrentDomain_UnhandledException);
            if (args.Length >= 1)
            {
                switch (args[0])
                {
                case "install":
                    Protocol.Reg(RoomTool.PRO);
                    Environment.Exit(0);
                    break;

                case "uninstall":
                    Protocol.UnReg(RoomTool.PRO);
                    Environment.Exit(0);
                    break;

                default:
                    if (args[0].StartsWith(RoomTool.PRO))
                    {
                        RoomTool.Command(args[0]);
                        Environment.Exit(0);
                    }
                    break;
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool isFirstInstance;

            // Please use a unique name for the mutex to prevent conflicts with other programs
            using (Mutex mtx = new Mutex(true, "YGOClient2", out isFirstInstance)) {
                if (isFirstInstance)
                {
                    MyNotifyIcon notificationIcon = new MyNotifyIcon();
                    notificationIcon.notifyIcon.Visible = true;
                    notificationIcon.Show();
                    Application.Run();
                    notificationIcon.notifyIcon.Dispose();
                }
                else
                {
                    MessageBox.Show("This is running.");
                    // The application is already running
                    // TODO: Display message box or change focus to existing application instance
                }
            }             // releases the Mutex
        }
Example #4
0
        void Btn_createClick(object sender, EventArgs e)
        {
            if (m_user == null)
            {
                MessageBox.Show("错误:用户信息为空。");
                return;
            }
            if (m_server == null)
            {
                MessageBox.Show("错误:服务器信息为空。");
                return;
            }
            string room = GetRoomString();

            RoomTool.Start(m_server, m_user, room);
            this.Hide();
            //MessageBox.Show(room);
        }