Example #1
0
        private static void ViewOnLongClick(object sender, View.LongClickEventArgs longClickEventArgs)
        {
            var view    = (View)sender;
            var context = view.Context;

            var name = view.FindViewById <TextView>(Resource.Id.NameText);
            var id   = view.FindViewById <TextView>(Resource.Id.IdText);

            var builder = new AlertDialog.Builder(context);

            builder.SetTitle("Alert !");
            builder.SetMessage($"Are you sure to kill the {name.Text} processus ?");
            builder.SetNegativeButton("No", (o, args) => { });
            builder.SetPositiveButton("Yes", (o, args) =>
            {
                Toast t;
                try
                {
                    ProcessusManager.StopProcessus(int.Parse(id.Text));
                    t = Toast.MakeText(context, "You killed the process !", ToastLength.Long);
                }
                catch (Exception)
                {
                    t = Toast.MakeText(context, "Failed to kill the process !", ToastLength.Long);
                }
                t.Show();
            });

            builder.Show();
        }
Example #2
0
        public void Should_obtain_processus_list_When_calling_manager()
        {
            // Arrange

            // Act
            var getTask   = ProcessusManager.GetProcessus();
            var processus = getTask.Result;

            // Assert
            Assert.IsTrue(processus?.Count > 0);
        }
Example #3
0
        protected async Task LoadProcessusListAsync()
        {
            try
            {
                _processus = await ProcessusManager.GetProcessusAsync();

                _adapter = new ProcessusAdapter(this, _processus);

                _processusListView.Adapter = _adapter;
            }
            catch (Exception e)
            {
                var t = Toast.MakeText(this, e.Message, ToastLength.Long);
                t.Show();
            }
        }