static void display(IEngToSpaDictSrv dictSrv, IMainView view, QueryDictResult result) { try { // status banner view.displayText(Constants.BANNER_SEPARATOR + Constants.BRLINE); if (!result.IsEmpty) { view.displayText(LocationLangSrv.getTagValue(Constants.TAG_DICT_TEXT_FOUND) + Constants.BRLINE); view.addEntryToSuggestList(result.sourceText); } else { view.displayText(string.Format(LocationLangSrv.getTagValue(Constants.TAG_DICT_TEXT_NOT_FOUND), result.sourceText) + Constants.BRLINE); } //result view.displayText(Constants.BANNER_SEPARATOR + Constants.BRLINE); view.displayText(QueryDictResultFormater.toSimpleText(result)); // banner dict. resume view.displayText(Constants.BANNER_SEPARATOR + Constants.BRLINE); var totalEntriesText = string.Format(LocationLangSrv.getTagValue(Constants.TAG_DICT_RESUME_DATA), dictSrv.totalEntries()); view.displayText(totalEntriesText + Constants.BRLINE); view.displayText(Constants.BANNER_SEPARATOR + Constants.BRLINE); view.displayScrollUpFirstLine(); } catch (Exception ex) { log.Debug(ex.StackTrace); } }
protected override void OnCreate(Bundle savedInstanceState) { try { userWordsCache = new List <string>(); mainActivity = this; // ANDROID CONFIG assetsMng = this.Assets; base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); inputUser = FindViewById <AutoCompleteTextView>(Resource.Id.inputUser); inputUser.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Up && e.KeyCode == Keycode.Enter) { dictHandle(inputUser.Text); e.Handled = true; } }; // config suggestion words searchBtn = FindViewById <Button>(Resource.Id.searchBtn); resultView = FindViewById <TextView>(Resource.Id.resultView); statusView = FindViewById <TextView>(Resource.Id.statusView); view = this; // set runtime info/error output channel // setup eviroment Eviroment.assetHandlerR = (string assetResource) => { return(new StreamReader(assetsMng.Open(assetResource))); }; Eviroment.resourceHandlerR_W = (string resource) => { //Context.OpenFileOutput(String, FileCreationMode) var full_resources_path = CacheDir.AbsolutePath; if (System.IO.File.Exists(full_resources_path)) { System.IO.File.Create(full_resources_path); } var resource_full_path = Path.Combine(full_resources_path, resource); return(File.Open(resource_full_path, FileMode.OpenOrCreate, FileAccess.ReadWrite)); }; GlobalRuntimeMsgsInfoSrv.infoChannel = statusInfoHdl; GlobalRuntimeMsgsInfoSrv.errorChannel = displayErrorHdl; LocationLangSrv.changeToEng(); dictSrv = new EngToSpaDictSrvImpl(); view.init(); view.setWindowName(LocationLangSrv.getTagValue(Constants.APP_NAME_TAG)); view.setTipHelp(LocationLangSrv.getTagValue(Constants.APP_HELP_TIP)); view.setDictHandler(searchDictHandler); view.setSearchLabel(LocationLangSrv.getTagValue(Constants.SEARCH_LABEL)); view.clearStatusArea(); view.displayStatus(LocationLangSrv.getTagValue(Constants.STATUS_OK_MSG) + Constants.BRLINE); view.displayStatus(LocationLangSrv.getTagValue(Constants.DICTIONARY_INFO) + dictSrv.getDictionaryName() + Constants.BRLINE); view.setFocusOnUserInput(); // events config searchBtn.Click += delegate { dictHandle(inputUser.Text); }; } catch (Exception ex) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Info"); alert.SetMessage(LocationLangSrv.getTagValue(Constants.INIT_APPLICATION_ERROR) + Constants.BRLINE); Dialog dialog = alert.Create(); dialog.Show(); log.Debug(ex.StackTrace); } }