Ejemplo n.º 1
0
 public Client(ClientUserInterface.callbackTable_ _clientUserInterfaceCallbackTable)
 {
     clientUserInterfaceCallbackTable = _clientUserInterfaceCallbackTable;
     numLoginRetries = 0;
     serverProxy  = new ServerProxy();
     ringManager = new RingManager();
     queryProcessor = QueryProcessor.getInstance();
     relevanceRanker = RelevanceRanking.getInstance();
     downloadManager = new DownloadManager();
     queryCache = new Hashtable();
 }
        static void Main()
        {
            try
            {
                clientUserInterfaceInstance = new ClientUserInterface();
                UI = clientUserInterfaceInstance;
                client = new Client(clientUserInterfaceInstance.callbackTable);

                Application.ApplicationExit += new EventHandler(client.exitHandler);

                clientThread = new Thread(new ThreadStart(client.start));
                clientThread.Name = "Background Client->Server";
                clientThread.IsBackground = true;
                clientThread.Start();

                /* uncomment this out when not in debug mode, need to add flags?
                Process thisProcessInstance = Process.GetCurrentProcess();

                Process [] AllProcessInstances = Process.GetProcessesByName(thisProcessInstance.ProcessName);

                if (AllProcessInstances.Length > 1)
                {
                    MessageBox.Show(thisProcessInstance.ProcessName + " is already running", thisProcessInstance.ProcessName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                */
                Application.Run(clientUserInterfaceInstance);

            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }