aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.Manager/OpenGridServices.Manager/Main.cs
blob: f6a41e1421f780c0e7b65fa5c3c9959770818e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// project created on 5/14/2007 at 2:04 PM
using System;
using System.Threading;
using Gtk;

namespace OpenGridServices.Manager
{
	class MainClass
	{

		public static bool QuitReq=false;
		public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();

		private static Thread OperationsRunner;
		private static MainWindow win;

		public static void DoMainLoop()
		{
			while(!QuitReq)
			{
				Application.RunIteration();
			}
		}

		public static void RunOperations()
		{
			string operation;
			string cmd;
			char[] sep = new char[1];
			sep[0]=' ';
			while(!QuitReq)
			{
				operation=PendingOperations.Dequeue();
				Console.WriteLine(operation);
				cmd = operation.Split(sep)[0];
				switch(cmd) {
					case "connect_to_gridserver":
						win.SetStatus("Connecting to grid server...");						

					break;
				}
			}
		}

		public static void Main (string[] args)
		{
			Application.Init ();
			win = new MainWindow ();
			win.Show ();
			OperationsRunner = new Thread(new ThreadStart(RunOperations));
			OperationsRunner.IsBackground=true;
			OperationsRunner.Start();
			DoMainLoop();
		}
	}
}