Exemple #1
0
 public void CamApproach(CallbackDelegate callback=null)
 {
     moving=true;
     mStartFrom=transform.localPosition;
     mMoveTo=mClosePosition;
     mCallback=callback;
 }
Exemple #2
0
 public void CamGetBack(CallbackDelegate callback=null)
 {
     moving=true;
     mStartFrom=transform.localPosition;
     mMoveTo=mNormalPosition;
     mCallback=callback;
 }
        internal static int DRMCreateClientSession(
                                CallbackDelegate pfnCallback,
                                 uint uCallbackVersion, 
                                 string GroupIDProviderType,
                                 string GroupID, 
                                 out SafeRightsManagementSessionHandle phSession) 
        {
            SecurityHelper.DemandRightsManagementPermission(); 
            int res = UnsafeNativeMethods.DRMCreateClientSession(
                                pfnCallback,
                                uCallbackVersion,
                                GroupIDProviderType, 
                                GroupID,
                                out phSession); 
 
            // on some platforms in the failure cases the out parameter is being created with the value 0
            // in order to simplify error handling and Disposing of those handles we will just close them as 
            // soon as we detect such case
            if ((phSession != null) && phSession.IsInvalid)
            {
                phSession.Dispose(); 
                phSession = null;
            } 
            return res; 
        }
Exemple #4
0
 public ChatCommand setCallback(string function)
 {
     callback = new CallbackDelegate((cmd, player) => {
         plugin.Invoke(function, new[] { (object)cmd, player });
     });
     return this;
 }
        public bool WatchFolder(string folder, CallbackDelegate callbackOnChanged)
        {
            _callbackOnChanged = callbackOnChanged;

            // Create a new FileSystemWatcher and set its properties.
            FileSystemWatcher watcher = new FileSystemWatcher();

            // Watch the folder
            try
            {
                watcher.Path = folder;
                /* Watch for changes in LastAccess and LastWrite times, and
                   the renaming of files or directories. */
                watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                   | NotifyFilters.FileName | NotifyFilters.DirectoryName;

                // Only watch pdf files.
                watcher.Filter = "*.pdf";

                // Add event handlers.
                watcher.Changed += new FileSystemEventHandler(OnChanged);
                watcher.Created += new FileSystemEventHandler(OnCreated);
                watcher.Renamed += new RenamedEventHandler(OnRenamed);

                // Begin watching.
                watcher.EnableRaisingEvents = true;
            }
            catch (Exception excp)
            {
                logger.Error("Failed to watch {0}, excp {1}", folder, excp.Message);
                return false;
            }
            return true;
        }
Exemple #6
0
    public LerpInfo(LerpDelegate lerpF,
	                float min, float max, float time, CallbackDelegate cb=null)
    {
        this.lerpF=lerpF;
        this.lerpMin=min;
        this.lerpMax=max;
        this.lerpTime=time;
        this.lerp=0f;
        this.lerpCB=cb;
    }
Exemple #7
0
 public ConsoleCommand setCallback(string function)
 {
     callback = new CallbackDelegate(cmd => {
         try {
             plugin.Invoke(function, (object)cmd);
         } catch (Exception ex) {
             Logger.Log("there");
             Logger.Log(ex.ToString());
         }
     });
     return this;
 }
 //Start hook
 public KeyboardHook(bool Global)
 {
     this.Global = Global;
     TheHookCB = new CallbackDelegate(KeybHookProc);
     if (Global)
     {
         HookID = SetWindowsHookEx(HookType.WH_KEYBOARD_LL, TheHookCB,
             0, //0 for local hook. eller hwnd til user32 for global
             0); //0 for global hook. eller thread for hooken
     }
     else
     {
         HookID = SetWindowsHookEx(HookType.WH_KEYBOARD, TheHookCB,
             0, //0 for local hook. or hwnd to user32 for global
             GetCurrentThreadId()); //0 for global hook. or thread for the hook
     }
 }
Exemple #9
0
    private void Update()
    {
        if(moving) {
            mMovingTime+=Time.deltaTime;
            float ratio=Mathf.Clamp(mMovingTime/approachTime, 0f, 1f);
            Vector3 point=Vector3.Lerp(mStartFrom, mMoveTo, ratio);
            point.y+=Mathf.Sin(ratio*Mathf.PI*yBias);
            transform.localPosition=point;
            if(mMovingTime>=approachTime) {
                if(null!=mCallback) {
                    mCallback();
                    mCallback=null;
                }

                moving=false;
                mMovingTime=0f;
                approachTime=normalApproachTime;
            }
        }
    }
Exemple #10
0
        public static void InitLibrary()
        {
            new Eval();
            new Moves();
            new Zobrist();

            new Pawn();
            new Rook();
            new Knight();
            new Bishop();
            new King();
            new Queen();

            TTable.Init(32);

            cb = Callback;
            var ptr = Marshal.GetFunctionPointerForDelegate(cb);
            Manager.SetCallback(ptr);
            SendMessage = DefaultHandler;
        }
Exemple #11
0
 public void ChoiceDoneEnd()
 {
     mBack.gameObject.SetActive(false);
     if(mCachedSceneUI!=null) {
         mCachedSceneUI.SetActive(false);
     }
     mCachedSceneUI=null;
     if(mActiveChoice!=null) {
         mActiveChoice.sound.gameObject.SetActive(false);
         mPlayer.DeltaStress(mActiveChoice.deltaStress);
         mPlayer.DeltaHealth(mActiveChoice.deltaHealth);
         mPlayer.DeltaMorality(mActiveChoice.deltaMorality);
         if(mActiveChoice.choiceText!="") {
             StartCoroutine(TimerChoice(mActiveChoice.choiceTextDelay, DefaultChoice));
         }
     }
     mActiveChoice=null;
     if(null!=mCallback) {
         mCallback();
     }
     mCallback=null;
 }
Exemple #12
0
        public override void CreateScene()
        {
            //create our hikarimanager
            _HikariManager = new HikariManager("..\\..\\Media\\gui");
            viewport.BackgroundColour = new ColourValue(200, 200, 200);

            //creation of a flash control, first we create an overlay, then we load a flash control onto it
            _FpsControl = _HikariManager.CreateFlashOverlay("Fps", viewport, 130, 91, RelativePosition.TopLeft, 0, 0);
            _FpsControl.Load("fps.swf");
            _FpsControl.SetTransparent(true);

            _ColorPickerControl = _HikariManager.CreateFlashOverlay("ColorPicker", viewport, 350, 400, RelativePosition.Center, 1, 0);
            _ColorPickerControl.Load("controls.swf");
            _ColorPickerControl.SetTransparent(true, true);

            //define delegate of csharp functions that we can call from flash
            _AsyncExitCallback = this.OnExitClick;
            _AsyncOpacityCallback = this.OnOpacityChange;
            _AsyncColorCallback = this.OnColorChange;
            //bind it to our flash control
            _ColorPickerControl.Bind("opacityChange", _AsyncOpacityCallback);
            _ColorPickerControl.Bind("colorChange", _AsyncColorCallback);
            _ColorPickerControl.Bind("exitClick", _AsyncExitCallback);
        }
 private void EventControl_Closed(object sender, EventArgs e)
 {
     CardInserted -= ((ICardEventCallback)sender).OnCardInserted;
     CardRemoved -= ((ICardEventCallback)sender).OnCardRemoved;
 }
Exemple #14
0
 public void SetOnPlaybackInterrupted(CallbackDelegate cb)
 {
     AddEventListener("OnPlaybackInterrupted", cb);
 }
 internal void SetCallback(CallbackDelegate callback)
 {
     _callback=callback;
 }
 public void SubscribeCardEvent(string reader)
 {
     ICardEventCallback callback = OperationContext.Current.GetCallbackChannel<ICardEventCallback>();
     CardInserted += callback.OnCardInserted;
     CardRemoved += callback.OnCardRemoved;
     ICommunicationObject obj = (ICommunicationObject)callback;
     obj.Closed += EventControl_Closed;
     //obj.Closing += new EventHandler(EventService_Closing);
 }
Exemple #17
0
 public void GetSidTokenAsync(CallbackDelegate<string> callback)
 {
     if (callback != null)
     {
         ThreadPool.QueueUserWorkItem(o =>
         {
             string sid = GetSidToken();
             callback(sid);
         });
     }
 }
Exemple #18
0
    /// <summary>
    /// Adds a callback function on the client (pre-postback, so beware) and then sets a server-side delegate
    /// </summary>
    /// <param name="key">A friendly key to internally associate with the callback (does not get passed to client)</param>
    /// <param name="callbackDelegate">The delegate method to call when this callback gets fired</param>
    /// <returns>The name of a generated client-side function that can be called from JavaScript with args and context parameters</returns>
    public string AddCallback(string key, CallbackDelegate callbackDelegate)
    {
        if (CallbackFunctions.ContainsKey(key))
        {
            if (callbackDelegate != null && !CallbackDelegates[key].Contains(callbackDelegate))
                CallbackDelegates[key].Add(callbackDelegate);
            return CallbackFunctions[key];
        }

        string str = this.Page.ClientScript.GetCallbackEventReference(
            this,
            "args",
            this.ClientID + "_Callback", //"IAjax.DisplayResult",
            "context",
            "ReportGrid_Error", //"IAjax.DisplayError",
            false);
        StringBuilder builder2 = new StringBuilder();

        // Generate a function name for this guy
        int index = CallbackDelegates.Count + 1;
        string funcName = "_fn" + index.ToString() + this.ClientID;
        builder2.Append("window." + funcName + " = function(args,context){" +
            (string.IsNullOrEmpty(ClientShowBusyDuringCallback) ? string.Empty : ((UseClientIDPrefix ? (this.ClientID + "_") : string.Empty) + ClientShowBusyDuringCallback + "(true);")) +
            "args='fn=_fn" + index.ToString() +
            "&' + (args == null ? '' : args);" + str + ";}\n");
        JS.RegisterJSBlock(this, builder2.ToString(), this.ClientID + "_JS" + index.ToString());

        CallbackDelegates.Add(
            key,
            callbackDelegate == null ? new List<CallbackDelegate>() : new List<CallbackDelegate>(new CallbackDelegate[] { callbackDelegate }));
        CallbackFunctions.Add(key, funcName);
        CallbackIndexes.Add("_fn" + index.ToString(), key);

        return funcName;
    }
Exemple #19
0
 public void SetOnUpdatePlayInfo(CallbackDelegate cb)
 {
     AddEventListener("OnUpdatePlayInfo", cb);
 }
 private static extern string nativeRegisterEventListener(CallbackDelegate callback);
Exemple #21
0
 public void SetOnErrorOccurred(CallbackDelegate cb)
 {
     AddEventListener("OnErrorOccurred", cb);
 }
Exemple #22
0
 public void SetOnPlaybackComplete(CallbackDelegate cb)
 {
     AddEventListener("OnPlaybackComplete", cb);
 }
Exemple #23
0
 public void SetOnIdle(CallbackDelegate cb)
 {
     AddEventListener("OnIdle", cb);
 }
Exemple #24
0
 public void SetOnStarted(CallbackDelegate cb)
 {
     AddEventListener("OnStarted", cb);
 }
Exemple #25
0
 public void SetOnSeeking(CallbackDelegate cb)
 {
     AddEventListener("OnSeeking", cb);
 }
Exemple #26
0
        private CallbackDelegate OnSoundAttenuationChange(IDictionary <string, object> args, CallbackDelegate callback)
        {
            var attenuation = args.FirstOrDefault(arg => arg.Key == "soundAttenuation").Value?.ToString();

            if (!string.IsNullOrEmpty(attenuation))
            {
                TriggerServerEvent(ServerEvents.OnSetSoundAttenuation, attenuation);
            }
            return(callback);
        }
Exemple #27
0
 private CallbackDelegate OnHideNUI(IDictionary <string, object> args, CallbackDelegate callback)
 {
     API.SetNuiFocus(false, false);
     API.SendNuiMessage(JsonConvert.SerializeObject(new { type = "HypnonemaNUI.HideUI" }));
     return(callback);
 }
 private static extern string nativeRegisterCallback(CallbackDelegate callback);
 /// <summary>
 /// Gets an <see cref="IEnumerable{T}"/> with all the <see cref="AnalyticsAccountInfo"/> available to the user.
 /// </summary>
 /// <param name="callback">The <see cref="CallbackDelegate{T}"/> to invoke when the accounts have been received.</param>
 public void GetAccountsAsync(CallbackDelegate<IEnumerable<AnalyticsAccountInfo>> callback)
 {
     if (callback != null)
     {
         ThreadPool.QueueUserWorkItem(
             o =>
                 {
                     IEnumerable<AnalyticsAccountInfo> result = GetAccounts();
                     callback(result);
                 });
     }
 }
 protected override void NativeRegisterEventListener(CallbackDelegate callback)
 {
     AmazonMobileAdsIOS.nativeRegisterEventListener(callback);
 }
 /// <summary>
 /// Creates an asynchronous request for a report from Google Analytics with the given dimensions and metrics.
 /// </summary>
 /// <param name="account">The <see cref="AnalyticsAccountInfo"/> to get the reports for.</param>
 /// <param name="dimensions">A list of <see cref="Dimension"/> for the report.</param>
 /// <param name="metrics">A list of <see cref="Metric"/> for the report.</param>
 /// <param name="from">The start <see cref="DateTime"/> of the report data.</param>
 /// <param name="to">The end <see cref="DateTime"/> of the report data.</param>
 /// <param name="callback">The <see cref="CallbackDelegate{T}"/> to invoke when the data has been received.</param>
 public void RequestReportAsync(AnalyticsAccountInfo account, IEnumerable<Dimension> dimensions, IEnumerable<Metric> metrics, DateTime from, DateTime to, CallbackDelegate<IEnumerable<GenericEntry>> callback)
 {
     if (callback != null)
     {
         ThreadPool.QueueUserWorkItem(o =>
                                      	{
                                      		IEnumerable<GenericEntry> result = RequestReport(
                                      			account,
                                      			dimensions,
                                      			metrics,
                                      			from,
                                      			to);
                                      		callback(result);
                                      	});
     }
 }
Exemple #32
0
 public void GetAuthTokenAsync(CallbackDelegate<string> callback)
 {
     if (callback != null)
     {
         ThreadPool.QueueUserWorkItem(o =>
         {
             string auth = GetAuthToken();
             callback(auth);
         });
     }
 }
Exemple #33
0
 static void GetResult(int[] arr, CallbackDelegate cbd)
 {
     cbd(arr);
     Console.WriteLine("\n-------------------");
 }
 public ConsoleFunction(string menu_entry_text, CallbackDelegate callback_delegate)
 {
     _menu_text = menu_entry_text;
     callback = callback_delegate;
 }
Exemple #35
0
 private CallbackDelegate OnPause(IDictionary <string, object> args, CallbackDelegate callback)
 {
     TriggerServerEvent(ServerEvents.OnPause);
     return(callback);
 }
 public static extern void StartAPI(CallbackDelegate notifyInfo, CallbackDelegateTick notifyTick, CallbackDelegate notifyLog);
Exemple #37
0
 private CallbackDelegate OnResumeVideo(IDictionary <string, object> args, CallbackDelegate callback)
 {
     TriggerServerEvent(ServerEvents.OnResumeVideo);
     return(callback);
 }
 public void UnsubscribeCardEvent()
 {
     ICardEventCallback callback = OperationContext.Current.GetCallbackChannel<ICardEventCallback>();
     CardInserted -= callback.OnCardInserted;
     CardRemoved -= callback.OnCardRemoved;
 }
Exemple #39
0
        private CallbackDelegate OnSoundMinDistanceChange(IDictionary <string, object> args, CallbackDelegate callback)
        {
            var soundMinDistance = args.FirstOrDefault(arg => arg.Key == "minDistance").Value?.ToString();

            if (!string.IsNullOrEmpty(soundMinDistance))
            {
                TriggerServerEvent(ServerEvents.OnSetSoundMinDistance, soundMinDistance);
            }
            return(callback);
        }
Exemple #40
0
 public void Invoke(CallbackDelegate action)
 {
     using (ManualResetEvent ok = new ManualResetEvent(false))
     {
         int msg = Interlocked.Increment(ref nextMessage) % 0x1000 + 0x9000;
         MessageHandlers[msg] = action + delegate { ok.Set(); };
         PostMessage(msg, IntPtr.Zero, IntPtr.Zero);
         ok.WaitOne();
     }
 }
Exemple #41
0
 public void SetOnThrowException(CallbackDelegate cb)
 {
     AddEventListener("OnThrowException", cb);
 }
 /// <summary>
 /// Creates an asynchronous request for a report from Google Analytics with the given dimensions and metrics.
 /// </summary>
 /// <param name="account">The <see cref="AnalyticsAccountInfo"/> to get the reports for.</param>
 /// <param name="from">The start <see cref="DateTime"/> of the report data.</param>
 /// <param name="to">The end <see cref="DateTime"/> of the report data.</param>
 /// <param name="callback">The <see cref="CallbackDelegate{T}"/> to invoke when the data has been received.</param>
 public void GetUserCountByLocationAsync(AnalyticsAccountInfo account, DateTime from, DateTime to, CallbackDelegate<IEnumerable<CityReport>> callback)
 {
     if (callback != null)
     {
         ThreadPool.QueueUserWorkItem(o =>
                                      	{
                                      		IEnumerable<CityReport> result = GetUserCountByLocation(account, from, to);
                                      		callback(result);
                                      	});
     }
 }
 protected static void OnPlayerDropped([FromSource] Player player, string playerName, CallbackDelegate kickReason)
 {
     Debug.WriteLine($"Disconnect: {player.Name} [{player.EndPoint}]. Reason: {kickReason}");
     User.SaveAccount(player);
 }
Exemple #44
0
 public void ClearPlayers()
 {
     if (listBoxPlayers.InvokeRequired)
     {
         CallbackDelegate d = new CallbackDelegate(ClearPlayers);
         this.Invoke(d);
     }
     else
     {
         listBoxPlayers.Items.Clear();
     }
 }
Exemple #45
0
        private CallbackDelegate ToggleBigMapOnDown(IDictionary <string, object> data, CallbackDelegate callback)
        {
            bool state = (bool)data["newstate"];

            Config["BigMapOnDown"] = state ? "true" : "false";

            callback("ok");
            return(callback);
        }
Exemple #46
0
 public void SetCallback(CallbackDelegate x)
 {
     callback = x;
 }
        protected static void OnPlayerConnecting([FromSource] Player player, string playerName, CallbackDelegate kickCallback, IDictionary <string, object> deferrals)
        {
            Debug.WriteLine($"Connect: {player.Name} [{player.EndPoint}]");

            if (!User.DoesAccountExist(player))
            {
                User.CreatePlayerAccount(player);
            }
        }