protected virtual async Task ProcessObjectClickedAsync(D thisObject, int index) { if (ObjectClickedAsync == null) { return; } await ObjectClickedAsync.Invoke(thisObject, HandList.IndexOf(thisObject)); }
public async Task ObjectClickProcessAsync(D thisObject) { if (AutoSelect == EnumAutoType.ShowObjectOnly) { if (ConsiderSelectOneAsync != null) { await ConsiderSelectOneAsync.Invoke(thisObject); } } if (AutoSelect == EnumAutoType.SelectAsMany) { if (ConsiderSelectOneAsync != null) { await ConsiderSelectOneAsync.Invoke(thisObject); } if (thisObject.IsSelected == true) { if (_orderOfObjectsSelectedList.ObjectExist(thisObject.Deck) == true) { _orderOfObjectsSelectedList.RemoveSpecificItem(thisObject); } thisObject.IsSelected = false; if (AutoSelectedOneCompletedAsync != null) { await AutoSelectedOneCompletedAsync.Invoke(); // well see if we still need this(?) } return; } if (BeforeAutoSelectObjectAsync != null) { await BeforeAutoSelectObjectAsync.Invoke(); } thisObject.IsSelected = true; if (_orderOfObjectsSelectedList.ObjectExist(thisObject.Deck) == false) { _orderOfObjectsSelectedList.Add(thisObject); } if (AutoSelectedOneCompletedAsync != null) { await AutoSelectedOneCompletedAsync.Invoke(); } return; } if (AutoSelect == EnumAutoType.SelectOneOnly) { if (CanSelectSingleObject(thisObject) == false) { return;// because you can't even select the single card } if (ConsiderSelectOneAsync != null) { await ConsiderSelectOneAsync.Invoke(thisObject); } if (thisObject.IsSelected == true) { thisObject.IsSelected = false; if (AutoSelectedOneCompletedAsync != null) { await AutoSelectedOneCompletedAsync.Invoke(); } return; } HandList.UnselectAllObjects(); if (BeforeAutoSelectObjectAsync != null) { await BeforeAutoSelectObjectAsync.Invoke(); } thisObject.IsSelected = true; if (AutoSelectedOneCompletedAsync != null) { await AutoSelectedOneCompletedAsync.Invoke(); } return; } await ProcessObjectClickedAsync(thisObject, HandList.IndexOf(thisObject)); }