本文整理汇总了C#中Spinner.SetSelection方法的典型用法代码示例。如果您正苦于以下问题:C# Spinner.SetSelection方法的具体用法?C# Spinner.SetSelection怎么用?C# Spinner.SetSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spinner
的用法示例。
在下文中一共展示了Spinner.SetSelection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected async override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.view_expense);
dialog = ServiceContainer.Resolve<IMessageDialog>();
var id = Intent.GetIntExtra("ID", -1);
viewModel = ServiceContainer.Resolve<ExpenseViewModel>();
await viewModel.Init(id);
this.ActionBar.Title = viewModel.Title;
viewModel.IsBusyChanged = (busy) =>
{
if (busy)
AndHUD.Shared.Show(this, "Loading...");
else
AndHUD.Shared.Dismiss(this);
};
name = FindViewById<EditText>(Resource.Id.name);
date = FindViewById<DatePicker>(Resource.Id.date);
notes = FindViewById<EditText>(Resource.Id.notes);
total = FindViewById<EditText>(Resource.Id.total);
billable = FindViewById<CheckBox>(Resource.Id.billable);
category = FindViewById<Spinner>(Resource.Id.category);
category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories);
category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category));
name.Text = viewModel.Name;
date.DateTime = viewModel.Due;
notes.Text = viewModel.Notes;
total.Text = viewModel.Total;
billable.Checked = viewModel.Billable;
}
示例2: Screen7Summary
public Screen7Summary(Activity context, PointDto point)
: base(context, Resource.Layout.Edit7Summary, point)
{
PointPart7Summary item = Point.PointDataDto.PointPart7Summary;
invalidMoveAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_move_availability);
invalidHearingAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_hearing_availability);
invalidEyeAvailable = View.FindViewById<Spinner>(Resource.Id.invalid_eye_availability);
otherText = View.FindViewById<EditText>(Resource.Id.otherComments);
reportDate = View.FindViewById<EditText>(Resource.Id.protocolDate);
invalidMoveAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
"ќбъект не доступен (если нет пандуса, не соответствует ширина проемов, высота порогов)");
invalidHearingAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
"ќбъект не доступен (если отсутствуют световые табло, индукционна¤ петл¤)");
invalidEyeAvailable.Adapter = new BoolSpinnerAdapter(context, "ќбъект доступен",
"ќбъект не доступен (если отсутствуют тактильные маршруты, звуковое оповещение, контрастна¤ маркировка дверей и стекл¤нных поверхностей)");
reportDate.Text = item.ReportDate.ToLocalTime().Date.ToString(CultureInfo.CurrentCulture);
invalidMoveAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidMoveAvailability));
invalidHearingAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidHearingAvailability));
invalidEyeAvailable.SetSelection(BoolSpinnerAdapter.SetPositionOf(item.InvalidEyeAvailability));
otherText.Text = item.OtherComments;
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.ShareLocation);
customDate = DateTime.Now;
boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress);
boxProgress.Visibility = ViewStates.Gone;
textDate = FindViewById<TextView> (Resource.Id.textDate);
textDate.Visibility = ViewStates.Gone;
spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime);
spinnerTime.ItemSelected += HandleItemSelected;
arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem);
arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
spinnerTime.Adapter = arrayAdapter;
spinnerTime.SetSelection (defaultTimeIndex);
selectedTime = timeValues [defaultTimeIndex];
shareButton = FindViewById<Button> (Resource.Id.buttonShare);
shareButton.Click += HandleShareClick;
textDate.Click += delegate {
ShowDialog (0);
};
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.SettingsScreen);
themeSpinner = FindViewById<Spinner> (Resource.Id.ThemeSpinner);
fontSizeSpinner = FindViewById<Spinner> (Resource.Id.FontSizeSpinner);
selectedTheme = Convert.ToInt32 (prefs.GetString (ThemeKey, "0"));
selectedFontSize = Convert.ToInt32 (prefs.GetString (FontSizeKey, "0"));
themeSpinner.ItemSelected += ThemeSpinner_ItemSelected;
var adapter = ArrayAdapter.CreateFromResource (
this, Resource.Array.themes, Android.Resource.Layout.SimpleSpinnerItem);
adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
themeSpinner.Adapter = adapter;
fontSizeSpinner.ItemSelected += FontSizeSpinner_ItemSelected;
adapter = ArrayAdapter.CreateFromResource (
this, Resource.Array.font_sizes, Android.Resource.Layout.SimpleSpinnerItem);
adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
fontSizeSpinner.Adapter = adapter;
themeSpinner.SetSelection (selectedTheme);
fontSizeSpinner.SetSelection (selectedFontSize);
}
示例5: OnCreate
static System.Threading.Thread LoadThread; //Поток, отвечающий за загрузку расписания
protected override void OnCreate (Bundle bundle)
{
context = this;
groups = Resources.GetTextArray (Resource.Array.group_codes);
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
//RequestWindowFeature (WindowFeatures.NoTitle);
text = FindViewById<TextView> (Resource.Id.text);
Button today = FindViewById<Button> (Resource.Id.today);
Button tomorrow = FindViewById<Button> (Resource.Id.tomorrow);
Button OnDate = FindViewById<Button> (Resource.Id.toDate);
spinner = FindViewById<Spinner> (Resource.Id.spinner1);
viewSwitcher = FindViewById<ViewSwitcher> (Resource.Id.viewSwitcher1);
DateTime dateToday = DateTime.Today;
DateTime dateTomorrow = DateTime.Today.AddDays (1);
DatePicker datePicker = FindViewById<DatePicker> (Resource.Id.datePicker);
ConnectivityManager cm = (ConnectivityManager)GetSystemService (Context.ConnectivityService);
spinner.SetSelection (loadingGroup ());
//Обработчики нажатий кнопок
today.Click += delegate { //На сегодня
savingGroup (spinner.SelectedItemPosition);
if (cm.ActiveNetworkInfo != null) { //Если присутствует соединение с интернетом - запустить функцию,
StartLoadingThread (dateToday);// получающую расписание с сайта
} else {
text.Text = "Проверьте соединение с интернетом";//Иначе, выводит ошибку
viewSwitcher.ShowNext ();
}
};
tomorrow.Click += delegate { //На завтра
savingGroup (spinner.SelectedItemPosition);
if (cm.ActiveNetworkInfo != null) {
StartLoadingThread (dateTomorrow);
} else {
text.Text = "Проверьте соединение с интернетом";
viewSwitcher.ShowNext ();
}
};
OnDate.Click += delegate {//На дату
savingGroup (spinner.SelectedItemPosition);
if (cm.ActiveNetworkInfo != null) {
StartLoadingThread (datePicker.DateTime);
} else {
text.Text = "Проверьте соединение с интернетом";
viewSwitcher.ShowNext ();
}
};
}
示例6: GetPropertyWindowLayout
public override View GetPropertyWindowLayout (Android.Content.Context context)
{
LinearLayout linear = new LinearLayout (context);
linear.Orientation = Orientation.Horizontal;
TextView txt = new TextView (context);
txt.Text = "Select Theme";
txt.SetPadding (10, 10, 10, 10);
txt.TextSize = 15f;
Spinner themeDropDown = new Spinner (context);
List<String> adapter = new List<String> (){"Default","Dark","Blue","Red","Green" };
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
(context, Android.Resource.Layout.SimpleSpinnerItem,adapter);
themeDropDown.Adapter = dataAdapter;
themeDropDown.SetPadding (10, 10, 10, 10);
themeDropDown.SetSelection(1);
themeDropDown.ItemSelected += OnGridThemeChanged;
themeDropDown.SetMinimumHeight (70);
linear.AddView (txt);
linear.AddView (themeDropDown);
return linear;
}
示例7: GetPropertyWindowLayout
public override Android.Views.View GetPropertyWindowLayout (Android.Content.Context context)
{
View view = new View (context);
Spinner spin = new Spinner (context);
List<String> adapter = new List<String> (){"Single","Single/Deselect","Multiple","None" };
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>
(context, Android.Resource.Layout.SimpleSpinnerItem,adapter);
spin.Adapter = dataAdapter;
TextView txt = new TextView (context);
txt.Text = "Set Selection Mode";
txt.TextSize = 15f;
txt.SetPadding (10, 10, 10, 10);
spin.SetPadding (10, 10, 10, 10);
LinearLayout linear = new LinearLayout (context);
linear.Orientation = Orientation.Horizontal;
linear.AddView (txt);
linear.AddView (spin);
spin.SetSelection(2);
spin.ItemSelected += OnSelectionModeChanged;
return linear;
}
示例8: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Create your application here
// Set the layout
SetContentView(Resource.Layout.ActivitySettings);
_OfflineSwitch = FindViewById<Switch> (Resource.Id.switch1);
_btnUploadData = FindViewById<Button>(Resource.Id.BtnUploadData);
_btnClear = FindViewById<Button>(Resource.Id.BtnClear);
_btnUrlSave = FindViewById<Button>(Resource.Id.BtnUrlSave);
_btnChangePassword = FindViewById<Button>(Resource.Id.BtnChangePassword);
_btnLog = FindViewById<Button>(Resource.Id.BtnLog);
_edUrl = FindViewById<EditText>(Resource.Id.edUrl);
_tvAndroidID = FindViewById<TextView>(Resource.Id.tvAndroidID);
// Spinner for the main color of the app
// Set the main colors
_colors = new List<int>();
_colors.Add(Android.Resource.Color.HoloOrangeDark);
_colors.Add(Android.Resource.Color.HoloBlueDark);
_colors.Add(Android.Resource.Color.DarkerGray);
_colors.Add(Android.Resource.Color.HoloGreenDark);
_colors.Add(Android.Resource.Color.HoloRedDark);
// Initialze the color spinner
_spinnerMainColor = FindViewById<Spinner>(Resource.Id.spinnerMainColor);
MainColorViewAdapter _adapter = new MainColorViewAdapter (this,_colors);
_spinnerMainColor.SetBackgroundColor( Resources.GetColor(DataAccessLayer.Utilities.MainColor));
_spinnerMainColor.SetBackgroundResource(DataAccessLayer.Utilities.MainColor);
_spinnerMainColor.Adapter = _adapter;
// Initialize the LoginSaveOption Spinner
_spinnerLoginSaveOption = FindViewById<Spinner>(Resource.Id.spinnerLoginSaveOption);
LoginSaveOptionViewAdapter _LSO_adapter = new LoginSaveOptionViewAdapter(this);
_spinnerLoginSaveOption.Adapter = _LSO_adapter;
// Set the right selected item for the spinnerMainColor
switch (DataAccessLayer.Utilities.MainColor)
{
case Android.Resource.Color.HoloOrangeDark:
_spinnerMainColor.SetSelection(0);
break;
case Android.Resource.Color.HoloBlueDark:
_spinnerMainColor.SetSelection(1);
break;
case Android.Resource.Color.DarkerGray:
_spinnerMainColor.SetSelection(2);
break;
case Android.Resource.Color.HoloGreenDark:
_spinnerMainColor.SetSelection(3);
break;
case Android.Resource.Color.HoloRedDark:
_spinnerMainColor.SetSelection(4);
break;
default:
_spinnerMainColor.SetSelection(0);
break;
}
// Set the right selected item for the spinnerLoginSaveOption
_spinnerLoginSaveOption.SetSelection(Convert.ToInt32( BusinessLayer.User.GetLoginSaveOption()));
// Set the status of the button
if (UI.MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
_OfflineSwitch.Checked = false;
else
_OfflineSwitch.Checked = true;
// Enable or disable the Button to sync offline data
offlineTasks = BusinessLayer.Task.HasNewOfflineTasks();
if (offlineTasks != 0 &&MainActivity.User.NetworkStatus != DataAccessLayer.NetworkState.Disconnected)
_btnUploadData.Enabled = true;
else
_btnUploadData.Enabled = false;
// If the app is offline, the switch control must be disabled
if (UI.MainActivity._networkstate == DataAccessLayer.NetworkState.Disconnected)
_OfflineSwitch.Enabled = false;
else
_OfflineSwitch.Enabled = true;
// Set the current URL
_edUrl.Text = DataAccessLayer.Utilities.ServerIP;
// set the android ID
_tvAndroidID.Text = Android.Provider.Settings.Secure.GetString(this.ContentResolver,
Android.Provider.Settings.Secure.AndroidId);
// Set the event handler of the controls
SetControlEvents(true);
}
示例9: OnCreate
//.........这里部分代码省略.........
imgBtnPlus.Click += (object sender, EventArgs e) => {
if (SetTag == 1) {
imgBtnPlus.SetImageResource (Resource.Drawable.Multsign);
txtidofNewPanel.Visibility = ViewStates.Visible;
tRowSaveCancel.Visibility = ViewStates.Visible;
spinMasterPanel.Visibility = ViewStates.Visible;
SetTag = 0;
} else if (SetTag == 0) {
imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
txtidofNewPanel.Visibility = ViewStates.Gone;
tRowSaveCancel.Visibility = ViewStates.Gone;
spinMasterPanel.Visibility = ViewStates.Gone;
SetTag = 1;
}
};
btnCancel.Click += delegate {
imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
tRowSaveCancel.Visibility = ViewStates.Gone;
txtidofNewPanel.Visibility = ViewStates.Gone;
spinMasterPanel.Visibility = ViewStates.Gone;
};
#region SavePanelCLickActivity
btnSavePanel.Click += (object sender, EventArgs e) => {
imgBtnPlus.SetImageResource (Resource.Drawable.plussign);
tRowSaveCancel.Visibility = ViewStates.Gone;
txtidofNewPanel.Visibility = ViewStates.Gone;
spinMasterPanel.Visibility = ViewStates.Gone;
string newPanelText = txtidofNewPanel.Text.Trim ();
if (newPanelText != "") {
string spinnerItem = spinMasterPanel.SelectedItem.ToString (); // Selected item in the spinner
if (spinnerItem != "Select Parent Panel") {
child = new List<string> ();
child.Add (newPanelText);
if (NewParentItems.ContainsKey (spinnerItem)) {
NewParentItems [spinnerItem].AddRange (child);
dictPanelItemsForMail [spinnerItem].AddRange (child);
} else {
NewParentItems [spinnerItem] = child;
dictPanelItemsForMail [spinnerItem] = child;
}
} else {
child = new List<string> ();
NewParentItems [newPanelText] = child;
dictPanelItemsForMail [newPanelText] = child;
appendSpinner (spinMasterPanel, newListForSpin, spinnerArrayAdapter, First);
}
child = new List<string> ();
childItems.Add (child);
myListViewAdap adapterNew = new myListViewAdap (NewParentItems);
adapterNew.setInflater ((LayoutInflater)GetSystemService (Context.LayoutInflaterService), this);
mListExView.SetAdapter (adapter); //Inflate Expandable Adapter
txtidofNewPanel.Text = "";
InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
inputmanager.HideSoftInputFromWindow (txtidofNewPanel.WindowToken, HideSoftInputFlags.None); // To hide the keyboard
spinMasterPanel.SetSelection (0, true);
}
};
#endregion SavePanelActivityEnd
// Code to hide keyboard on spinner touch
spinMasterPanel.Touch += (object sender, View.TouchEventArgs e) => {
InputMethodManager inputmanager = (InputMethodManager)GetSystemService (Context.InputMethodService);
inputmanager.HideSoftInputFromWindow (spinMasterPanel.WindowToken, HideSoftInputFlags.None);
spinMasterPanel.PerformClick ();
};
// code to handle ChildClick Event
mListExView.ChildClick += mListExView_ChildClick;
connectMaster (1);
}
示例10: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview=(RelativeLayout)inflater.Inflate (Resource.Layout.accountedit, container, false);
firstnameedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_firstname_edittext);
nn_activity.SetEditTextMaximumLength (firstnameedittext,100);
firstnameedittext.Text = nn_accountinfo.first_name;
lasetnameedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_lastname_edittext);
nn_activity.SetEditTextMaximumLength (lasetnameedittext,100);
lasetnameedittext.Text= nn_accountinfo.last_name;
birthdatebutton = (Button)rootview.FindViewById (Resource.Id.accountedit_birthday_button);
birthdatebutton.Hint="Birthdate";
birthdatebutton.Click += (object sender, EventArgs e) => {
showDatePickerDialog ();
};
birthdatebutton.Text = nn_accountinfo.user_birthdate.Split ('T') [0].Replace("-","/");
mobilephoneedittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_mobilephone_edittext);
nn_activity.SetEditTextMaximumLength (mobilephoneedittext,20);
mobilephoneedittext.Text = nn_accountinfo.phone_mobile;
emailedittext = (EditText)rootview.FindViewById (Resource.Id.accountedit_email_edittext);
nn_activity.SetEditTextMaximumLength (emailedittext,60);
emailedittext.Focusable = false;
emailedittext.InputType = global::Android.Text.InputTypes.Null;
emailedittext.Text = nn_accountinfo.email;
address1edittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_address1_edittext);
nn_activity.SetEditTextMaximumLength (address1edittext,100);
address1edittext.Text = nn_accountinfo.mail_address_line_1;
address2edittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_address2_edittext);
nn_activity.SetEditTextMaximumLength (address2edittext,100);
address2edittext.Text = nn_accountinfo.mail_address_line_2;
countryspinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_country_spinner);
countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
if(stateandprovincespinneradapter!=null){
stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
stateandprovincespinneradapter.NotifyDataSetChanged ();
}
countryspinner.Tag=e.Position;
};
provincespinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_province_spinner);
provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
provincespinner.Tag=e.Position;
};
cityedittext = (EditText)rootview.FindViewById (Resource.Id.accountedit_city_edittext);
nn_activity.SetEditTextMaximumLength (cityedittext,50);
cityedittext.Text = nn_accountinfo.mail_city;
postaledittext=(EditText)rootview.FindViewById (Resource.Id.accountedit_postal_edittext);
nn_activity.SetEditTextMaximumLength (postaledittext,20);
postaledittext.Text = nn_accountinfo.mail_postal;
raffleresultspinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_raffleresult_spinner);
resultadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
raffleresultspinner.Adapter = resultadapter;
resultadapter.NotifyDataSetChanged ();
raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
raffleresultspinner.Tag=e.Position;
};
if (!nn_accountinfo.prefered_contact_method.Equals(null)) {
int spinnerPosition = 0;
for(int i=0;i< GlobalVariable.ResultAndMessageList.Count;i++){
if(GlobalVariable.ResultAndMessageList[i].Equals(nn_accountinfo.prefered_contact_method)){
spinnerPosition = i;
}
}
raffleresultspinner.SetSelection(spinnerPosition);
}
charitymessagespinner=(Spinner)rootview.FindViewById (Resource.Id.accountedit_marketingmessage_spinner);
messaegadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
charitymessagespinner.Adapter = messaegadapter;
messaegadapter.NotifyDataSetChanged ();
charitymessagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
charitymessagespinner.Tag=e.Position;
};
if (!nn_accountinfo.prefered_contact_methodcharity.Equals(null)) {
int spinnerPosition = 0;
for(int i=0;i< GlobalVariable.ResultAndMessageList.Count;i++){
if(GlobalVariable.ResultAndMessageList[i].Equals(nn_accountinfo.prefered_contact_methodcharity)){
spinnerPosition = i;
}
}
charitymessagespinner.SetSelection(spinnerPosition);
}
TextView firstnamelabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_firstname_label);
firstnamelabel.Text = EditAccountScreenData.AccountFirstNameLabel;
TextView AccountLastNameLabel=rootview.FindViewById<TextView> (Resource.Id.accountedit_lastname_label);
AccountLastNameLabel.Text = EditAccountScreenData.AccountLastNameLabel;
//.........这里部分代码省略.........
示例11: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
//Find controls
SetContentView(Resource.Layout.NoteEditScreen);
nameTextEdit = FindViewById<EditText>(Resource.Id.NameText);
descriptionTextEdit = FindViewById<EditText>(Resource.Id.NotesText);
imagePreview = FindViewById<ImageView>(Resource.Id.NoteImage);
saveButton = FindViewById<Button>(Resource.Id.SaveButton);
pickImageButton = FindViewById<Button>(Resource.Id.PickImageButton);
prioritySpinner = FindViewById<Spinner> (Resource.Id.PrioritySpinner);
cancelDeleteButton = FindViewById<Button>(Resource.Id.CancelDeleteButton);
dateDisplay = FindViewById<TextView> (Resource.Id.DateDisplay);
timeDisplay = FindViewById<TextView> (Resource.Id.TimeDisplay);
pickDate = FindViewById<Button> (Resource.Id.PickDate);
pickTime = FindViewById<Button> (Resource.Id.PickTime);
cancelDeleteButton.Text = Resources.GetText (Resource.String.Cancel);
selectedDateTime = DateTime.Now;
UpdateDisplay ();
// Get note if exist
int noteID = Intent.GetIntExtra("NoteID", 0);
if(noteID > 0) {
note = NoteItemManager.GetNote(noteID);
nameTextEdit.Text = note.Name;
descriptionTextEdit.Text = note.Description;
prioritySpinner.SetSelection(note.Priority);
cancelDeleteButton.Text = Resources.GetText (Resource.String.Delete);
selectedDateTime = note.ToDoDate;
selectedImageUri = note.ImageUri;
selectedPriority = note.Priority;
UpdateDisplay ();
}
//Image button
pickImageButton.Click += (sender, eventArgs) =>
{
Intent = new Intent();
Intent.SetType("image/*");
Intent.SetAction(Intent.ActionGetContent);
StartActivityForResult(Intent.CreateChooser(Intent, Resources.GetText (Resource.String.SelectPicture)), PickImageId);
};
//DateTime
pickDate.Click += delegate { ShowDialog (PickDateId); };
pickTime.Click += delegate { ShowDialog (PickTimeId); };
//Priority spinner
prioritySpinner.ItemSelected += PrioritySpinner_ItemSelected;
var adapter = ArrayAdapter.CreateFromResource (
this, Resource.Array.priorities, Android.Resource.Layout.SimpleSpinnerItem);
adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
prioritySpinner.Adapter = adapter;
//Buttons clicks
cancelDeleteButton.Click += (sender, e) => CancelDelete ();
saveButton.Click += (sender, e) => Save ();
}
示例12: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
var view = inflater.Inflate (Resource.Layout.NavigationLayout, null, true);
navigationListView = view.FindViewById<ListView> (Resource.Id.navigationListView);
navigationStatus = view.FindViewById<Spinner> (Resource.Id.fragmentStatus);
navigationStatusImage = view.FindViewById<ImageView> (Resource.Id.fragmentStatusImage);
timerLayout = view.FindViewById<RelativeLayout> (Resource.Id.fragmentTimerTextLayout);
navigationStatusLayout = view.FindViewById<LinearLayout> (Resource.Id.navigationStatusLayout);
timer = view.FindViewById<ToggleButton> (Resource.Id.fragmentTimer);
timerHours = view.FindViewById<TextView> (Resource.Id.fragmentHours);
navigationStatusImage.SetImageResource (Resource.Drawable.HoldImage);
var spinnerAdapter = new SpinnerAdapter<AssignmentStatus> (assignmentViewModel.AvailableStatuses, Activity, Resource.Layout.SimpleSpinnerItem);
spinnerAdapter.TextColor = Color.White;
navigationStatus.Adapter = spinnerAdapter;
if (Assignment != null && !Assignment.IsHistory) {
navigationStatus.ItemSelected += (sender, e) => {
var status = assignmentViewModel.AvailableStatuses [e.Position];
if (Assignment != null && Assignment.Status != status && Assignment.Status != AssignmentStatus.New) {
switch (status) {
case AssignmentStatus.Complete:
//go to confirmations screen
var currentPosition = navigationListView.SelectedItemPosition;
var confirmationPosition = Constants.Navigation.IndexOf ("Confirmations");
if (currentPosition != confirmationPosition) {
navigationSelector.OnItemClick (navigationListView, navigationListView.GetChildAt (confirmationPosition), confirmationPosition, 0);
}
navigationStatus.SetSelection (assignmentViewModel.AvailableStatuses.ToList ().IndexOf (Assignment.Status));
break;
default:
Assignment.Status = status;
SaveAssignment ();
break;
}
}
};
}
timerLayout.Visibility = ViewStates.Gone;
var adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.Navigation);
if (Assignment != null && Assignment.IsHistory) {
adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.HistoryNavigation);
}
navigationListView.OnItemClickListener = navigationSelector;
navigationListView.Adapter = adapter;
timer.CheckedChange += (sender, e) => {
if (e.IsChecked != assignmentViewModel.Recording) {
if (assignmentViewModel.Recording) {
assignmentViewModel.PauseAsync ();
} else {
assignmentViewModel.RecordAsync ();
}
}
};
SetActiveAssignment ();
return view;
}
示例13: BtnSaveClickAsync
async public Task<bool> BtnSaveClickAsync ()
{
// Test if the controls are filled
if (GetControlReferences () == false)
return false ;
if (Validate () == false)
return false;
int selectedIndex;
_ansprechpartner.Vorname = _edVorname.Text;
_ansprechpartner.IDParent = _stateClass._person.ID;
_ansprechpartner.Name = _edName.Text;
_ansprechpartner.Nummer = _edNummer.Text;
_ansprechpartner.Strasse = _edStrasse.Text;
_ansprechpartner.PLZ = _edPLZ.Text;
_ansprechpartner.Ort = _edOrt.Text;
_ansprechpartner.LandNummer = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].Nummer;
if (Utilities.GetCurrentLanguage(_mainActivity) == "DE")
_ansprechpartner.Land = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].NameGerman;
else
_ansprechpartner.Land = BusinessLayer.UtilityClasses.countries[_spinnerLand.SelectedItemPosition].NameEnglish;
_ansprechpartner.Telefon = _edTelefon.Text;
_ansprechpartner.Email = _edEmail.Text;
if (_ansprechpartner.ID == null)
{
// INSERT statement
var result = await _ansprechpartner.SaveAsync(MainActivity.User);
if ( result == DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected)
return false;
_ansprechpartnern.Add (_ansprechpartner);
_edNummer.Text = _ansprechpartner.Nummer;
selectedIndex = _ansprechpartnern.Count - 1;
_tvEmail.Text = _ansprechpartner.Email;
_tvPhone.Text = _ansprechpartner.Telefon;
}
else
{
// UPDATE statement
var result = await _ansprechpartner.SaveAsync(MainActivity.User);
if ( result == DataAccessLayer.SOAResult.FALSE || result == DataAccessLayer.SOAResult.Disconnected)
return false;
selectedIndex = _selectedIndex;
_tvEmail.Text = _ansprechpartner.Email;
_tvPhone.Text = _ansprechpartner.Telefon;
}
// Disable the controls
DisableControls ();
// Set the status of the buttons
_mainActivity._btnSave.Enabled = false;
// Redraw the spinner
_spinnerAnsprechpartner = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
_spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerItemSelected);
AnsprechpartnerViewAdapter _adapter = new AnsprechpartnerViewAdapter (_mainActivity, _ansprechpartnern);
_spinnerAnsprechpartner.Adapter = _adapter;
_spinnerAnsprechpartner.SetSelection(selectedIndex);
// Configure the buttons
if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
ConfigureButtons(false, false, false, false, false);
else
ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);
return true;
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
var label = FindViewById<TextView>(Resource.Id.tv1);
button.Click += delegate {
count++;
label.Text = $"你點擊了 {count} 次";
//button.Text = string.Format("{0} clicks!", count++);
};
ad = FindViewById<ImageView>(Resource.Id.AD);
ad.SetImageResource(Resource.Drawable.pikachu);
// Get local Bluetooth adapter
mBluetoothAdapter = BluetoothAdapter.DefaultAdapter;
// If the adapter is null, then Bluetooth is not supported
if (mBluetoothAdapter == null)
{
Toast.MakeText(this, "Bluetooth is not available", ToastLength.Long).Show();
Finish();
return;
}
//---------------------SPINNER-------------------------------
spinner_mode = FindViewById<Spinner>(Resource.Id.spinner1);
AppPreferences ap = new AppPreferences(mContext);
int spinnerPos = ap.getAccessKey();
spinner_mode.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
var adapter = ArrayAdapter.CreateFromResource(
this, Resource.Array.Connect_Mode_Array, Android.Resource.Layout.SimpleSpinnerItem);
adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
spinner_mode.Adapter = adapter;
if (spinner_mode != null)
{
spinner_mode.SetSelection(ap.getAccessKey());
}
}
示例15: OnStart
public override void OnStart ()
{
base.OnStart ();
_edName = _activity.FindViewById<EditText>(Resource.Id.edGeneralName);
_edNummer = _activity.FindViewById<EditText> (Resource.Id.edNummer);
_edStrasse = _activity.FindViewById<EditText> (Resource.Id.edStrasse);
_edPLZ = _activity.FindViewById<EditText> (Resource.Id.edPLZ);
_edOrt = _activity.FindViewById<EditText> (Resource.Id.edOrt);
_edTelefon = _activity.FindViewById<EditText> (Resource.Id.edTelefon);
_edEmail = _activity.FindViewById<EditText> (Resource.Id.edEmail);
_tvEmail = _activity.FindViewById<TextView> (Resource.Id.tvEmail);
_tvTelefon = _activity.FindViewById<TextView>(Resource.Id.tvTelefon);
_edSperrdatum = _activity.FindViewById<EditText>(Resource.Id.edSperrdatum);
_edSperrgrund = _activity.FindViewById<EditText>(Resource.Id.edSperrgrund);
_btnClear = _activity.FindViewById<ImageButton>(Resource.Id.btnClearSperrDatum);
_spinnerLand = _activity.FindViewById<Spinner> (Resource.Id.spinnerLand);
CountryViewAdapter _adapterCountry = new CountryViewAdapter (_activity);
// New Handler, not to forget to unsubscribe in the OnPause Event
// important, because when another activity (like Setting) overpaints the MainActivity and hides again OnStart will be called again and then this events is called twice!!
_spinnerLand.Touch += SpinnerLand_Touch;
_spinnerLand.Adapter = _adapterCountry;
_btnClear.Click += (object sender, EventArgs e) => {
_edSperrdatum.Text = "";
};
// Check for object instance
if (_stateFragment == null || _stateFragment._stateClass == null)
return;
if (_stateFragment._stateClass._person != null)
{
_edName.Text = _stateFragment._stateClass._person.ID;
_edName.Text = _stateFragment._stateClass._person.GetID ();
_edName.Text = _stateFragment._stateClass._person.Name;
_edNummer.Text = _stateFragment._stateClass._person.Nummer;
_edStrasse.Text = _stateFragment._stateClass._person.Strasse;
_edPLZ.Text =_stateFragment._stateClass._person.PLZ;
_edOrt.Text =_stateFragment._stateClass._person.Ort;
_spinnerLand.SetSelection(((CountryViewAdapter)_spinnerLand.Adapter).GetItemIndex (_stateFragment._stateClass._person.LandNummer));
_edTelefon.Text =_stateFragment._stateClass._person.Telefon;
_edEmail.Text = _stateFragment._stateClass._person.Email;
_tvEmail.Text = _stateFragment._stateClass._person.Email;
_tvTelefon.Text = _stateFragment._stateClass._person.Telefon;
_edSperrdatum.Text = _stateFragment._stateClass._person.Sperrdatum;
_edSperrgrund.Text = _stateFragment._stateClass._person.Sperrgrund;
}
// Disable the controls if necessary
_stateFragment.GetControlReferences();
if (_edName.Enabled == false)
_stateFragment.DisableControls();
}