示例#1
0
 public ClientViewModel()
 {
     _netClient = new NetClient(_IP, _Port);
     _CommandControler = new Commands();
     _backgroundHelper = new BackgroundConnectionHelper(new DoWorkEventHandler(OnCallBack), new RunWorkerCompletedEventHandler(UpdateGUI));
     _ConnectClick = new CommandAction(StartClientClick);
 }
示例#2
0
 public ServerViewModel()
 {
     _TCPServer = new TCPServer(_Ip, _Port);
     _TryToStartServer = new CommandAction(GetConnection);
     _BackgroundHelper = new BackgroundConnectionHelper(
         new DoWorkEventHandler(AsyncOperations),
         new RunWorkerCompletedEventHandler(UpdateGUI));
     _Commands = new Commands();
 }
示例#3
0
            /// <summary>
            /// Creates a new Console Command
            /// </summary>
            /// <param name="args">the argument types</param>
            /// <param name="act">command action</param>
            public Command(string args, CommandAction act)
            {
                this.Action = act;
                StringBuilder argRegex = new StringBuilder();

                // Check each argument and build into regex string
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].Equals('i'))		// Int
                        argRegex.Append(" (.*?)");
                    else if (args[i].Equals('s'))	// String
                        argRegex.Append(" \"(.*?)\"");
                }

                this.Args = argRegex.ToString().TrimStart(' ');
            }