protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_list); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(_toolbar); _rv = FindViewById <RecyclerView>(Resource.Id.rv); _rv.HasFixedSize = true; _rvLayoutManager = new LinearLayoutManager(this); _rv.SetLayoutManager(_rvLayoutManager); _listItems = new List <ListItem> { new ListItem { Title = "Nova entrada", PageType = typeof(QuestionarioFinalActivity) }, new ListItem { Title = "Menu pesquisa", PageType = typeof(POPActivity) } }; _adapter = new CustomAdapter(_listItems, this.Resources); _adapter.ItemClick += OnItemClick; _rv.SetAdapter(_adapter); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ap = new AppPreferences(this); SetContentView(Resource.Layout.activity_list); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(_toolbar); _rv = FindViewById <RecyclerView>(Resource.Id.rv); _rv.HasFixedSize = true; _rvLayoutManager = new LinearLayoutManager(this); _rv.SetLayoutManager(_rvLayoutManager); _listItems = new List <ListItem>(); var listaJson = ap.GetString("listaPesquisa", ""); var listaPesquisas = JsonConvert.DeserializeObject <List <Pesquisa> >(listaJson); foreach (var item in listaPesquisas) { _listItem = new ListItem(); _listItem.Title = item.Descricao; _listItem.PageType = typeof(POPActivity); _listItems.Add(_listItem); } _adapter = new CustomAdapter(_listItems, this.Resources); _adapter.ItemClick += OnItemClick; _rv.SetAdapter(_adapter); }
public override bool OnOptionsItemSelected (IMenuItem item) { switch (item.ItemId) { case Resource.Id.simple: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItem1, items); return true; case Resource.Id.with_heading: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItem2, items); return true; case Resource.Id.two_lines: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.TwoLineListItem, items); return true; case Resource.Id.activity: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.ActivityListItem, items); return true; case Resource.Id.checks: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItemChecked, items); ListView.ChoiceMode = ChoiceMode.Multiple; return true; case Resource.Id.single_choice: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItemSingleChoice, items); ListView.ChoiceMode = ChoiceMode.Single; return true; case Resource.Id.multiple_choice: ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItemMultipleChoice, items); ListView.ChoiceMode = ChoiceMode.Multiple; return true; default: return base.OnOptionsItemSelected (item); } }
private async void GetUserList() { try { connectedUsers = await chatHubProxy.Invoke <List <User> >("GetConnectedUsers"); foreach (User user in connectedUsers) { if (allChats.ContainsKey(user.login)) { Console.WriteLine("Connection is mapped"); } else { allChats.Add(user.login, new StringBuilder("")); Console.WriteLine("Dictionary count " + allChats.Count); } } var adapter = new CustomAdapter(this, connectedUsers); userList.Adapter = adapter; } catch (Exception ex) { Console.WriteLine("Server unreachable"); chatText.Append("Server unreachable\n"); } }
public void LoadTaskList() { List <string> taskList = dbHelper.getTaskList(); adapter = new CustomAdapter(this, taskList, dbHelper); lstTask.Adapter = adapter; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var lstData = FindViewById <ListView>(Resource.Id.listView); var btnShow = FindViewById <Button>(Resource.Id.btnShow); btnShow.Click += delegate { List <Person> lstSource = new List <Person>(); for (int i = 0; i < 20; i++) { Person person = new Person() { Id = i, Name = "eddydn " + i, Age = 20 + i, Email = "eddydn" + i + "@gmail.com" }; lstSource.Add(person); } var adapter = new CustomAdapter(this, lstSource); lstData.Adapter = adapter; }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.favorites_fragment, container, false); string key = Activity.ApplicationContext.GetString(Resource.String.fav_query_storage_key); var storage = new FavoritesStorage <FavoriteQuery>(Activity.ApplicationContext, key); favQueries = storage.GetItems(); adapter = new CustomAdapter(Activity.ApplicationContext); adapter.ItemClicked += (s, item) => { var query = favQueries.Single(x => x.Id == item.Id); ItemClicked?.Invoke(this, query.Query); }; adapter.ItemRemoved += (s, item) => { if (adapter.ItemCount == 0) { recyclerView.Visibility = ViewStates.Gone; emptyTextView.Visibility = ViewStates.Visible; } storage.RemoveItem(favQueries.Single(x => x.Id == item.Id)); }; foreach (var query in favQueries) { adapter.Items.Add(new CustomItem() { Id = query.Id, Name = query.Name, Description = query.Query }); } emptyTextView = view.FindViewById <TextView>(Resource.Id.fav_list_empty); recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recycler_view); recyclerView.SetLayoutManager(new LinearLayoutManager(Activity.ApplicationContext)); recyclerView.SetAdapter(adapter); recyclerView.AddItemDecoration(new ItemDecoration(Activity.ApplicationContext)); recyclerView.HasFixedSize = true; // swipe to remove var mItemTouchHelper = new ItemTouchHelper( new ItemTouchCallback(0, ItemTouchHelper.Left, Activity.ApplicationContext, adapter)); mItemTouchHelper.AttachToRecyclerView(recyclerView); if (adapter.ItemCount == 0) { recyclerView.Visibility = ViewStates.Gone; emptyTextView.Visibility = ViewStates.Visible; } else { recyclerView.Visibility = ViewStates.Visible; emptyTextView.Visibility = ViewStates.Gone; } return(view); }
void ConnectControl() { //DrawerLayout drawerLayout = (Android.Support.V4.Widget.DrawerLayout)FindViewById(Resource.Id.drawerLayout); //ToolBar mainToolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.mainToolbar); SetSupportActionBar(mainToolbar); SupportActionBar.Title = ""; Android.Support.V7.App.ActionBar actionBar = SupportActionBar; actionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_menu_action); actionBar.SetDisplayHomeAsUpEnabled(true); //TextView pickupLocationText = (TextView)FindViewById(Resource.Id.pickupLocationText); destinationText = (TextView)FindViewById(Resource.Id.destinationText); tripStatusText = (TextView)FindViewById(Resource.Id.tripStatusText); driverNameText = (TextView)FindViewById(Resource.Id.driverNameText); //Buttons favouritePlacesButton = (Button)FindViewById(Resource.Id.favouritePlacesButton); locationSetButton = (Button)FindViewById(Resource.Id.locationSetButton); requestDriverButton = (Button)FindViewById(Resource.Id.requestDriverButton); pickupRadio = (RadioButton)FindViewById(Resource.Id.pickupRadio); destinationRadio = (RadioButton)FindViewById(Resource.Id.DestinationRadio); callDriverButton = (ImageButton)FindViewById(Resource.Id.callDriverButton); cancelTripButton = (ImageButton)FindViewById(Resource.Id.cancelTripButton); favouritePlacesButton.Click += FavouritePlacesButton_Click; locationSetButton.Click += LocationSetButton_Click; requestDriverButton.Click += RequestDriverButton_Click; pickupRadio.Click += PickupRadio_Click; destinationRadio.Click += DestinationRadio_Click; //Layouts layoutPickUp = (RelativeLayout)FindViewById(Resource.Id.layoutPickUp); layoutDestination = (RelativeLayout)FindViewById(Resource.Id.layoutDestination); layoutPickUp.Click += LayoutPickUp_Click; layoutDestination.Click += LayoutDestination_Click; //imageview centerMarker = (ImageView)FindViewById(Resource.Id.centerMarker); //Bottomsheet FrameLayout tripDetailsView = (FrameLayout)FindViewById(Resource.Id.tripdetails_bottomsheet); FrameLayout rideInfoSheet = (FrameLayout)FindViewById(Resource.Id.bottom_sheet_trip); tripDetailsBottonsheetBehaviour = BottomSheetBehavior.From(tripDetailsView); driverAssignedBottomSheetBehaviour = BottomSheetBehavior.From(rideInfoSheet); lv = FindViewById <ListView>(Resource.Id.lv); //BIND ADAPTER adapter = new CustomAdapter(this, GetSpacecrafts()); lv.Adapter = adapter; lv.ItemClick += lv_ItemClick; }
void SetAdapterToListView() { adapter = new CustomAdapter (this, data); RunOnUiThread (() => { listView.Adapter = adapter; listView.OnRefreshCompleted(); }); }
public void LoadTaskList() { List <String> taskList = dbHelper.getTaskList(); List <String> taskTimeList = dbHelper.getTaskTimeList(); adapter = new CustomAdapter(dbHelper, this, taskList, taskTimeList); listTask.Adapter = adapter; }
protected override void OnPostExecute(string result) { base.OnPostExecute(result); activity.users = JsonConvert.DeserializeObject <List <User> >(result); CustomAdapter adapter = new CustomAdapter(Application.Context, activity.users); activity.lstView.Adapter = adapter; pd.Dismiss(); }
public ScrollViewNative(Android.Content.Context activity, ScrollView scrollView) : base(activity) { _scrollView = scrollView; var adapter = new CustomAdapter(scrollView); Adapter = adapter; SetOnTouchListener(this); }
public ScrollViewNative(Android.Content.Context activity, ScrollView controller) : base(activity) { _controller = controller; var adapter = new CustomAdapter(controller); Adapter = adapter; SetOnTouchListener(this); }
private void SetListeners() { custAdapter = new CustomAdapter(this, listFiles); listSession.SetAdapter(custAdapter); linSes.SetOnClickListener(this); listSession.ItemClick += listView_onClickListener; listSession.ItemLongClick += listView_onLongClickListener; linSes.LongClick += onLongClick; listSession.LongClick += onLongClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); items = new string[] { "Vegetais","Frutas","Flores","Legumes","Bulbos","Tubérculos", "Carne bovina", "Aves", "Peixes", "Répteis", "Massas", "Sushis", "Sashimis"}; ListAdapter = new CustomAdapter(this, Android.Resource.Layout.SimpleListItem1, items); ListView.FastScrollEnabled = true; }
/// <summary> /// Asigna el objeto principal al origen de datos /// <returns>void</returns> /// </summary> protected override void RefreshMainData() { _original_table = new DataTable(); CustomAdapter custom = new CustomAdapter(); custom.FillFromReader(_original_table, _reader); _pivoted_table = PivotTable.GetDataTable(_original_table); Precios_Tabla.DataSource = _pivoted_table; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); lvExpandableList = FindViewById <RCExpandableListView>(Resource.Id.lvExpand); dummyList = CreateList(); adapter = new CustomAdapter(this, dummyList); lvExpandableList.Adapter = adapter; lvExpandableList.ItemClick += LvExpandableList_ItemClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); sp = FindViewById <Spinner>(Resource.Id.sp); fruits = FruitsCollection.GetFruits(); adapter = new CustomAdapter(this, fruits); sp.Adapter = adapter; sp.ItemSelected += sp_ItemSelected; }
protected override void OnPostExecute(string result) { SimsimiModel simsimiModel = JsonConvert.DeserializeObject <SimsimiModel>(result); ChatModel model = new ChatModel(); model.ChatMessage = simsimiModel.response; model.IsSend = false; mainActivity.list_chat.Add(model); CustomAdapter adapter = new CustomAdapter(mainActivity.list_chat, mainActivity.BaseContext); mainActivity.list_of_messages.Adapter = adapter; }
protected override void OnCreate(Bundle bundle) { SetTheme (Resource.Style.Theme_Sherlock); base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); list = FindViewById<ListView> (Resource.Id.list); drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout); adapter = new CustomAdapter (this, list_text); list.Adapter = adapter; fragA = new FragmentA (); fragB = new FragmentB (); list.ItemClick += (sender, e) => { ListView item = sender as ListView; int pos = item.CheckedItemPosition; TextView t = (TextView) e.View.FindViewById(Resource.Id.textView1); string mess = t.Text; Bundle args = new Bundle(); args.PutString("message", mess); transaction = SupportFragmentManager.BeginTransaction(); switch (pos){ case 0: if(!fragA.IsVisible){ fragA.Arguments = args; transaction.Replace(Resource.Id.frame, fragA); } break; case 1: if(!fragB.IsVisible){ fragB.Arguments = args; transaction.Replace(Resource.Id.frame, fragB); } break; } transaction.Commit(); list.SetItemChecked(pos, true); drawer.CloseDrawer(list); }; mDrawerToggle = new Android.Support.V4.App.ActionBarDrawerToggle(this, drawer, Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close) { }; drawer.SetDrawerListener(mDrawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetHomeButtonEnabled(true); // Get our button from the layout resource, // and attach an event to it }
protected override void OnCreate (Bundle bundle){ base.OnCreate (bundle); SetContentView (Resource.Layout.Request); //First Name firstName = FindViewById<EditText> (Resource.Id.firstName); //Last Name lastName = FindViewById<EditText> (Resource.Id.lastName); //Phone Number phoneNumber = FindViewById<EditText> (Resource.Id.phoneNumber); //E-Mail email = FindViewById<EditText> (Resource.Id.email); //Type of Design designType = FindViewById<Spinner> (Resource.Id.spinner); List<String> choices = new List<String>(); choices.Add ("Illustration - $35"); choices.Add ("Flyer - $30"); choices.Add ("Logo - $25"); CustomAdapter adapter = new CustomAdapter (this, choices); adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); designType.Adapter = adapter; //Design Date designDate = FindViewById<TextView> (Resource.Id.designDate); designDate.Click += delegate { #pragma warning disable ShowDialog(0); #pragma warning restore }; //Information information = FindViewById<EditText> (Resource.Id.information); //Submit Button submit = FindViewById<Button> (Resource.Id.submit_button); submit.Click += delegate { if(validSubmission(firstName.Text, lastName.Text, phoneNumber.Text, email.Text, designDate.Text, information.Text)){ if(isValidEmail(email.Text) && isValidPhone(phoneNumber.Text)){ SendToPHP(); } } else{ showErrorAlert(); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Score); lstView = FindViewById <ListView>(Resource.Id.lstView); DbHelper.DbHelper db = new DbHelper.DbHelper(this); List <Ranking> lstRanking = db.GetRanking(); if (lstRanking.Count > 0) { CustomAdapter adapter = new CustomAdapter(this, lstRanking); lstView.Adapter = adapter; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.ContactList); List <Contact> lstSource = GetContacts(); var contactList = FindViewById <ListView>(Resource.Id.contactListView); if (lstSource != null) { var adapter = new CustomAdapter(this, lstSource); contactList.Adapter = adapter; } }
/*****************************************************************************************************/ protected void Click_CopyRecordToBookTable(object sender, EventArgs e) { int result = 0; string temp = ""; FileLink ft = new FileLink(); temp = LinkEntryTextBox.Text; int.TryParse(temp, out result); ft.Link2GeneEntry = result; ft.FileName = LinkFileNameTextBox.Text; ft.FileExt = file_ext; ft.Directory = directoryLink; ft.Description = DescriptionTextBox.Text; string m_connectionString = ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString; CustomAdapter ca = new CustomAdapter(); ca.UpdateFLRecord(m_connectionString, ft); }
private void ButtonClick(object s, EventArgs args) { for (int i = 0; i < 20; i++) { Person person = new Person(); person.Id = i; person.Name = "Subject" + i; person.Surname = "Derived"; person.Age = 20 + i; listPersons.Add(person); } var adapter = new CustomAdapter(this, listPersons); //ListAdapter = new ArrayAdapter<Person>(this, Android.Resource.Layout.SimpleListItem1, listPersons); //ListAdapter. //lstData.Adapter = ListAdapter; lstData.Adapter = adapter; }
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); EditText editText = FindViewById<EditText> (Resource.Id.myEditText); listView = FindViewById<ListView> (Resource.Id.listView1); CustomAdapter _custAdaptor = new CustomAdapter (this, list); button.Click += delegate { if(editText.Text.Trim().Length > 0) { SearchService searchService = new SearchGoogleApp.SearchService(editText.Text); if (searchService.SearchApi().ToString().Trim().Length > 0) { Post _post = new Post(); _post.question = editText.Text ; _post.answer = searchService.SearchApi().ToString(); list.Add(_post); listView.Adapter = _custAdaptor; editText.Text = ""; } } // Intent intent = new Intent(Intent.ActionWebSearch); // String term = editText.Text; // Bundle bundle1 = new Bundle(); // bundle1.PutString(SearchManager.Query, term); // intent.PutExtras(bundle1); // StartActivityForResult(intent); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); var lstData = FindViewById <ListView>(Resource.Id.lstCoins); edtCoinName = FindViewById <EditText>(Resource.Id.edtText); try { myStuff = JObject.Parse(CoinMarketCapAPI.makeAPICall()); lstMyCoins = ListAll(); var adapter = new CustomAdapter(this, lstMyCoins); lstData.Adapter = adapter; } catch (WebException e) { Toast.MakeText(this, "API Error - " + e.Message, ToastLength.Short).Show(); } edtCoinName.TextChanged += delegate { if (edtCoinName.Length() > 0) { lstMyCoins = ListByText(edtCoinName.Text.ToString()); } else { lstMyCoins = ListAll(); } var adapter = new CustomAdapter(this, lstMyCoins); lstData.Adapter = adapter; }; lstData.ItemClick += LstData_ItemClick; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); lv = FindViewById <ListView>(Resource.Id.lv); propertyFeedModels = GetPropertyFeedModels(); adapter = new CustomAdapter(this, Resource.Layout.PropertyFeedModel, Resource.Id.tvTitle2, propertyFeedModels); lv.Adapter = adapter; lv.ItemClick += lv_ItemClick; AppCenter.Start("9e333419-7601-418f-b781-ecaebcbeaed9", typeof(Analytics), typeof(Crashes)); AppCenter.Start("9e333419-7601-418f-b781-ecaebcbeaed9", typeof(Analytics), typeof(Crashes)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var recyclerView = FindViewById <RecyclerView>(Resource.Id.my_recycler_view); var layoutManager = new LinearLayoutManager(this); recyclerView.SetLayoutManager(layoutManager); var input = Assets.Open("Data.json"); using (var streamReader = new StreamReader(input)) { var content = streamReader.ReadToEnd(); var items = JsonConvert.DeserializeObject <List <AndroidVersion> >(content); adapter = new CustomAdapter(items); recyclerView.SetAdapter(adapter); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.activity_list); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); _btn = FindViewById <Button>(Resource.Id.btnConsolidado); _btn.Visibility = Android.Views.ViewStates.Visible; _btn.Click += btnClickConsolidado; SetSupportActionBar(_toolbar); _rv = FindViewById <RecyclerView>(Resource.Id.rv); _rv.HasFixedSize = true; _rvLayoutManager = new LinearLayoutManager(this); _rv.SetLayoutManager(_rvLayoutManager); _listItems = new List <ListItem> { new ListItem { Title = "Coordenador", PageType = null }, new ListItem { Title = "Pesquisador 1", PageType = null }, new ListItem { Title = "Pesquisador 2", PageType = null }, new ListItem { Title = "Pesquisador 3", PageType = null } }; _adapter = new CustomAdapter(_listItems, this.Resources); _adapter.ItemClick += OnItemClick; _rv.SetAdapter(_adapter); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ap = new AppPreferences(this); SetContentView(Resource.Layout.activity_list); _toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(_toolbar); SupportActionBar.Title = GlobalParams.getInstance().getTitle(); _rv = FindViewById <RecyclerView>(Resource.Id.rv); _rv.HasFixedSize = true; _rvLayoutManager = new LinearLayoutManager(this); _rv.SetLayoutManager(_rvLayoutManager); _listItems = new List <ListItem> { new ListItem { Title = "Nova entrevista", PageType = typeof(QuestionarioActivity) }, //new ListItem {Title = "Nova entrevista", PageType = typeof(QuestionarioFinalActivity)}, new ListItem { Title = "Mapa", PageType = typeof(MapaActivity) }, new ListItem { Title = "Despesas", PageType = typeof(DespesaActivity) } }; _adapter = new CustomAdapter(_listItems, this.Resources); _adapter.ItemClick += OnItemClick; _rv.SetAdapter(_adapter); }
private void Init() { _app = (App)Application; _gridView = (GridView)FindViewById(Resource.Id.functionset_grid); string[] convertTexts = Resources.GetStringArray( Resource.Array.function_texts); var typedArray = Resources.ObtainTypedArray( Resource.Array.function_icons); for (int index = 0; index < typedArray.Length(); index++) { int resId = typedArray.GetResourceId(index, 0); var _function = new FunctionItem(convertTexts[index], resId); _list.Add(_function); } typedArray.Recycle(); _gridView.OnItemClickListener = this; _adapter = new CustomAdapter(this, Resource.Layout.function_item, _list, _gridView); _gridView.SetAdapter(_adapter); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (savedInstanceState != null) { if (savedInstanceState.GetString("lastSearch") != null) { previousSearch = savedInstanceState.GetString("lastSearch"); } } // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar1); toolbar.Visibility = ViewStates.Invisible; eventi = new List <Evento>(); //bottoneCaricaEventi = FindViewById<Button>(Resource.Id.bottoneCaricaEventi); //bottoneCaricaEventi.Visibility = ViewStates.Gone; circularbar = FindViewById <ProgressBar>(Resource.Id.circularProgressbar); circularbar.Max = 100; circularbar.Progress = 100; circularbar.SecondaryProgress = 100; thisDay = DateTime.Now.Date; //bottone = FindViewById<Button>(Resource.Id.button1); //bottone.Visibility = ViewStates.Invisible; httpClient = new WebClient(); httpClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCallback2); //httpClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback); listaEventi = FindViewById <ListView>(Resource.Id.listaEventi); adapter = new CustomAdapter(this, eventi); if (jsonData == null || !thisDay.Equals(lastDownload)) { httpClient.DownloadStringAsync(new System.Uri("http://dati.umbria.it/dataset/410faa97-546b-4362-a6d7-f8794d18ed19/resource/8afe729a-0f59-4647-95ee-481577e83bea/download/eventijsonitit.zipeventiitit.json")); new System.Threading.Thread(new ThreadStart(delegate { while (httpClient.IsBusy) { if (progressStatus1 != 0) { progressStatus1 -= 1; } else { progressStatus1 += 100; } circularbar.Progress = progressStatus1; System.Threading.Thread.Sleep(10); } })).Start(); } else { circularbar.Visibility = ViewStates.Gone; InizializzaVista(jsonData); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.TelePhoneManager); LinearLayout cancel = FindViewById<LinearLayout>(Resource.Id.TelePhoneManager_cancel); ListView list = FindViewById<ListView>(Resource.Id.TelePhoneManager_items); TelephonyManager tm = (TelephonyManager)GetSystemService(Context.TelephonyService); StringBuilder sb = new StringBuilder(); sb.Append("["); sb.Append("{'name':'Message','value':'以下信息为设备信息'},"); try { sb.Append("{'name':'AndroidId','value':'" + Android.Provider.Settings.Secure.GetString(this.ContentResolver, Android.Provider.Settings.Secure.AndroidId) + "'},"); } catch { } try { sb.Append("{'name':'DeviceId(IMEI)','value':'" + tm.DeviceId + "'},"); } catch { } try { sb.Append("{'name':'DeviceSoftwareVersion','value':'" + tm.DeviceSoftwareVersion + "'},"); } catch { } try { sb.Append("{'name':'Line1Number','value':'" + tm.Line1Number + "'},"); } catch { } try { sb.Append("{'name':'NetworkCountryIso','value':'" + tm.NetworkCountryIso + "'},"); } catch { } try { sb.Append("{'name':'NetworkOperator','value':'" + tm.NetworkOperator + "'},"); } catch { } try { sb.Append("{'name':'NetworkOperatorName','value':'" + tm.NetworkOperatorName + "'},"); } catch { } try { sb.Append("{'name':'NetworkType','value':'" + tm.NetworkType + "'},"); } catch { } try { sb.Append("{'name':'PhoneType','value':'" + tm.PhoneType + "'},"); } catch { } try { sb.Append("{'name':'SimCountryIso','value':'" + tm.SimCountryIso + "'},"); } catch { } try { sb.Append("{'name':'SimOperator','value':'" + tm.SimOperator + "'},"); } catch { } try { sb.Append("{'name':'SimOperatorName','value':'" + tm.SimOperatorName + "'},"); } catch { } try { sb.Append("{'name':'SimSerialNumber','value':'" + tm.SimSerialNumber + "'},"); } catch { } try { sb.Append("{'name':'SimState','value':'" + tm.SimState + "'},"); } catch { } try { sb.Append("{'name':'SubscriberId','value':'" + tm.SubscriberId + "'},"); } catch { } try { sb.Append("{'name':'VoiceMailNumber','value':'" + tm.VoiceMailNumber + "'},"); } catch { } try { sb.Append("{'name':'CallState','value':'" + tm.CallState + "'},"); } catch { } try { sb.Append("{'name':'CellLocation','value':'" + tm.CellLocation + "'},"); } catch { } try { sb.Append("{'name':'Message','value':'以下信息为MySysSet表信息'},"); } catch { } DataTable ldt_sys = new DataTable(); ldt_sys = SqliteHelper.ExecuteDataTable("select itemtype,itemname,itemvalue,memo from mysysset"); if (ldt_sys != null) { for (int i = 0; i < ldt_sys.Rows.Count; i++) { string name = ldt_sys.Rows[i]["itemtype"].ToString() + "-" + ldt_sys.Rows[i]["itemname"].ToString(); string value = ldt_sys.Rows[i]["itemvalue"].ToString(); string memo = ldt_sys.Rows[i]["memo"].ToString(); if (!string.IsNullOrEmpty(memo)) { value += " Memo:" + memo; } //name = getFormat(name); //value = getFormat(value); try { sb.Append("{'name':'" + name + "','value':'" + value + "'},"); } catch { } } } sb.Append("]"); string ls_msg = sb.ToString(); ls_msg = ls_msg.Replace("},]", "}]"); DataTable ldt = new DataTable(); //ldt = Core.JsonHelper.JsonToDataTable(ls_msg); ldt = baseclass.Json.JsonToDataTable(ls_msg); ls_msg = baseclass.Json.DataTableToJson(ldt); CustomAdapter listItemAdapter = new CustomAdapter(this, ldt); list.Adapter = listItemAdapter; System.Threading.Thread thr = new System.Threading.Thread(new System.Threading.ThreadStart(of_netType)); thr.Start(); cancel.Click += delegate { StartActivity(typeof(MainActivity)); Finish(); }; //string test = ""; //test = new LocationAct(this).OpenLocation(); //Toast.MakeText(this, test, ToastLength.Short); }
private DataTable getTable(string sSql) { // Expects a root type NHibernate.ISession sess = ActiveRecordMediator.GetSessionFactoryHolder().CreateSession(typeof(Antares.model.Adjunto)); DbConnection db = (DbConnection)sess.Connection;// ActiveRecordMediator.GetSessionFactoryHolder().GetSessionFactory().GetCurrentSession().Connection; DbCommand oConn = db.CreateCommand(); oConn.CommandText = sSql; IDataReader dr = oConn.ExecuteReader(); CustomAdapter da = new CustomAdapter(); DataTable dtOut = new DataTable(); da.FillFromReader(dtOut, dr); //converts a datareader into a datatable return dtOut; }
/// <summary> /// Отображение списка рецептов на экран /// </summary> private void ShowData() { var adapter = new CustomAdapter(this, listDb); lv.Adapter = adapter; }
public static void SetCustomAdapter(this IFreeSql that, CustomAdapter adapter) => _dicCustomAdater.AddOrUpdate(that.Ado.Identifier, adapter, (fsql, old) => adapter);
/*****************************************************************************************************/ protected void DoInsert_Click(object sender, EventArgs e) { int result = 0; string temp = ""; FamilyTree ft = new FamilyTree(); temp = InsertParentIDTextBox.Text; int.TryParse(temp, out result); ft.ParentID = result; ft.FirstName = InsertFirstNameTextBox.Text; ft.MiddleName = InsertMiddleNameTextBox.Text; ft.LastName = InsertLastNameTextBox.Text; temp = InsertBirthDateTextBox.Text; int.TryParse(temp, out result); ft.BirthDate = result; temp = InsertDeathDateTextBox.Text; int.TryParse(temp, out result); ft.DeathDate = result; string m_connectionString = ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString; CustomAdapter ca = new CustomAdapter(); ca.UpdateFTRecord(m_connectionString, ft); }