protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.submenu_summary); SetContentView (Resource.Layout.PrintInvSumm); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; apara = DataHelper.GetAdPara (pathToDatabase); Button butPrint= FindViewById<Button> (Resource.Id.printsumm); Button butInvBack= FindViewById<Button> (Resource.Id.printsumm_cancel); EditText frd = FindViewById<EditText> (Resource.Id.trxdatefr); EditText tod = FindViewById<EditText> (Resource.Id.trxdateto); imm = (InputMethodManager)GetSystemService(Context.InputMethodService); frd.Text = DateTime.Today.ToString ("dd-MM-yyyy"); frd.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(frd.WindowToken, 0); ShowDialog (DATE_DIALOG_ID1); }; tod.Text = DateTime.Today.ToString ("dd-MM-yyyy"); date = DateTime.Today; tod.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(tod.WindowToken, 0); ShowDialog (DATE_DIALOG_ID2); }; butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; butPrint.Click+= ButPrint_Click; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.SHOWLOCATION); SetContentView (Resource.Layout.ShowLocation); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; latlng= Intent.GetStringExtra ("location") ?? ""; date = DateTime.Today; wv1= FindViewById<WebView> (Resource.Id.webView1); btnBack =FindViewById<Button> (Resource.Id.butBack); btnShow =FindViewById<Button> (Resource.Id.butMaP); txtdate = FindViewById<EditText> (Resource.Id.date); wv1.SetWebViewClient (new myWebView ()); imm = (InputMethodManager)GetSystemService(Context.InputMethodService); txtdate.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(txtdate.WindowToken, 0); ShowDialog (DATE_DIALOG_ID1); }; btnShow.Click+= (object sender, EventArgs e) => { ShowMap(); }; btnBack.Click+= (object sender, EventArgs e) => { base.OnBackPressed(); }; // Create your application here }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); imm = (InputMethodManager)GetSystemService(Context.InputMethodService); var vowelsBtn = FindViewById<Button>(Resource.Id.vowels); var consonBtn = FindViewById<Button>(Resource.Id.consonants); var edittext = FindViewById<EditText>(Resource.Id.input); edittext.InputType = Android.Text.InputTypes.TextVariationPassword; edittext.KeyPress += (sender, e) => { imm.HideSoftInputFromWindow(edittext.WindowToken, HideSoftInputFlags.NotAlways); e.Handled = true; }; vowelsBtn.Click += (sender, e) => { int count = TextCounter.NumVowels(edittext.Text); string msg = count + " vowels found."; Toast.MakeText(this, msg, ToastLength.Short).Show(); }; consonBtn.Click += (sender, e) => { int count = TextCounter.NumConsonants(edittext.Text); string msg = count + " consonants found."; Toast.MakeText(this, msg, ToastLength.Short).Show(); }; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Create your application here SetContentView (Resource.Layout.active_code_layout); ActionBar.NavigationMode = ActionBarNavigationMode.Standard; ActionBar.Title = GetString(Resource.String.active_account_title); ActionBar.SetDisplayShowTitleEnabled (false); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetDisplayShowHomeEnabled (true); setHeadingTitle (GetString(Resource.String.active_account_title)); inputManager = (InputMethodManager)this.GetSystemService (Context.InputMethodService); var edInputCode = FindViewById<EditText> (Resource.Id.ed_code_active); var btnSend = FindViewById<Button> (Resource.Id.btnSendActiveCode); var tvError = FindViewById<TextView> (Resource.Id.tvErrorActiveCode); tvError.Visibility = ViewStates.Gone; btnSend.Enabled = false; edInputCode.TextChanged += (sender, e) => { tvError.Visibility = ViewStates.Gone; if(edInputCode.Text.Count() <= 0) { btnSend.Enabled = false; } else { btnSend.Enabled = true; } }; btnSend.Click += (sender, e) => { inputManager.HideSoftInputFromWindow (edInputCode.WindowToken, 0); if(edInputCode.Text.Trim().Count() <= 0) { tvError.Visibility = ViewStates.Visible; } else { activeCodeRequest(edInputCode.Text.Trim()); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // SetContentView(Resource.Layout.Main); // TxtUrl = FindViewById<EditText>(Resource.Id.txtUrl); _InputMethodManager = (InputMethodManager)GetSystemService(Context.InputMethodService); _InputMethodManager.HideSoftInputFromWindow( TxtUrl.WindowToken, HideSoftInputFlags.None); // var client = new ContentWebViewClient(); client.WebViewLocaitonChanged += (sender, e) => { WriteLine($"{ e.CommandString }"); }; // MyWebView = FindViewById<WebView>(Resource.Id.webview); MyWebView.SetWebViewClient(client); MyWebView.Settings.JavaScriptEnabled = true; // 負責與頁面溝通 - Native -> WebView JavaScriptResult callResult = new JavaScriptResult(); callResult.JavaScriptResultReceived += (object sender, JavaScriptResult.JavaScriptResultReceivedEventArgs e) => { WriteLine(e.Result); RunOnUiThread(() => { TxtUrl.Text = e.Result; }); }; // BtnGo = FindViewById<Button>(Resource.Id.btnGo); BtnGo.Click += (sender, e) => { RunOnUiThread(() => { MyWebView.EvaluateJavascript(@"msg( 1234 );", callResult); }); }; MyWebView.LoadDataWithBaseURL( null , @"<html> <head> <title>Local String</title> <style type='text/css'>p{font-family : Verdana; color : purple }</style> <script language='JavaScript'> var lookup = '中文訊息' function msg( text ){ return text + ' received'; } </script> </head> <body><p>Hello World!</p><br /> <button type='button' onclick='TP.CallFromPage(lookup)' text='Hi From Page'>Hi From Page</button> </body> </html>" , "text/html" , "utf-8" , null); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); RequestWindowFeature (WindowFeatures.ActionBar); SetContentView (Resource.Layout.sign_in_layout); ActionBar.NavigationMode = ActionBarNavigationMode.Standard; ActionBar.SetTitle(Resource.String.signin_title); ActionBar.SetDisplayShowTitleEnabled (false); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetDisplayShowHomeEnabled (true); inputManager = (InputMethodManager)this.GetSystemService (Context.InputMethodService); loginActivity = this; edUserName = FindViewById<EditText> (Resource.Id.edit_username_login); edPass = FindViewById<EditText> (Resource.Id.edit_pass_login); tvForgotPass = FindViewById<TextView> (Resource.Id.tv_forgotpass); tvRegister = FindViewById<TextView> (Resource.Id.tv_registry); cbRememberPass = FindViewById<CheckBox> (Resource.Id.checkbox_remember); cbShowPass = FindViewById<CheckBox>(Resource.Id.checkbox_showpassword); btnLogin = FindViewById<Button> (Resource.Id.btn_sigin); tvErrorLogin = FindViewById<TextView> (Resource.Id.tv_error_login); btnLogin.Enabled = false; btnLogin.Click += (sender, e) => { inputManager.HideSoftInputFromWindow (edUserName.WindowToken, 0); inputManager.HideSoftInputFromWindow (edPass.WindowToken, 0); sendLogin(); }; cbShowPass.CheckedChange+=(sender, e) => { Boolean isch =cbShowPass.Checked; if(cbShowPass.Checked){ edPass.TransformationMethod=global::Android.Text.Method.HideReturnsTransformationMethod.Instance; Utils.keepShowPassWord(true); }else{ edPass.TransformationMethod=global::Android.Text.Method.PasswordTransformationMethod.Instance; Utils.keepShowPassWord(false); } }; edUserName.TextChanged += (sender, e) => { tvErrorLogin.Visibility = ViewStates.Gone; if(edUserName.Text.Count() <= 0) { btnLogin.Enabled = false; } else { btnLogin.Enabled = true; } }; edPass.TextChanged += (sender, e) => { tvErrorLogin.Visibility = ViewStates.Gone; if(edPass.Text.Count() <= 0) { btnLogin.Enabled = false; } else { btnLogin.Enabled = true; } }; tvForgotPass.Click += (sender, e) => { Intent intent = new Intent(this, typeof(ResetPassword)); StartActivity(intent); }; tvRegister.Click += (sender, e) => { utilsAndroid.onStartRegistry(this); }; if (Utils.getRememberLogin ()) { if (Utils.getUserName () != null && Utils.getPassWord () != null) { edUserName.Text = Utils.getUserName (); edPass.Text = Utils.getPassWord (); cbRememberPass.Checked = true; } } if (Utils.getShowPassWord ()) { cbShowPass.Checked = true; edPass.TransformationMethod=global::Android.Text.Method.HideReturnsTransformationMethod.Instance; } else { cbShowPass.Checked = false; edPass.TransformationMethod=global::Android.Text.Method.PasswordTransformationMethod.Instance; } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // SetContentView (Resource.Layout.Main); var client = new ContentWebViewClient (); client.WebViewLocaitonChanged += (object sender, ContentWebViewClient.WebViewLocaitonChangedEventArgs e) => { WriteLine (e.CommandString); }; client.WebViewLoadCompleted += (object sender, ContentWebViewClient.WebViewLoadCompletedEventArgs e) => { RunOnUiThread (() => { AndHUD.Shared.Dismiss (this); }); }; MyWebView = FindViewById<WebView> (Resource.Id.webview); MyWebView.SetWebViewClient (client); MyWebView.Settings.JavaScriptEnabled = true; MyWebView.Settings.UserAgentString = @"Android"; #region EditText _InputMethodManager = (InputMethodManager)GetSystemService (Context.InputMethodService); TxtUrl = FindViewById<EditText> (Resource.Id.txtUrl); TxtUrl.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { WriteLine (TxtUrl.Text + ":" + e.Text); }; #endregion BtnGo = FindViewById<Button> (Resource.Id.btnGo); BtnGo.Click += (object sender, EventArgs e) => { // 隱藏鍵盤 _InputMethodManager.HideSoftInputFromWindow ( TxtUrl.WindowToken, HideSoftInputFlags.None); // var url = TxtUrl.Text.Trim (); // 詢問是否要過去指定頁面 AlertDialog.Builder alert = new AlertDialog.Builder (this); alert.SetTitle ("Info"); alert.SetMessage ( $"請問是否前往 { url }" ); alert.SetNegativeButton ("取消", (senderAlert, args) => { }); alert.SetPositiveButton ("確認", (senderAlert, args) => { RunOnUiThread ( () => { AndHUD.Shared.Show (this, "Status Message", -1, MaskType.Clear); } ); MyWebView.LoadUrl (url); }); RunOnUiThread (() => { alert.Show (); }); }; }