当前位置: 首页>>代码示例>>C#>>正文


C# Button.SetText方法代码示例

本文整理汇总了C#中Button.SetText方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetText方法的具体用法?C# Button.SetText怎么用?C# Button.SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.SetText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var layot = new LinearLayout(this);
            layot.Orientation = Orientation.Vertical;

            _btn1 = new Button(this);
            _btn1.SetText(Resource.String.Button1Text);
            _btn1.Click += OnClickButton1;

            _btn2 = new Button(this);
            _btn2.SetText(Resource.String.Button2Text);
            _btn2.Click += OnClickButton2;

            _btn3 = new Button(this);
            _btn3.SetText(Resource.String.Button3Text);
            _btn3.Click += OnClickButton3;

            _btn4 = new Button(this);
            _btn4.SetText(Resource.String.Button4Text);
            _btn4.Click += OnClickButton4;

            layot.AddView(_btn1);
            layot.AddView(_btn2);
            layot.AddView(_btn3);
            layot.AddView(_btn4);
            SetContentView(layot);
        }
开发者ID:GonzRu,项目名称:test-raygun,代码行数:29,代码来源:MainActivity.cs

示例2: ActivateTimer

        private bool ActivateTimer(RecipeStepTimerHandler t, Button button)
        {
            if (timerIndex >= timerFrames.Length)
                return false;
            t.StartTimer ();
            button.SetText (Resource.String.pause);

            ViewGroup timerFrame = timerFrames [timerIndex];
            timers [timerIndex] = t;
            t.setTimerFrame (timerFrame);
            t.setTimerIndex (timerIndex);
            timerFrame.Visibility = ViewStates.Visible;
            Console.WriteLine ("Activating timer " + timerIndex);
            timerIndex++;
            return true;
        }
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:16,代码来源:TimerPoolHandler.cs

示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.EventUpdateLayout);

            timeDisplay = FindViewById<TextView> (Resource.Id.txtTime);
            //pick_button = FindViewById<Button> (Resource.Id.btnUpdateTime);

            // Add a click listener to the button
            pick_button.Click += (o, e) => ShowDialog (TIME_DIALOG_ID);

            // Get the current time
            hour = DateTime.Now.Hour;
            minute = DateTime.Now.Minute;

            dateDisplay = FindViewById<TextView> (Resource.Id.txtDate);
            //pickDate = FindViewById<Button> (Resource.Id.btnUpdateDate);

            // add a click event handler to the button
            pickDate.Click += delegate { ShowDialog (DATE_DIALOG_ID); };

            // get the current date
            date = DateTime.Today;

            // Display the current date/time
            UpdateDisplay ();

            updateTitle = FindViewById <EditText>(Resource.Id.txtTitle);
            updateLocation = FindViewById<EditText> (Resource.Id.txtLocation);
            update = FindViewById <Button>(Resource.Id.btnUpdate);
            update.Click += Update_Click;
            back = FindViewById<Button> (Resource.Id.btnUpdateBack);
            back.Click += Back_Click;
            update.SetText(Resource.String.UpdateEvent);

            EventDB dbr = new EventDB ();
            nCount = dbr.getEventTotal ();
            if (nCount != 0)
            {
                SetFields ((GEventID.getEventId () ));
            }
        }
开发者ID:Pat-Dolan,项目名称:CMPS285_Team7,代码行数:42,代码来源:EventUpdateActivity.cs

示例4: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // full screen & full brightness
            this.RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
            mWL = ((PowerManager)GetSystemService(Context.PowerService)).NewWakeLock(WakeLockFlags.Full, "BOB");
            mWL.Acquire();
            mView = new MainView(this);
            SetContentView(mView);
            LinearLayout ll = new LinearLayout(this);
            Button b = new Button(this);
            b.SetText("Hello", TextView.BufferType.Normal);
            ll.AddView(b);
            ll.SetGravity(GravityFlags.CenterHorizontal | GravityFlags.CenterVertical);
            this.AddContentView(ll,
                new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent));
        }
开发者ID:jggriffiths,项目名称:XamarinCameraTest,代码行数:20,代码来源:MainActivity.cs

示例5: DeactivateTimer

        private bool DeactivateTimer(RecipeStepTimerHandler t, Button button)
        {
            ViewGroup timerFrame = t.getTimerFrame ();
            t.PauseTimer ();
            button.SetText (Resource.String.start);
            Console.WriteLine ("Deactivating timer " + t.getTimerIndex());
            Console.WriteLine ("Total Timer Index: " + timerIndex);

            timerIndex--;

            //Shift all active timers down
            for (int i = t.getTimerIndex (); i < timerIndex; i++) {
                ViewGroup frame = timerFrames [i];
                timers [i] = timers [i + 1];
                timers [i].setTimerIndex (i);
                timers [i].setTimerFrame (frame);
            }
            timerFrames[timerIndex].Visibility = ViewStates.Gone;

            return true;
        }
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:21,代码来源:TimerPoolHandler.cs

示例6: OnCreateView

        public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Android.Content.Res.Resources res = this.Resources;
            // Android 3.x+ still wants to show title: disable
            Dialog.Window.RequestFeature (WindowFeatures.NoTitle);

            // Create our view
            view = inflater.Inflate (Resource.Layout.AuthKey, container, true);

            if (cds == CommonDialogStates.Auth) {
                //auth
                lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0);
                lblInput0.Visibility = ViewStates.Invisible;
                lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2);
                lblInput2.Visibility = ViewStates.Invisible;
                tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2);
                tvinput2.Visibility = ViewStates.Invisible;

                txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel);
                txtChannel.Visibility = ViewStates.Invisible;

                tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel);
                tvAuthLabel.SetText (Resource.String.auth);

                tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1);
                tvinput1.SetText (Resource.String.authkey);

                // Handle dismiss button click
                btnSet = view.FindViewById<Button> (Resource.Id.btnSet);
                btnSet.Click += ButtonSetClick;

                btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2);
                btnSet2.Visibility = ViewStates.Invisible;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
                //end auth
            } else if ((cds == CommonDialogStates.AuditPresence) ||
                       (cds == CommonDialogStates.AuditSubscribe) ||
                       (cds == CommonDialogStates.RevokePresence) ||
                       (cds == CommonDialogStates.RevokeSubscribe)) {
                //auth
                lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0);
                lblInput0.Visibility = ViewStates.Invisible;
                lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2);
                lblInput2.Visibility = ViewStates.Invisible;
                tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2);
                tvinput2.Visibility = ViewStates.Invisible;

                txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel);
                txtChannel.Visibility = ViewStates.Invisible;

                tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel);
                tvAuthLabel.SetText (Resource.String.auth);

                tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1);
                tvinput1.SetText (Resource.String.authopt);

                // Handle dismiss button click
                btnSet = view.FindViewById<Button> (Resource.Id.btnSet);
                btnSet.Click += ButtonSetClick;

                btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2);
                btnSet2.Visibility = ViewStates.Invisible;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
                //end auth
            } else if (cds == CommonDialogStates.ChangeUuid) {
                lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0);
                lblInput0.Visibility = ViewStates.Invisible;
                txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel);
                txtChannel.Visibility = ViewStates.Invisible;
                lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2);
                lblInput2.Visibility = ViewStates.Invisible;
                tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2);
                tvinput2.Visibility = ViewStates.Invisible;


                tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel);
                tvAuthLabel.SetText (Resource.String.btnChangeUuid);

                tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1);
                tvinput1.SetText (Resource.String.enterUuid);

                // Handle dismiss button click
                btnSet = view.FindViewById<Button> (Resource.Id.btnSet);
                btnSet.SetText (Resource.String.btnChangeUuid);
                btnSet.Click += ButtonSetClick;

                btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2);
                btnSet2.Visibility = ViewStates.Invisible;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
            } else if (cds == CommonDialogStates.PresenceHeartbeat) {
                lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0);
                lblInput0.Visibility = ViewStates.Invisible;
                txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel);
                txtChannel.Visibility = ViewStates.Invisible;
//.........这里部分代码省略.........
开发者ID:hakangs,项目名称:c-sharp,代码行数:101,代码来源:CommonDialogFragment.cs

示例7: ShowPopUpMessage

        public void ShowPopUpMessage(int text)
        {
            AlertDialog alert = new AlertDialog.Builder(this).SetNegativeButton(Resource.String.btnClose, (object s,
                                                                                                                DialogClickEventArgs eventClick) =>
                {
                }).Create();

            LinearLayout dialogLayout = new LinearLayout(this);
            dialogLayout.Orientation = Orientation.Vertical;

            TextView txtHelp = new TextView(this);
            ;
            Button btnCancel = new Button(this);
            ImageView imgHelpView = null;

            btnCancel.SetText(Resource.String.btnCancel);

            imgHelpView = new ImageView(this);

            switch (text)
            {
                case 0:
                    txtHelp.SetText(Resource.String.txtHelpVariables);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpVariable);
                    break;
                case 500:
                    txtHelp.SetText(Resource.String.txtHelpPython);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpPython);
                    break;
                case 501:
                    txtHelp.SetText(Resource.String.txtHelpPascal);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpPascal);
                    break;
                case 800:
                    txtHelp.SetText(Resource.String.txtHelpMap);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpMap);
                    break;
                case 801:
                    txtHelp.SetText(Resource.String.txtHelpRoad);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpRoad);
                    break;
                case 802:
                    txtHelp.SetText(Resource.String.txtHelpShop);
                    imgHelpView.SetImageResource(Resource.Drawable.HelpShop);
                    break;
                case 803:
                    txtHelp.SetText(Resource.String.txtHelpFunctions);
                    imgHelpView.SetImageResource(Resource.Drawable.blue);
                    break;
            }

            if (imgHelpView != null)
            {
                dialogLayout.AddView(imgHelpView);
            }

            dialogLayout.AddView(txtHelp);

            ScrollView scrollPane = new ScrollView(this);
            scrollPane.AddView(dialogLayout);
            alert.SetView(scrollPane);

            alert.Show();
        }
开发者ID:ZuydUniversity,项目名称:ProgramADroid,代码行数:64,代码来源:ActivityHelp.cs

示例8: OnCreateView

        public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Android 3.x+ still wants to show title: disable
            Dialog.Window.RequestFeature (WindowFeatures.NoTitle);

            // Create our view
            view = inflater.Inflate (Resource.Layout.GrantDialog, container, true);

            if (cds == CommonDialogStates.Grant) {

                var tvGrantLabel = view.FindViewById<TextView> (Resource.Id.tvGrantLabel);
                tvGrantLabel.Text = "Grant Access";
                if (IsPresenceGrant) {
                    tvGrantLabel.Text = "Presence Grant Access";
                }
                TextView tvGrantChannelGroup = view.FindViewById<TextView> (Resource.Id.lblGrantChannelGroup);
                tvGrantChannelGroup.Visibility = ViewStates.Gone;
                EditText txtChannelGroup = view.FindViewById<EditText> (Resource.Id.txtChannelGroup);
                txtChannelGroup.Visibility = ViewStates.Gone;


                // Handle dismiss button click
                btnGrant = view.FindViewById<Button> (Resource.Id.btnGrant);
                btnGrant.Click += ButtonGrantClick;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
            } else if (cds == CommonDialogStates.ChannelGroupGrant) {
                
                var tvGrantLabel = view.FindViewById<TextView> (Resource.Id.tvGrantLabel);
                tvGrantLabel.Text = "Grant Access";
                if (IsPresenceGrant) {
                    tvGrantLabel.Text = "Presence Grant Access";
                }
                TextView tvGrantChannel = view.FindViewById<TextView> (Resource.Id.lblGrantChannel);
                tvGrantChannel.Visibility = ViewStates.Gone;
                EditText txtChannel = view.FindViewById<EditText> (Resource.Id.txtChannel);
                txtChannel.Visibility = ViewStates.Gone;

                // Handle dismiss button click
                btnGrant = view.FindViewById<Button> (Resource.Id.btnGrant);
                btnGrant.Click += ButtonGrantClick;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
            } else if (cds == CommonDialogStates.HereNow) {
                var tvGrantLabel = view.FindViewById<TextView> (Resource.Id.tvGrantLabel);
                tvGrantLabel.SetText (Resource.String.hereNow);

                lblInput1 = view.FindViewById<TextView> (Resource.Id.lblGrant1);
                lblInput1.SetText (Resource.String.showUuid);

                lblInput2 = view.FindViewById<TextView> (Resource.Id.lblGrant2);
                lblInput2.SetText (Resource.String.showUserState);

                lblInput3 = view.FindViewById<TextView> (Resource.Id.lblGrant3);
                lblInput3.Visibility = ViewStates.Gone;
                //lblInput3.SetText (Resource.String.channel);

                txtVal = view.FindViewById<EditText> (Resource.Id.txtttl);
                txtVal.Visibility = ViewStates.Gone;
                //txtVal.InputType = Android.Text.InputTypes.TextFlagAutoComplete;

                txtauth = view.FindViewById<EditText> (Resource.Id.txtauth);
                txtauth.Visibility = ViewStates.Invisible;

                lblAuth = view.FindViewById<TextView> (Resource.Id.lblinput1);
                lblAuth.Visibility = ViewStates.Invisible;

                tbRead = view.FindViewById<ToggleButton> (Resource.Id.tbRead);
                tbRead.Checked = true;

                TextView tvGrantChannelGroup = view.FindViewById<TextView> (Resource.Id.lblGrantChannelGroup);
                tvGrantChannelGroup.Visibility = ViewStates.Gone;
                EditText txtChannelGroup = view.FindViewById<EditText> (Resource.Id.txtChannelGroup);
                txtChannelGroup.Visibility = ViewStates.Gone;

                // Handle dismiss button click
                btnGrant = view.FindViewById<Button> (Resource.Id.btnGrant);
                btnGrant.SetText (Resource.String.hereNow);
                btnGrant.Click += ButtonGrantClick;

                btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel);
                btnDismiss.Click += ButtonDismissClick;
            } else if (cds == CommonDialogStates.Publish) {
                var tvGrantLabel = view.FindViewById<TextView> (Resource.Id.tvGrantLabel);
                tvGrantLabel.SetText (Resource.String.publish);

                lblInput1 = view.FindViewById<TextView> (Resource.Id.lblGrant1);
                lblInput1.SetText (Resource.String.inStore);

                lblInput3 = view.FindViewById<TextView> (Resource.Id.lblGrant3);
                lblInput3.SetText (Resource.String.message);

                tbRead = view.FindViewById<ToggleButton> (Resource.Id.tbRead);
                tbRead.Checked = true;

                lblInput2 = view.FindViewById<TextView> (Resource.Id.lblGrant2);
                lblInput2.Visibility = ViewStates.Invisible;

//.........这里部分代码省略.........
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:101,代码来源:GrantDialogFragment.cs

示例9: UpdateButtonTitle

		static void UpdateButtonTitle (Button button, FullScheduleCellViewModel viewModel) {
			button.SetTextSize (global::Android.Util.ComplexUnitType.Dip, viewModel.IsSelected ? 24 : 48);
			button.SetText (viewModel.IsSelected ? "✓" : "○", TextView.BufferType.Normal);
		}
开发者ID:vgvassilev,项目名称:couchbase-connect-14,代码行数:4,代码来源:FullScheduleCellRenderer.cs


注:本文中的Button.SetText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。