Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            StopAllThreads = false;

            LogDevice = new Logger();

            this.ParseCommandLineArgs();

            if (OperatingMode == OperationMode.Server)
            {
                ServerWindow window = new ServerWindow();
                window.Show();
                window.Closed += (sender, ea) =>
                {
                    Environment.Exit(0);
                };
            }
            else if (OperatingMode == OperationMode.Client)
            {
                ClientWindow window = new ClientWindow();
                window.Show();
                window.Closed += (sender, ea) =>
                {
                    Environment.Exit(0);
                };
            }
        }
Пример #2
0
 public NewMessageState(string message, string name, Color nameColor, ClientWindow window)
 {
     Message = message;
     Name = name;
     NameColor = nameColor;
     Window = window;
 }
Пример #3
0
 /// <summary>
 /// Initialises a new instance of the Client class, using the specified parameters.
 /// </summary>
 /// <param name="window">The open ClientWindow with which to interact.</param>
 public Client(ClientWindow window)
 {
     _window = window;
     _client = new TcpClient();
 }
Пример #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            StopAllThreads = false;

            LogDevice = new Logger();

            this.ParseCommandLineArgs();
            BannedUsers = this.LoadData("banned_users.dta");
            PrivilegedUsers = this.LoadData("privileged_users.dta");

            if (OperatingMode == OperationMode.Server)
            {
                string[] args = Environment.GetCommandLineArgs();
                ServerWindow window = new ServerWindow(args.Contains("-c") || args.Contains("--crash-recovery"));
                ActiveWindow = window;
                window.Show();
                window.Closed += (sender, ea) =>
                {
                    Environment.Exit(0);
                };
            }
            else if (OperatingMode == OperationMode.Client)
            {
                ClientWindow window = new ClientWindow();
                ActiveWindow = window;
                window.Show();
                window.Closed += (sender, ea) =>
                {
                    Environment.Exit(0);
                };
            }
        }