• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Button类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnCreate

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

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            textRegistrationStatus = FindViewById<TextView>(Resource.Id.textRegistrationStatus);
            textRegistrationId = FindViewById<TextView>(Resource.Id.textRegistrationId);
            textLastMsg = FindViewById<TextView>(Resource.Id.textLastMessage);
            buttonRegister = FindViewById<Button>(Resource.Id.buttonRegister);

            Log.Info("C2DM-Sharp-UI", "Hello World");

            this.buttonRegister.Click += delegate
            {
                if (!registered)
                {
                    Log.Info("C2DM-Sharp", "Registering...");
                    PushSharp.Client.MonoForAndroid.C2dmClient.Register(this, senderIdEmail);
                }
                else
                {
                    Log.Info("C2DM-Sharp", "Unregistering...");
                    PushSharp.Client.MonoForAndroid.C2dmClient.Unregister(this);
                }

                RunOnUiThread(() =>
                {
                    //Disable the button so that we can't click it again
                    //until we get back to the activity from a notification
                    this.buttonRegister.Enabled = false;
                });
            };
        }
开发者ID:nuttapol,项目名称:PushSharp,代码行数:35,代码来源:DefaultActivity.cs


示例2: Awake

 void Awake()
 {
     image = GetComponent<Image>();
     button = GetComponent<Button>();
     text = GetComponentInChildren<Text>();
     References.stateManager.changeState += onChangeState;
 }
开发者ID:B-LiTE,项目名称:MemeTeam,代码行数:7,代码来源:RealtimeButton.cs


示例3: GetWidgetByNameTestNoRegionSingleWindow

		public void GetWidgetByNameTestNoRegionSingleWindow()
		{
			// single system window
			{
				int leftClickCount = 0;

				Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) =>
				{
					AutomationRunner testRunner = new AutomationRunner();
					testRunner.ClickByName("left");
					testRunner.Wait(.5);

					resultsHarness.AddTestResult(leftClickCount == 1, "Got left button click");
				};

				SystemWindow buttonContainer = new SystemWindow(300, 200);

				Button leftButton = new Button("left", 10, 40);
				leftButton.Name = "left";
				leftButton.Click += (sender, e) => { leftClickCount++; };
				buttonContainer.AddChild(leftButton);

				AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(buttonContainer, testToRun, 10);

				Assert.IsTrue(testHarness.AllTestsPassed);
				Assert.IsTrue(testHarness.TestCount == 1); // make sure we can all our tests
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:28,代码来源:AutomationRunnerTests.cs


示例4: GetNewState

        public MenuState GetNewState(Button btn)
        {
            if (!_pageButtonActions.Contains(btn))
                return MenuState.None;

            return (MenuState)_pageButtonActions[btn];
        }
开发者ID:kevjett,项目名称:GrillMaster,代码行数:7,代码来源:MenuPage.cs


示例5: onCreate

		protected internal override void onCreate(Bundle savedInstanceState)
		{
			base.onCreate(savedInstanceState);
			ContentView = R.layout.uploader;

			mTargetDevicePicker = (DevicePicker) FragmentManager.findFragmentById(R.id.targetPicker);
			mTargetDevicePicker.DeviceType = SmcDevice.TYPE_PROVIDER;
			mTargetDevicePicker.DeviceSelectedListener = this;
			mUploadButton = (Button) findViewById(R.id.button);
			mUploadButton.OnClickListener = uploadClickListener;
			progressBar = (ProgressBar) findViewById(R.id.progress);


			SmcItem.LocalContent content = LocalContent;

			if (content == null)
			{
				Toast.makeText(this, "Content not supported", Toast.LENGTH_SHORT).show();
				this.finish();
			}
			else
			{
				itemToUpload = new SmcItem(content);
				((TextView)findViewById(R.id.header)).Text = "File: " + itemToUpload.Uri.ToString();
			}
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:26,代码来源:Uploader.cs


示例6: MainWindow

    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build();
        //bingo.NumeroInicialBolas = 43;
        bingo.Iniciar();

        //		uint rowCount = (uint) bingo.NumeroInicialBolas / 10;

        //		for (uint row = 0; row < rowCount; row++){
        //			for (uint col = 0; col <= 9; col++) {
        //				Button button = new Button();
        //				button.Label = "" + (col + 1 + (row * 10));
        //				button.Visible = true;
        //				//table.Add (button);
        //				table.Attach (button, col, 1 + col, row, row + 1,
        //		              AttachOptions.Fill ,
        //		              AttachOptions.Fill,
        //		              1,1);
        //		}

        for (uint index = 0; index < bingo.NumeroInicialBolas; index ++){
            Button button = new Button();
            button.Label = "" + (index + 1);
            button.Visible = true;
            uint row = index / 10;
            uint col = index % 10; //mod
            table.Attach (button, col, 1 + col, row, row + 1,
                      AttachOptions.Fill ,
                      AttachOptions.Fill,
                      1,1);

        }
    }
开发者ID:ivives,项目名称:EDcs,代码行数:34,代码来源:MainWindow.cs


示例7: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			dice1 = new Dice(1, 1, 6);
			dice2 = new Dice(2, 1, 6);
			audio = new PlayAudio (this);
		
			base.OnCreate (bundle);

			game = LbManager.GetGame(Intent.GetIntExtra ("Battle", -1), Intent.GetIntExtra("Scenario", -1));

			// set our layout to be the home screen
			SetContentView(Resource.Layout.General);		

			imgBack = FindViewById<ImageView> (Resource.Id.titleSubLbBack);
			imgLb = FindViewById<ImageView> (Resource.Id.titleSubLb);

			// title
			txtBattleName = FindViewById<TextView>(Resource.Id.titleSubBattleName);
			txtScenarioName = FindViewById<TextView>(Resource.Id.titleSubScenarioName);
			
			imgGeneral2Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die1);
			imgGeneral2Die2 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die2);
			btnGeneral2DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral2DiceRoll);

			imgGeneral1Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral1Die1);
			btnGeneral1DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral1DiceRoll);
		}
开发者ID:jcapuano328,项目名称:LB.mono,代码行数:27,代码来源:GeneralActivity.cs


示例8: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            this.RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            loggInnButton = FindViewById<Button>(Resource.Id.loggInnButton);
            EditText editText1 = FindViewById<EditText>(Resource.Id.txtEmail);
            EditText editText2 = FindViewById<EditText>(Resource.Id.txtPassword);

            loggInnButton.Click += delegate
            {
                sendText1 = editText1.Text;
                sendText2 = editText2.Text;
                if (SendToPhp() == 1)
                {
                    StartActivity(typeof(Menu));
                    ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
                    ISharedPreferencesEditor editor = prefs.Edit();
                    editor.PutString("userName", editText1.Text);
                    editor.Apply();
                }
                else if(SendToPhp() == 2)
                {
                    Toast msg = Toast.MakeText(this, "Feil brukernavn.", ToastLength.Long);
                    msg.Show();
                } else
                {
                    Toast msg = Toast.MakeText(this, "Feil passord.", ToastLength.Long);
                    msg.Show();
                }
            };
        }
开发者ID:NicoD-NITH,项目名称:pj3100-gruppe6,代码行数:33,代码来源:MainActivity.cs


示例9: OnCreate

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

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            button = FindViewById<Button>(Resource.Id.GetLocationButton);
            latitude = FindViewById<TextView>(Resource.Id.LatitudeText);
            longitude = FindViewById<TextView>(Resource.Id.LongitudeText);
            provider = FindViewById<TextView>(Resource.Id.ProviderText);
            address = FindViewById<TextView>(Resource.Id.AddressText);

            // MapFragment の用意と初期の場所を指定します。
            // MapFragment.Map が deprecated みたいなので、正しい書き方を教えてください><
            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.MapFragment);
            map = mapFrag.Map;
            if (map != null) // Map の準備が出来たら (最初は null を返します)
            {
                map.MyLocationEnabled = true; // 現在地ボタン オン
                map.UiSettings.ZoomControlsEnabled = true; // ズームコントロール オン
                // 初期位置(カメラ)を移動
                map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(
                    new CameraPosition(
                        new LatLng(35.685344d, 139.753029d), // 皇居(中心位置)
                        12f, 0f, 0f))); // ズームレベル、方位、傾き
            }
        }
开发者ID:zcccust,项目名称:Study,代码行数:28,代码来源:MainActivity.cs


示例10: OnCreate

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

            txtAuditDate = FindViewById<EditText>(Resource.Id.txtAuditDate);
            txtAuditor = FindViewById<EditText>(Resource.Id.txtAuditor);
            txtManu= FindViewById<EditText>(Resource.Id.txtManu);
            txtModel = FindViewById<EditText>(Resource.Id.txtModel);
            txtComputerName = FindViewById<EditText>(Resource.Id.txtCompName);
            txtOperSys = FindViewById<EditText>(Resource.Id.txtOS);
            txtOperSysArch = FindViewById<EditText>(Resource.Id.txtOSArch);
            txtServicePack = FindViewById<EditText>(Resource.Id.txtServicePack);
            txtSerialNo = FindViewById<EditText>(Resource.Id.txtSerialNo);
            txtProcessorName = FindViewById<EditText>(Resource.Id.txtProcessName);
            txtProcessorsAmt = FindViewById<EditText>(Resource.Id.txtProcessorsNo);
            txtRamAmt = FindViewById<EditText>(Resource.Id.txtRam);
            txtHardDriveSize = FindViewById<EditText>(Resource.Id.txtHardDriveSize);
            txtAvailSpace = FindViewById<EditText>(Resource.Id.txtAvailSpace);
            txtComments = FindViewById<EditText>(Resource.Id.txtComments);

            btnSave = FindViewById<Button>(Resource.Id.btnUpdate);
            btnViewMore = FindViewById<Button>(Resource.Id.btnViewMore);
            btnScan = FindViewById<Button>(Resource.Id.btnScan);

            btnViewMore.Click += BtnViewMore_Click;
            btnScan.Click += BtnScan_Click;
            btnSave.Click += BtnSave_Click;
        }
开发者ID:CaptainLDawg,项目名称:PC-Audit-Project,代码行数:29,代码来源:MainActivity.cs


示例11: Awake

    public virtual void Awake()
    {
        base.Awake();

        Assert.raiseExceptions = true;

        // Find all UI elements in the scene
        D_TimeLeftText = GameObject.Find("D_TimeLeftText").GetComponent<Text>();
        D_DefuseBombButton = GameObject.Find("D_DefuseBombButton").GetComponent<Button>();
        D_HintLeftBehind = GameObject.Find("D_HintLeftBehind").GetComponent<Text>();
        D_HintLeftBehind2 = GameObject.Find("D_HintLeftBehind2").GetComponent<Text>();
        D_HintLeftBehind3 = GameObject.Find("D_HintLeftBehind3").GetComponent<Text>();
        D_Waiting = GameObject.Find("D_Waiting").GetComponent<Text>();
        D_Tutorial = GameObject.Find("D_Tutorial").GetComponent<Button>();
        D_TutorialHints = GameObject.Find("D_TutorialHints").GetComponent<Button>();
        D_GiveUp = GameObject.Find ("D_GiveUp").GetComponent<Button>();
		D_Penalty = GameObject.Find ("D_Penalty").GetComponent<Text>();
		D_AllDefusedText = GameObject.Find ("D_AllDefusedText").GetComponent<Text>();

        //find bomb tag
        //bombs = GameObject.FindGameObjectsWithTag("Bomb");

        Assert.IsNotNull(D_TimeLeftText, "D_TimeLeftText not found");
        Assert.IsNotNull(D_DefuseBombButton, "D_DefuseBombButton not found");
        Assert.IsNotNull(D_HintLeftBehind, "D_HintLeftBehind not found");
        Assert.IsNotNull(D_HintLeftBehind2, "D_HintLeftBehind2 not found");
        Assert.IsNotNull(D_HintLeftBehind3, "D_HintLeftBehind3 not found");
        Assert.IsNotNull(D_Waiting, "D_Waiting not found");

		//Set hint penalty fade coroutine
		fadePenaltyCoroutine = FadeAlphaOut();
    }
开发者ID:khoavnguyen,项目名称:Unity-AR-Game-Explode-with-Friends,代码行数:32,代码来源:DefuseState.cs


示例12: Update

	//Update is called once per frame
	void Update () {
	
		if (isDrag || accel != 0) {
			rotateMenu();
			changeText();
			changeAlpha ();
			renderOrder();
		}

		if (currentButton) {
			float angle = Vector3.Angle ((currentButton.transform.position - canvas.transform.position).normalized, new Vector3 (0, 0, -1));                           
			if (angle > 90.003) {
				var q = currentButton.transform.rotation;
				currentButton.transform.RotateAround (rotateAroundPos, RotateAxis, 0.01f);
				float angle2 = Vector3.Angle ((currentButton.transform.position - canvas.transform.position).normalized, new Vector3 (0, 0, -1));
				if (angle2 > angle) {
					accel = -(angle - 89.7f) * 0.2f;
				} else {
					accel = (angle - 89.7f) * 0.2f;
				}
				currentButton.transform.RotateAround (rotateAroundPos, RotateAxis, -0.01f);
				currentButton.transform.rotation = q;
			} else {
				currentButton = null;
			}
		}
	}
开发者ID:sweeseng789,项目名称:Interface,代码行数:28,代码来源:ModeSelectRotate.cs


示例13: LoginCharacter

 public void LoginCharacter(Button button)
 {
     CharacterOptions options = button.transform.parent.GetComponent<CharacterOptions>();
     characterId = options.characterId;
     Debug.Log("Using character " + characterId);
     CharacterApi.instance.SetCharacter(characterId, this);
 }
开发者ID:tiger0-0,项目名称:gamemachine,代码行数:7,代码来源:CharactersUI.cs


示例14: Start

	void Start(){
		qm = qm.GetComponent<Canvas> ();
		toggle = toggle.GetComponent<Button> ();
	
		//playing = true;
		//AudioListener.pause = false;
	}
开发者ID:TheoKnoll,项目名称:20-Project-Unity-Game,代码行数:7,代码来源:DontDestroy.cs


示例15: Changes_Load

 private void Changes_Load(object sender, EventArgs e)
 {
     Color[] colorArray = new Color[] { Color.FromArgb(0x80, 0x80, 0xff), Color.FromArgb(0x80, 0xff, 0x80), Color.FromArgb(0xff, 0xc0, 0x80), Color.FromArgb(0xff, 0x80, 0xff) };
     this.panel1.Controls.Clear();
     int num = 0;
     int num2 = 0;
     Class10.list_0.Add("NovoFatum R3");
     Class10.list_0.Add("NovoFatum R3");
     Class10.list_0.Add("NovoFatum R3");
     Class10.list_0.Add("NovoFatum R3");
     foreach (string str in Class10.list_0)
     {
         Button button = new Button {
             BackColor = colorArray[num++],
             FlatStyle = FlatStyle.Popup,
             ForeColor = SystemColors.ButtonHighlight
         };
         if (num > colorArray.Length)
         {
             num = 0;
         }
         button.Location = new Point(0, 0x3b * num2);
         button.Name = "button_" + num2;
         button.Size = new Size(630, 0x3e);
         button.Text = str;
         button.UseVisualStyleBackColor = false;
         this.panel1.Controls.Add(button);
         num2++;
     }
     this.button2.Text = "Updates [" + num2 + "]";
 }
开发者ID:ZelkovaHabbo,项目名称:NF3_Compilable,代码行数:31,代码来源:Changes.cs


示例16: OnCreateView

        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate (Resource.Layout.FeedbackFragment, container, false);
            feedbackPositiveButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackPositiveButton);
            feedbackNeutralButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNeutralButton);
            feedbackNegativeButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNegativeButton);

            feedbackPositiveButton.Click += (sender, e) => SetRating (ratingPositive);
            feedbackNeutralButton.Click += (sender, e) => SetRating (ratingNeutral);
            feedbackNegativeButton.Click += (sender, e) => SetRating (ratingNegative);

            feedbackMessageEditText = view.FindViewById<EditText> (Resource.Id.FeedbackMessageText).SetFont (Font.Roboto);
            feedbackMessageEditText.AfterTextChanged += OnEdit;

            submitFeedbackButton = view.FindViewById<Button> (Resource.Id.SendFeedbackButton).SetFont (Font.Roboto);
            submitFeedbackButton.Click += OnSendClick;

            feedbackContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackContainer);
            disclaimerContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackDisclaimer);
            noUserRegisterButton = view.FindViewById<Button> (Resource.Id.FeedbackRegisterButton);

            bool offline = ServiceContainer.Resolve<AuthManager> ().OfflineMode;
            disclaimerContainer.Visibility = offline ? ViewStates.Visible : ViewStates.Gone;
            feedbackContainer.Visibility = offline ? ViewStates.Gone : ViewStates.Visible;

            noUserRegisterButton.Click += OpenRegisterScreen;

            SetRating (userRating);

            return view;
        }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:31,代码来源:FeedbackFragment.cs


示例17: Start

    void Start()
    {
        _button = GetComponent<Button>();
        _button.interactable = false;

        _rewardCooldownTime = GetRewardCooldownTime();
    }
开发者ID:cortexarts,项目名称:Feiko-Unity-OLD,代码行数:7,代码来源:GetCoinsButton.cs


示例18: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RelativeLayout view = (RelativeLayout)inflater.Inflate (Resource.Layout.raffledetail_gettemppass, container, false);
            rootview = view;

            TextView hinttextview=(TextView)view.FindViewById (Resource.Id.gettemppass_hinttext_textview);
            hinttextview.Text = RequestTPScreenData.ProvideClientInfoTextViewText;

            emailorphone = (EditText)view.FindViewById (Resource.Id.gettemppass_emailorphone_edittext);
            emailorphone.Hint = RequestTPScreenData.ClientInfoTextFieldPlaceholder;

            requesttemppass = (Button)view.FindViewById (Resource.Id.gettemppass_requesttemppass_button);
            requesttemppass.Text = RequestTPScreenData.RequestTPBtnTitle;
            //send web request
            requesttemppass.Click+=OnRequestTempPassClick;

            TextView signuptextview=view.FindViewById<TextView> (Resource.Id.gettemppass_register_textview);
            nn_activity.SetClickAbleText (signuptextview,RequestTPScreenData.DontHaveAccountLabelText+RequestTPScreenData.SignUpBtnTitle,RequestTPScreenData.SignUpBtnTitle,()=>{

                if(FormatManager.chechinput(emailorphone.Text,FormatManager.FormatOption.Email)){
                    (nn_activity as HomeScreen).ShowBuyerSignUp(emailorphone.Text);
                }
                else{
                    (nn_activity as HomeScreen).ShowBuyerSignUp("");
                }

            });

            return view;
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:30,代码来源:RaffleGetTempPassFragment.cs


示例19: Issue1875

		public Issue1875()
		{
			Button loadData = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand };
			ListView mainList = new ListView {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			mainList.SetBinding (ListView.ItemsSourceProperty, "Items");

			_viewModel = new MainViewModel ();
			BindingContext = _viewModel;
			loadData.Clicked += async (sender, e) => {
				await LoadData ();
			};

			mainList.ItemAppearing += OnItemAppearing;

			Content = new StackLayout {
				Children = {
					loadData,
					mainList
				}
			};
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:25,代码来源:Issue1875.cs


示例20: InitView

		private void InitView()
		{
			//设置标题栏
			var btn_headerBack = FindViewById<Button> (Resource.Id.btn_header_back);

			btn_headerBack.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			FindViewById<TextView> (Resource.Id.tv_header_title).Text = "生日";
			edit_birth = FindViewById<EditText>(Resource.Id.edit_birth);
			edit_birth.Click += (sender, e) => 
			{
				var datepickdialog = new DatePickDialogUtil(this,edit_birth.Text);
				datepickdialog.DatePickDialogShow(edit_birth);

			};
			edit_birth.Text = !string.IsNullOrEmpty (Global.MyInfo.Age) ?Convert.ToDateTime(Global.MyInfo.Age).ToString("yyyy-MM-dd") :"";
			btn_Save = FindViewById<Button> (Resource.Id.btn_Save);
			btn_Save.Click += (sender, e) => 
			{
				Save();
			};
		}
开发者ID:lq-ever,项目名称:EldYoungAndroidApp,代码行数:25,代码来源:PersonInfoBirthActivity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ButtonPressEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# BusinessObjects类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap