예제 #1
0
        // Starts the another instance of the game process.
        private void actionButtonPlay_Action(object sender, EventArgs e)
        {
            if (!IsUserInputValid()) return;

            SaveUserInput();

            var args = new GameProcessParameters(
                Settings.Default.ServerAddress,
                Settings.Default.ServerPort,
                Settings.Default.GameCountryCode,
                App.CurrentContext.AccountManager.SelectedAccount);

            App.CurrentContext.StartGame(args);
            Close();
        }
예제 #2
0
        /// <summary>
        /// Starts the new game client process
        /// </summary>
        /// <param name="startParams">A game process start parameters.</param>
        /// <exception cref="System.IO.FileNotFoundException"/>
        public int StartClient(GameProcessParameters startParams)
        {
            var startInfo = new ProcessStartInfo(binPath)
            {
                //Arguments = startParams.ToString(),
                UseShellExecute = false
            };

            var process = Process.Start(startInfo);

            if (process == null)
            {
                return(InvalidProcessId);
            }

            process.EnableRaisingEvents = true;
            process.Exited += OnProcessExited;
            processes.Add(process.Id, process);
            accounts.Add(process.Id, startParams.Account);

            return(process.Id);
        }
예제 #3
0
        /// <summary>
        /// Starts a new game client process with the specified parameters.
        /// </summary>
        /// <param name="parameters">A game client process start parameters.</param>
        public void StartGame(GameProcessParameters parameters)
        {
            if (!Initialized) return;

            var menuItemProcess = new MenuItem(string.Format(Resources.TrayMenuKillFormat, parameters.Account.Name), OnProcessKill)
            {
                Tag = gameProcessManager.StartClient(parameters)
            };

            if (gameProcessManager.ProcessCount == 1)
                trayMenu.MenuItems.Add(Resources.TrayMenuSeparator);

            trayMenu.MenuItems.Add(menuItemProcess);
        }
예제 #4
0
        /// <summary>
        /// Starts the new game client process
        /// </summary>
        /// <param name="startParams">A game process start parameters.</param>
        /// <exception cref="System.IO.FileNotFoundException"/>
        public int StartClient(GameProcessParameters startParams)
        {
            var startInfo = new ProcessStartInfo(binPath)
            {
                //Arguments = startParams.ToString(),
                UseShellExecute = false
            };

            var process = Process.Start(startInfo);

            if (process == null)
                return InvalidProcessId;

            process.EnableRaisingEvents = true;
            process.Exited += OnProcessExited;
            processes.Add(process.Id, process);
            accounts.Add(process.Id, startParams.Account);

            return process.Id;
        }