public async Task SearchOnline() { mAlliances.Clear(); mCharacters.Clear(); mCorporations.Clear(); mMailinglists.Clear(); if (mText == null) { mItems.Clear(); mCancelRunningTask = null; return; } IsLoading = true; Task <EntityInfo[]> task; mRunningTask = task = EntityLookupAsync.Search(mText, SearchOptions.Online); var result = await task; IsLoading = false; LoadResults(result); }
public async Task FinishLookupsAsync() { var array = mLookups.Values.ToArray(); mLookups.Clear(); await EntityLookupAsync.LookupIDs(array); }
public void Select(EntityInfo item) { mRunningTask = EntityLookupAsync.AddLookups(item); if (Selected != null) { Selected(this, new SelectedSuggestionEventArgs() { InfoSelected = item }); } }
public void Init() { InfoCache = new UserInfoCache(this); mAccountDB.Load(); foreach (var i in mAccountDB.Accounts) { Account account = new Account(this, i); mAccounts.Add(account); mViewAccounts.Add(account.ViewAccount); if (account.DBAccount.Permissions.HasFlag(Auth.AccessFlag.MailSend)) { mSendAccounts.Add(account.ViewAccount); } } List <DraftMessageSource> loaded_drafts = new List <DraftMessageSource>(); foreach (var i in mAccountDB.Drafts) { DraftMessageSource source = new DraftMessageSource(this, i); if (source.Account == null) { continue; } mDrafts.Add(source); loaded_drafts.Add(source); } TaskChainHandler load_draft_ids = async delegate() { foreach (var i in loaded_drafts) { await EntityLookupAsync.LookupIDs(i.Recipients); } }; AddTaskToChain(load_draft_ids); }
private async Task LoadOffline() { mAlliances.Clear(); mCharacters.Clear(); mCorporations.Clear(); mMailinglists.Clear(); if (mText == null) { mItems.Clear(); mCancelRunningTask = null; return; } //IsLoading = true; var result = await EntityLookupAsync.Search(mText, SearchOptions.Offline, mCancelRunningTask.Token); //IsLoading = false; LoadResults(result); mCancelRunningTask = null; }
private async void mEditor_Selected(object sender, SelectedSuggestionEventArgs e) { if (e.InfoSelected == null) { EntityInfo[] list = await EntityLookupAsync.Search(e.TextSelected, SearchOptions.Offline | SearchOptions.ExactMatch); if (list.Length == 1) { e.InfoSelected = list[0]; } else { e.InfoSelected = new EntityInfo() { EntityID = -1, EntityType = Common.EntityType.Character, Name = e.TextSelected }; } e.TextSelected = null; } SelectItem(e.InfoSelected); }