protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            NewTXT = FindViewById<EditText>(Resource.Id.editText1);
            btn_Send = FindViewById<Button>(Resource.Id.button1);

            LV = FindViewById<ListView>(Resource.Id.listView1);
            // LV.Adapter = new HomeScreenAdapter(this, contactItems);
            //   LV.ItemClick += OnListItemClick;  // to be defined
            contactItems = new List<contactclass>();
            newWS.wsnew webser = new newWS.wsnew();
            webser.GetJsontxtNewsAsync();
            webser.GetJsontxtNewsCompleted += Webser_GetJsontxtNewsCompleted;

            btn_Send.Click += delegate
            {
                newWS.wsnew webser2 = new newWS.wsnew();
                webser2.SendNewsAsync(NewTXT.Text);
                webser2.SendNewsCompleted += Webser2_SendNewsCompleted;
            };


            StartService(new Intent(this, typeof(MyServices)));
        }
Esempio n. 2
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            newWS.wsnew sw = new newWS.wsnew();
            sw.NewsNotifyCompleted += Sw_NewsNotifyCompleted;
            // countine
            new Task(() =>
            {
                while (true)
                {
                    if (IsDone == false)
                    {
                        IsDone = true;
                        sw.NewsNotifyAsync(id);
                    }

                    Thread.Sleep(10000);
                }
            }).Start();

            return(StartCommandResult.Sticky);
        }