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


C# Switch.SetChecked方法代码示例

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


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

示例1: OnCreate

    protected override void OnCreate(Bundle savedInstance)
    {
      base.OnCreate(savedInstance);
      SetContentView(R.Layouts.SettingActivityLayout);

      ActionBar actionBar = GetActionBar();
      // To enable the icon for up navigation (which displays the "up" indicator next to the icon)
      actionBar.SetDisplayHomeAsUpEnabled(true);


      gamePreferences = new Preferences();
      gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", MODE_MULTI_PROCESS));

      txtV = FindViewById<TextView>(R.Ids.tableChoosen);
      txtV1 = FindViewById<TextView>(R.Ids.tableChoosenTxt);

      seekbar = FindViewById<SeekBar>(R.Ids.seekbar);
      seekbar.ProgressChanged += new EventHandler<ProgressChangedEventArgs>(seekbar_ProgressChanged);
      seekbar.SetProgress(gamePreferences.TableOf);

      var btn = FindViewById<Button>(R.Ids.Ok);
      btn.Click += new EventHandler(btn_ClickOk);
      btn = FindViewById<Button>(R.Ids.Cancel);
      btn.Click += new EventHandler(btn_ClickCancel);

      swV = FindViewById<Switch>(R.Ids.isRandom);
      swV.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(swV_CheckedChanged);
      swV.SetChecked(!gamePreferences.RandomQuestions);

      rbtnTo10 = FindViewById<RadioButton>(R.Ids.To10);
      if (gamePreferences.UpperLimit == 10)
      {
        rbtnTo10.SetChecked(true);
      }
      rbtnTo50 = FindViewById<RadioButton>(R.Ids.To50);
      if (gamePreferences.UpperLimit == 50)
      {
        rbtnTo50.SetChecked(true);
      }
      rbtnTo100 = FindViewById<RadioButton>(R.Ids.To100);
      if (gamePreferences.UpperLimit == 100)
      {
        rbtnTo100.SetChecked(true);
      }
      rbtnTo500 = FindViewById<RadioButton>(R.Ids.To500);
      if (gamePreferences.UpperLimit == 500)
      {
        rbtnTo500.SetChecked(true);
      }
      rbtnTo1000 = FindViewById<RadioButton>(R.Ids.To1000);
      if (gamePreferences.UpperLimit == 1000)
      {
        rbtnTo1000.SetChecked(true);
      }
      rbtnTo10.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo50.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo100.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo500.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);
      rbtnTo1000.CheckedChanged += new EventHandler<CheckedChangedEventArgs>(rbtnTo_CheckedChanged);

      rbtn0To10 = FindViewById<RadioButton>(R.Ids.With0To10);
      if (gamePreferences.CounterMin == 0)
      {
        rbtn0To10.SetChecked(true);
      }
      rbtn10To20 = FindViewById<RadioButton>(R.Ids.With10To20);
      if (gamePreferences.CounterMin == 10)
      {
        rbtn10To20.SetChecked(true);
      }
      rbtn20To50 = FindViewById<RadioButton>(R.Ids.With20To50);
      if (gamePreferences.CounterMin == 20)
      {
        rbtn20To50.SetChecked(true);
      }
      rbtn50To100 = FindViewById<RadioButton>(R.Ids.With50To100);
      if (gamePreferences.CounterMin == 50)
      {
        rbtn50To100.SetChecked(true);
      }

      EnabledButtons();
    }
开发者ID:rfcclub,项目名称:dot42,代码行数:83,代码来源:SettingsActivity.cs


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