protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Load the UI created in Main.axml SetContentView (Resource.Layout.Main); // Get a reference to the button var showSecond = FindViewById<Button> (Resource.Id.showSecond); var showThird = FindViewById<Button>(Resource.Id.showThird); var showForuth = FindViewById<Button>(Resource.Id.showForuth); // You can use either this short form of StartActivity, which will create // an intent internally, or the long form shown below. // showSecond.Click += (sender, e) => { // StartActivity (typeof(SecondActivity)); // }; // Long form of StartActivity with the intent created in code so that // data can be added to the message payload using the PutExtra call. showSecond.Click += (sender, e) => { var secondIntent = new Intent(this, typeof(SecondActivity)); string result = ""; var ws = new webService.WebService1(); ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy(); result = ws.GetNod(1); secondIntent.PutExtra("FirstData", result); //second.AddFlags(ActivityFlags.NoHistory); StartActivity (secondIntent); }; // showThird.Click += (sender, e) => { var thirdIntent = new Intent(this, typeof(SecondActivity)); thirdIntent.PutExtra("FirstData", "LABEL^Nodul 0@LABEL^Ana@LABEL^are@LABEL^mere@LIST^Lunile anului#Ianuarie#Februarie#Martie#Aprilie#Mai#Iunie#Iulie#August#Septembrie#Octombrie#Noiembrie#Decembrie3@LABEL^Ce@LABEL^are@LABEL^Ana ?@LABEL^pere@BUTTON^WsNod 1#1@BUTTON^WsNod 2#2"); //third.AddFlags(ActivityFlags.NoHistory); StartActivity(thirdIntent); }; //"LABEL^Nodul 1@LABEL^Ana@LABEL^are@LABEL^mere@LIST^Lunile anului#Ianuarie#Februarie#Martie#Aprilie#Mai#Iunie#Iulie#August#Septembrie#Octombrie#Noiembrie#Decembrie3@LABEL^Ce@LABEL^are@LABEL^Ana ?@LABEL^pere@BUTTON^WsNod 1#1@BUTTON^WsNod 2#2" //"LIST^listName#itemA#itemB@BUTTON^ok#7@BUTTON^cancel#3@LABEL^Zilele saptamanii@SPINNER^Luni#Marti#Miercuri#Joi#Vineri#Sambata#Duminica" //1 //"LABEL^Nodul 1@LIST^listaTest#itemA#itemB@LABEL^Zilele saptamanii@SPINNER^Luni#Marti#Miercuri#Joi#Vineri#Sambata#Duminica@BUTTON^Ws Nod 3#3@BUTTON^Ws Nod 4#4" //2 //"LABEL^Nodul 2@LABEL^Acesta@LABEL^este@LABEL^nodul 2@LABEL^Zilele saptamanii@SPINNER^Luni#Marti#Miercuri#Joi#Vineri#Sambata#Duminica@LIST^listaTest#itemA#itemB@BUTTON^Ws Nod 4#4" //3 //"LABEL^Nodul 3@LABEL^Ati@LABEL^ajuns@LABEL^la nodul 3@LABEL^Culori@SPINNER^rosu#verde#albastru@LIST^Lista 20 elemente #item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10@LABEL^De aici nu se poate merge la alt nod@LABEL^EOF" //4 //"LABEL^Nodul 4@LABEL^Bine@LABEL^ati@LABEL^ajuns@LABEL^la nodul 4@LABEL^Ce are ana?@SPINNER^Mere#Pere@LIST^Lista 100 elemente#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10@LABEL^De aici nu se poate merge doar la nodul 5@BUTTON^Ws Nod 5#5" //5 //"LABEL^Nodul 5@LABEL^Saluti@LABEL^acesta@LABEL^este@LABEL^ultimul@LABEL^nod din ramura@LABEL^Spinner 100 elemente@SPINNER^item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10@LIST^Lista 40 elemente #item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10#item 1#item 2#item 3#item 4#item 5#item 6#item 7#item 8#item 9#item 10@LABEL^Gata" showForuth.Click += (sender, e) => { string result = ""; var ws = new webService.WebService1(); ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy(); result = ws.HelloAndi(); Toast.MakeText(this, result, ToastLength.Long).Show(); /*var wsIntent = new Intent(this, typeof(SecondActivity)); wsIntent.PutExtra("FirstData", result); //third.AddFlags(ActivityFlags.NoHistory); //finish activity on screen (activity) change; StartActivity(wsIntent);*/ }; }
public void GenerateComponent(string componentType, string parameters, LinearLayout layout) { string paramString = parameters; if (componentType=="BUTTON") { const string sSeparatori2 = "#"; string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray()); string caption = sAtomi1[0]; string idNod = sAtomi1[1]; var aButton = new Button(_secondActivity); aButton.Text = caption; aButton.Click += delegate(object sender, EventArgs e) { string result = ""; var ws = new webService.WebService1(); ws.Proxy = System.Net.GlobalProxySelection.GetEmptyWebProxy(); //ws.Proxy = System.Net.WebRequest.DefaultWebProxy = int paramID = Convert.ToInt32(idNod); var wsIntent = new Intent(layout.Context, typeof(SecondActivity)); //wsIntent.PutExtra("FirstData", "LABEL^Nodul test@LABEL^Maria@LABEL^are@LABEL^mere@LIST^Lunile anului#Ianuarie#Februarie#Martie#Aprilie#Mai#Iunie#Iulie#August#Septembrie#Octombrie#Noiembrie#Decembrie3@LABEL^Ce@LABEL^are@LABEL^Ana ?@LABEL^pere@BUTTON^WsNod 1#1@BUTTON^WsNod 2#2"); result = ws.GetNod(paramID); wsIntent.PutExtra("FirstData", result); layout.Context.StartActivity(wsIntent); }; layout.AddView(aButton); } else if (componentType == "LABEL") { string caption = paramString; var label = new TextView(_secondActivity); label.Text = caption; label.Click += delegate(object sender, EventArgs e) { Toast.MakeText(layout.Context, caption, ToastLength.Short).Show(); }; layout.AddView(label); } else if (componentType == "SPINNER") { Spinner spinner = new Spinner(_secondActivity); const string sSeparatori2 = "#"; string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray()); String []spinnerArray=new string[sAtomi1.Length]; int index1; for (index1 = 0; index1 < sAtomi1.Length; index1 = index1 + 1) { if (sAtomi1[index1].Length <= 0) continue; spinnerArray[index1] = sAtomi1[index1]; } ArrayAdapter<String> adapter = new ArrayAdapter<String>(_linearLayout.Context, Android.Resource.Layout.SimpleSpinnerItem, spinnerArray); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; layout.AddView(spinner); } else if (componentType == "LIST") { IList<String> stringList = new List<string>(); const string sSeparatori2 = "#"; string[] sAtomi1 = paramString.Split(sSeparatori2.ToCharArray()); String[] stringArray = new string[sAtomi1.Length]; int index1; for (index1 = 0; index1 < sAtomi1.Length; index1 = index1 + 1) { if (sAtomi1[index1].Length <= 0) continue; stringArray[index1] = sAtomi1[index1]; stringList.Add(sAtomi1[index1]); } var label = new TextView(_secondActivity); label.Text = stringArray[0]; label.Typeface = Typeface.DefaultBold; label.TextSize = 20; label.Click += delegate(object sender, EventArgs e) { var intent = new Intent(layout.Context, typeof(SimpleListItem1)); intent.PutStringArrayListExtra("FirstData", stringList); intent.AddFlags(ActivityFlags.NoHistory); layout.Context.StartActivity(intent); }; layout.AddView(label); } }