當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。