private void RefreshGrid() { if (this.dataGridView1.InvokeRequired) { GenericCallback d = new GenericCallback(RefreshGrid); this.Invoke(d); } else { try { dataGridView1.Rows.Clear(); int i = 0; foreach (BBS bbs in bbs_instances) { if (bbs.CurrentUser != null) { dataGridView1.Rows.Add(i, bbs.State_Object.GetHashCode(), bbs.State_Object.workSocket.RemoteEndPoint.ToString(), bbs.CurrentUser.Username, bbs.CurrentArea, (DateTime.Now.Subtract(bbs.ConnectionTimeStamp).ToString())); } else { dataGridView1.Rows.Add(i, bbs.State_Object.GetHashCode(), bbs.State_Object.workSocket.RemoteEndPoint.ToString(), "Pending Login", "Login", (DateTime.Now.Subtract(bbs.ConnectionTimeStamp).ToString())); } i++; } Application.DoEvents(); } catch (Exception ex) { LoggingAPI.LogEntry(ex.Message); } } }
/// <summary> /// Gets or refreshes the current credential. /// If the access token is going to expire, refresh token is used to get a new access token. /// </summary> /// <param name="callback"></param> public void GetOrRefreshCredentialAsync(GenericCallback <UnitySocialCredential> callback) { #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR uint callbackId = Factory.callbackManager.Push(callback); UnitySocialBridge.UnitySocialUnityMessageReceived("getOrRenewCredentials", "{\"callbackId\":" + callbackId + "}"); #else callback("Unity Social is not enabled", null); #endif }
public void Unsubscribe <T>(string eventName, GenericCallback <T> callback) { #if _KISHITECH_UNITY_DEBUG_LOG_ Debug.Log($"Unsubscribe<T:{typeof(T)}>({eventName}, {callback})"); #endif // #if _KISHITECH_UNITY_DEBUG_LOG_ if (m_EventDictionary.ContainsKey(eventName)) { m_EventDictionary[eventName] = (GenericCallback <T>)m_EventDictionary[eventName] - callback; } }
private void SetTitle(string prefix) { if (this.InvokeRequired) { GenericCallback d = new GenericCallback(SetTitle); this.Invoke(d, new object[] { prefix }); } else { this.Text = prefix; } }
private void SetNews(string rtf) { if (this.txt_news.InvokeRequired) { GenericCallback d = new GenericCallback(SetNews); this.txt_news.Invoke(d, new object[] { rtf }); } else { this.txt_news.Rtf = rtf; } }
public void Subscribe <T1, T2>(string eventName, GenericCallback <T1, T2> callback) { #if _KISHITECH_UNITY_DEBUG_LOG_ Debug.Log($"Subscribe<T1:{typeof(T1)}, T2:{typeof(T2)}>({eventName}, {callback})"); #endif // #if _KISHITECH_UNITY_DEBUG_LOG_ if (m_EventDictionary.ContainsKey(eventName)) { m_EventDictionary[eventName] = (GenericCallback <T1, T2>)m_EventDictionary[eventName] + callback; } else { m_EventDictionary.Add(eventName, callback); } }
/*public void TryToPlaceItem (BuildingData myData) { * TryToPlaceItem(myData, false, false, null); * }*/ /// <summary> /// spawns a placement helper and lets the user try and place an item down in the world based on the parameters. /// </summary> /// <param name="myData"></param> /// <param name="_isSpaceLanding"></param> /// <param name="_isInventory"></param> /// <param name="_inventory"></param> public void TryToPlaceItem(BuildingData myData, bool _isRocket, List <InventoryItemSlot> _inventory, GenericCallback _buildCompleteCallback) { Deselect(); print("Placing Item"); buildCompleteCallback = _buildCompleteCallback; inventory = _inventory; isRocket = _isRocket; curState = PlacementState.item; Player_MasterControlCheck.s.ToggleMovement(true); Player_MasterControlCheck.s.TogglePlacingItem(true); //UIBeltModeOverlay.SetActive (false); buildingItem = myData; if (buildingItem != null) { GameObject curItemPlacement = Instantiate(ItemPlacementHelperPrefab, transform.position, Quaternion.identity); curItemPlacementScript = curItemPlacement.GetComponent <ItemPlacementHelper>(); curItemPlacementScript.Setup(myData); } }
protected void setupApi(GenericCallback <bool> callback) { if (callback == null) { return; } if (API == null) { callback("NO API", false); } else { _api = API.GetComponent(typeof(IMagicUISource)) as IMagicUISource; if (_api == null) { callback("API INVALID", false); } _api.Setup(callback); } }
public CacheInvalidatorCallback(ICacheInvalidator cacheInvalidator) { _invalidator = cacheInvalidator; _callback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { string key = (string)JavaClass.GetTypedInstance(typeof(string), jvalue.From(input).l); _invalidator.Invalidate(key); return_value = new jvalue(); return_type = 0; } catch (Exception exception) { return_value = jvalue.CreateCBRetVal(exception); return_type = 1; } return 0; }); base.JObject = _constructor.construct(0, _callback); }
/// <summary> /// This should always be called "OnDestroy" to make things work if you ever delete an object and/or reload a scene /// </summary> /// <param name="callback"></param> public static void RemoveFromCall(GenericCallback callback) { newGameEvent -= callback; }
/// <summary> /// This must be called from "Awake" /// Remember to add the "OnDestroy" pair > RemoveFromCall /// </summary> public static void CallWhenNewGame(GenericCallback callback) { newGameEvent += callback; }
/// <summary> /// Initializes a new instance of the <see cref="CacheChannelEventListenerCallback"/> class. /// </summary> /// <param name="cacheChannelEventListener">The associated <see cref="I:Com.Tridion.Cache.ICacheChannelEventListener" /></param> public CacheChannelEventListenerCallback(ICacheChannelEventListener cacheChannelEventListener) { mCacheChannelEventListener = cacheChannelEventListener; mConnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); mDisconnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); mRemoteEventCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { CacheEvent typedInstance = (CacheEvent)JavaClass.GetTypedInstance(typeof(CacheEvent), jvalue.From(input).l); mCacheChannelEventListener.HandleRemoteEvent(typedInstance); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return(0); }); base.JObject = mConstructor.construct(0, mConnectCallback, mDisconnectCallback, mRemoteEventCallback); }
public void BindSignoutNotify(GenericCallback l) { signoutNotify = l; }
/// <summary> /// Initializes a new instance of the <see cref="CacheChannelEventListenerCallback"/> class. /// </summary> /// <param name="cacheChannelEventListener">The associated <see cref="I:Com.Tridion.Cache.ICacheChannelEventListener" /></param> public CacheChannelEventListenerCallback(ICacheChannelEventListener cacheChannelEventListener) { mCacheChannelEventListener = cacheChannelEventListener; mConnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return 0; }); mDisconnectCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { mCacheChannelEventListener.HandleConnect(); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return 0; }); mRemoteEventCallback = new GenericCallback((out int return_type, out jvalue return_value, IntPtr input) => { try { CacheEvent typedInstance = (CacheEvent)JavaClass.GetTypedInstance(typeof(CacheEvent), jvalue.From(input).l); mCacheChannelEventListener.HandleRemoteEvent(typedInstance); // Void return_value = new jvalue(); return_type = 0; } catch (Exception exception) { // Wrap the exception for Java return_value = jvalue.CreateCBRetVal(exception); // Object return_type = 1; } return 0; }); base.JObject = mConstructor.construct(0, mConnectCallback, mDisconnectCallback, mRemoteEventCallback); }
public void StartBuildingFromSlot(BuildingData dat, bool isRocket, List <InventoryItemSlot> inv, GenericCallback buildCompleteCallback) { beltBuildingOverlay.SetActive(false); sellModeOverlay.SetActive(false); Player_MasterControlCheck.s.buildingController.TryToPlaceItem(dat, isRocket, inv, buildCompleteCallback); scont.BringBuildingBarToFocus(); }