[gbrainy] Missing file from a refactor



commit ccae067b5950ea5e8a8e424b65b70670dbe29e0a
Author: Jordi Mas <jmas softcatala org>
Date:   Sat Nov 28 19:17:41 2009 +0100

    Missing file from a refactor

 src/Core/Main/UpdateUIStateEventArgs.cs |   61 +++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Main/UpdateUIStateEventArgs.cs b/src/Core/Main/UpdateUIStateEventArgs.cs
new file mode 100644
index 0000000..85b6fe5
--- /dev/null
+++ b/src/Core/Main/UpdateUIStateEventArgs.cs
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Jordi Mas i Hernàndez <jmas softcatala org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+using System;
+
+namespace gbrainy.Core.Main
+{
+	// Events Args used to communicate an state change in the UI
+	public class UpdateUIStateEventArgs : EventArgs
+	{
+		public enum EventUIType
+		{
+			QuestionText,	// A game needs to update question text
+			Time		// Game time ticks and needs to be updated (e.g. status bar)
+		}
+
+		object data;
+		EventUIType etype;
+
+		public UpdateUIStateEventArgs (EventUIType etype, object data)
+		{
+			switch (etype) {
+				case EventUIType.QuestionText: {
+					if (data.GetType () != typeof (string))
+						throw new InvalidOperationException ("Invalid object type");
+
+					break;
+				}
+				default:
+					break;
+			}
+
+			this.etype = etype;
+			this.data = data;
+		}
+
+		public object Data {
+			get { return data; }
+		}
+		
+		public EventUIType EventType {
+			get { return etype; }
+		}
+	}
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]