public void ChangeCyclicFunc(CyclicFunc newcyclicfunc) { RefDelegate newcyclicfuncwrapper = delegate() { return(System.IntPtr.Zero); }; { IronSightEnginePINVOKE.Engine_ChangeCyclicFunc(swigCPtr, newcyclicfuncwrapper); } }
public static void ExecuteByRef(int noOfValues, string msg, RefDelegate algo, Action <int[]> print) { int[] array = new int[noOfValues]; for (int i = 0; i < noOfValues; i++) { Console.WriteLine(msg + (i + 1) + ":"); array[i] = TakeUserArrayInput()[0]; } algo(ref array[0], ref array[1]); print(array); }
public Result Run(InitFunc initfunc, InitFunc postinitfunc, CyclicFunc cyclicfunc, QuitFunc quitfunc) { RefDelegate initfuncwrapper = delegate() { return(Result.getCPtr(initfunc()).Handle); }; RefDelegate postinitfuncwrapper = delegate() { return(Result.getCPtr(initfunc()).Handle); }; RefDelegate cyclicfuncwrapper = delegate() { return(System.IntPtr.Zero); }; RefDelegate quitfuncwrapper = delegate() { return(System.IntPtr.Zero); }; { Result ret = new Result(ISMathPINVOKE.Engine_Run(swigCPtr, initfuncwrapper, postinitfuncwrapper, cyclicfuncwrapper, quitfuncwrapper), true); return(ret); } }
public Result Run(InitFunc initfunc, InitFunc postinitfunc, CyclicFunc cyclicfunc, QuitFunc quitfunc) { RefDelegate initfuncwrapper = delegate() { return(Result.getCPtr(initfunc()).Handle); }; RefDelegate postinitfuncwrapper = delegate() { return(Result.getCPtr(initfunc()).Handle); }; RefDelegate cyclicfuncwrapper = delegate() { return(System.IntPtr.Zero); }; RefDelegate quitfuncwrapper = delegate() { return(System.IntPtr.Zero); }; { Result ret = new Result(IronSightEnginePINVOKE.Engine_Run(swigCPtr, initfuncwrapper, postinitfuncwrapper, cyclicfuncwrapper, quitfuncwrapper), true); // if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); } }
/// <summary> /// Creates a new <see cref="ofDrawSizePreservingFillContainer"/>. /// </summary> public ofDrawSizePreservingFillContainer(ElementKey key = default, RefDelegate<DrawSizePreservingFillContainer> @ref = default, DrawableStyleDelegate<DrawSizePreservingFillContainer> style = default) : base(key, @ref, style) { }
/// <summary> /// Creates a new <see cref="ofTestBrowser"/>. /// </summary> public ofTestBrowser(ElementKey key = default, RefDelegate <TestBrowser> @ref = default, DrawableStyleDelegate <TestBrowser> style = default, string assemblyNamespace = "") : base(key, @ref, style) { AssemblyNamespace = assemblyNamespace; }
/// <summary> /// Creates a new <see cref="ofDrawableBase{T}"/>. /// </summary> protected ofDrawableBase(ElementKey key = default, RefDelegate <T> @ref = default, DrawableStyleDelegate <T> style = default, DrawableEventDelegate @event = default) : base(key) { Ref = @ref; Style = style; Event = @event; }
public ofDrawable(ElementKey key = default, RefDelegate <T> @ref = default, DrawableStyleDelegate <T> style = default, DrawableEventDelegate @event = default) : base(key, @ref, style, @event) { }
protected ofFlow(ElementKey key = default, RefDelegate <T> @ref = default, DrawableStyleDelegate <T> style = default, DrawableEventDelegate @event = default, IEnumerable <ofElement> children = default) : base(key, @ref, style, @event, children) { }
static void Main(string[] args) { Converter converter = new Converter(); Int2StringDelegate del = new Int2StringDelegate(converter.ConvertToString); //variabile di tipo implicito var del2 = new Int2StringDelegate(converter.ConvertToString); //creazione implicita delegate Int2StringDelegate isdel = converter.ConvertToString; Int2StringDelegate del3 = (Int2StringDelegate)Delegate.CreateDelegate(typeof(Int2StringDelegate), converter, "ConvertToString"); del3(123); string str = isdel(123); str = isdel.Invoke(123); //ottenere informazioni Console.WriteLine("ottenere informazioni sul delegate"); var method = isdel.Method; Console.WriteLine(method.Name); var target = isdel.Target; Console.WriteLine(target.ToString()); Console.WriteLine("ottenere informazioni sul delegate con metodo statico"); isdel = Converter.StaticConvertToString; Console.WriteLine(isdel.Method); Console.WriteLine(isdel.Target); UseDelegate(Converter.StaticConvertToString, 1, 2, 3); EmptyDelegate multicast = Metodo1; multicast += Metodo2; multicast += Metodo2; //un metodo può essere aggiunto più volte multicast(); multicast -= Metodo2; Delegate[] list = multicast.GetInvocationList(); foreach (Delegate delInstance in list) { Console.WriteLine("invoco {0}", delInstance.Method); (delInstance as EmptyDelegate).Invoke(); //delInstance.DynamicInvoke(); } multicast = (EmptyDelegate)Delegate.Combine(new EmptyDelegate(Metodo1), new EmptyDelegate(Metodo2)); multicast -= Metodo1; multicast -= Metodo2; if (multicast != null) { multicast.Invoke(); } Int2StringDelegate multi = converter.ConvertToString; multi += converter.RaddoppiaNumero; Console.WriteLine(multi(10)); int x = 1; RefDelegate multiref = Raddoppia; multiref += Triplica; multiref(ref x); Console.WriteLine(x); ConvertOriginToDest <int, string> siconvert = converter.StringToInt; int i = siconvert("123"); ConvertOriginToDest <string, int> isconvert = converter.Int2String; string s = isconvert(123); Func <int, int> func = Fattoriale; int n = EvaluateFunction <int>(func, 10); Func <double, double> funcRadice = Math.Sqrt; double radice = EvaluateFunction <double>(funcRadice, 144); double log = EvaluateFunction(Math.Log10, 100.0); //stampo l'errore OperazionePericolosa(PrintError); //covarianza func Func <string> funcHello = Hello; Func <object> funcObj = funcHello; object obj = funcObj(); //controvarianza Action Action <object> actObj = UseObject; Action <string> actStr = actObj; actStr("Hello"); }
public ofText(ElementKey key = default, RefDelegate <SpriteText> @ref = default, DrawableStyleDelegate <SpriteText> style = default, DrawableEventDelegate @event = default) : base(key, @ref, style, @event) { }
public ofButton(ElementKey key = default, RefDelegate <BasicButton> @ref = default, DrawableStyleDelegate <BasicButton> style = default, DrawableEventDelegate @event = default) : base(key, @ref, style, @event) { }
/// <summary> /// Creates a new <see cref="ofTransform"/>. /// </summary> public ofTransform(ElementKey key = default, IEnumerable <ofElement> children = default, RefDelegate <ofTransform> @ref = default) : base(key, children, new Context()) { @ref?.Invoke(this); }
public static void PassReference <TArg>(TypedReference tref, RefDelegate <TArg> del) { ReferenceBuilder <TArg> .PassRef(tref, del); }
public static TResult PassReference <TArg, TResult>(TypedReference tref, RefDelegate <TArg, TResult> del) { return(ReferenceBuilder <TArg, TResult> .PassRef(tref, del)); }
public ofContainer(ElementKey key = default, RefDelegate <Container <Drawable> > @ref = default, DrawableStyleDelegate <Container <Drawable> > style = default, DrawableEventDelegate @event = default, IEnumerable <ofElement> children = default) : base(key, @ref, style, @event, children) { }
public ofTextFlow(ElementKey key = default, RefDelegate <TextFlowContainer> @ref = default, DrawableStyleDelegate <TextFlowContainer> style = default, DrawableEventDelegate @event = default) : base(key, @ref, style, @event) { }
public ofMarkdown(ElementKey key = default, RefDelegate <MarkdownContainer> @ref = default, DrawableStyleDelegate <MarkdownContainer> style = default, DrawableEventDelegate @event = default) : base(key, @ref, style, @event) { }