コード例 #1
0
ファイル: GLib_Settings.cs プロジェクト: thiblahute/gtk-sharp
        static bool ChangeEventSignalCallback(IntPtr inst, out int arg0, int arg1, IntPtr gch)
        {
            GLib.ChangeEventArgs args = new GLib.ChangeEventArgs();
            try {
                GLib.Signal sig = ((GCHandle)gch).Target as GLib.Signal;
                if (sig == null)
                {
                    throw new Exception("Unknown signal GC handle received " + gch);
                }

                args.Args    = new object[2];
                args.Args[1] = arg1;
                GLib.ChangeEventHandler handler = (GLib.ChangeEventHandler)sig.Handler;
                handler(GLib.Object.GetObject(inst), args);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, false);
            }

            try {
                arg0 = ((int)args.Args[0]);
                if (args.RetVal == null)
                {
                    return(false);
                }
                return((bool)args.RetVal);
            } catch (Exception) {
                Exception ex = new Exception("args.RetVal or 'out' property unset or set to incorrect type in GLib.ChangeEventHandler callback");
                GLib.ExceptionManager.RaiseUnhandledException(ex, true);
                // NOTREACHED: above call doesn't return.
                throw ex;
            }
        }
コード例 #2
0
ファイル: Settings.cs プロジェクト: akrisiun/gtk-sharp
		static bool ChangeEventSignalCallback (IntPtr inst, out int arg0, int arg1, IntPtr gch)
		{
			GLib.ChangeEventArgs args = new GLib.ChangeEventArgs ();
			try {
				GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
				if (sig == null)
					throw new Exception("Unknown signal GC handle received " + gch);

				args.Args = new object[2];
				args.Args[1] = arg1;
				GLib.ChangeEventHandler handler = (GLib.ChangeEventHandler) sig.Handler;
				handler (GLib.Object.GetObject (inst), args);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}

			try {
				arg0 = ((int)args.Args[0]);
				if (args.RetVal == null)
					return false;
				return ((bool) args.RetVal);
			} catch (Exception) {
				Exception ex = new Exception ("args.RetVal or 'out' property unset or set to incorrect type in GLib.ChangeEventHandler callback");
				GLib.ExceptionManager.RaiseUnhandledException (ex, true);
				// NOTREACHED: above call doesn't return.
				throw ex;
			}
		}