Exemple #1
0
        void UpdateData(JavaList <IDictionary <string, object> > data, ListView lv)
        {
            data.Clear();
            var testTarget = SetupTestTarget();

            foreach (var test in GetChildTests(testTarget))
            {
                TestResult res;
                AndroidRunner.Results.TryGetValue(test.FullName, out res);
                if (test is TestSuite)
                {
                    var suite = test as TestSuite;
                    data.Add(new TestData(suite.FullName,
                                          res != null && res.PassCount > 0 ? res.PassCount + " passed" : null,
                                          res != null && res.FailCount > 0 ? res.FailCount + " failed" : null,
                                          res != null && res.SkipCount > 0 ? res.SkipCount + " ignored" : null,
                                          res != null && res.InconclusiveCount > 0 ? res.InconclusiveCount + " inconclusive" : null,
                                          res == null ? null : res.ResultState.Status.ToString(), res == null ? null : res.Message));
                }
                else if (test is NUnitTest)
                {
                    data.Add(new TestData(test.FullName, null, null, null, null, res == null ? null : res.ResultState.Status.ToString(), res == null ? null : res.Message));
                }
            }
            lv.Adapter = new TestDataAdapter(this, data, Resource.Layout.results, from_cols, to_ids);
        }
Exemple #2
0
        //Get All Shopping Lists
        public static JavaList <ShoppingLists> GetShoppingLists()
        {
            var           lists    = new JavaList <ShoppingLists>();
            ShoppingLists allLists = null;

            lists.Clear();

            DBHelper dbh = new DBHelper();                      //db conn
            ICursor  c   = dbh.ReadAllShoppingLists();          //shopping lists

            while (c.MoveToNext())
            {
                string listId       = c.GetString(0);
                string title        = c.GetString(1);
                string listDesc     = c.GetString(2);
                string shoppingDate = c.GetString(3);
                string expBudget    = c.GetString(4);
                string actBudget    = c.GetString(5);
                string listStatus   = c.GetString(6);

                allLists                = new ShoppingLists();
                allLists.Id             = Convert.ToInt32(listId);
                allLists.ListTitle      = title;
                allLists.ListDesc       = listDesc;
                allLists.ShoppingDate   = shoppingDate;
                allLists.ExpectedBudget = Convert.ToDecimal(expBudget);
                allLists.ListStatus     = listStatus;
                lists.Add(allLists);
            }

            return(lists);
        }
        //Get Goal Names
        public static JavaList <Goals> SpinnerGoals()
        {
            var   goals    = new JavaList <Goals>();
            Goals allGoals = null;

            goals.Clear();

            DBHelper dbh = new DBHelper();          //db conn
            ICursor  c   = dbh.ReadAllGoals();      //goal list

            while (c.MoveToNext())
            {
                string goalId       = c.GetString(0);
                string goal         = c.GetString(1);
                string goalDesc     = c.GetString(2);
                string goalStart    = c.GetString(3);
                string goalDeadline = c.GetString(4);
                string goalStatus   = c.GetString(5);

                allGoals      = new Goals();
                allGoals.Id   = Convert.ToInt32(goalId);
                allGoals.Goal = goal;
                goals.Add(goal);
            }
            return(goals);
        }
        private void ReloadData(int startId)
        {
            m_AllTasks.Clear();
            foreach (var task in DataManager.GetClearedTasks(SortOption.Newest))
            {
                m_AllTasks.Add(task);
            }


            RunOnUiThread(() =>
            {
                ListAdapter = new ClearedTaskAdapter(this, m_AllTasks);
                if (ListView.Visibility == ViewStates.Gone)
                {
                    ListView.Visibility = ViewStates.Visible;
                    ListView.StartAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.fadein));
                }
            });

            if (startId == 0)
            {
                return;
            }

            var firstTask = m_AllTasks.FirstOrDefault(t => t.ID == startId);

            if (firstTask == null)
            {
                return;
            }

            var itemIndex = m_AllTasks.IndexOf(firstTask);

            RunOnUiThread(() => ListView.SetSelection(itemIndex));
        }
        //Get Goal Tasks
        public static JavaList <GoalTasks> GetGoalTasks(int gId)
        {
            var       tasks    = new JavaList <GoalTasks>();
            GoalTasks allTasks = null;

            tasks.Clear();

            DBHelper dbh = new DBHelper();
            ICursor  c   = dbh.ReadAllGoalTasks(gId);

            while (c.MoveToNext())
            {
                string taskId       = c.GetString(0);
                string task         = c.GetString(1);
                string taskGoal     = c.GetString(2);
                string taskDesc     = c.GetString(3);
                string taskStart    = c.GetString(4);
                string taskDeadline = c.GetString(5);
                string taskStatus   = c.GetString(7);

                allTasks              = new GoalTasks();
                allTasks.Id           = Convert.ToInt32(taskId);
                allTasks.Task         = task;
                allTasks.Goal         = Convert.ToInt32(taskGoal);
                allTasks.TaskDesc     = taskDesc;
                allTasks.TaskStart    = taskStart;
                allTasks.TaskDeadline = taskDeadline;
                allTasks.TaskStatus   = taskStatus;
                tasks.Add(allTasks);
            }

            return(tasks);
        }
        public static JavaList <Projects> GetProjects()
        {
            var projects = new JavaList <Projects>();

            Projects allProjects = null;

            projects.Clear();

            DBHelper dbh = new DBHelper();
            ICursor  c   = dbh.ReadAllProjects();

            while (c.MoveToNext())
            {
                string projectId       = c.GetString(0);
                string project         = c.GetString(1);
                string projectDesc     = c.GetString(2);
                string projectStart    = c.GetString(3);
                string projectDeadline = c.GetString(4);
                string projectBudget   = c.GetString(5);
                string projectStatus   = c.GetString(6);

                allProjects                 = new Projects();
                allProjects.Id              = Convert.ToInt32(projectId);
                allProjects.Project         = project;
                allProjects.ProjectDesc     = projectDesc;
                allProjects.ProjectStart    = projectStart;
                allProjects.ProjectDeadline = projectDeadline;
                allProjects.ProjectBudget   = Convert.ToDecimal(projectBudget);
                allProjects.ProjectStatus   = projectStatus;
                projects.Add(allProjects);
            }

            return(projects);
        }
        public static JavaList <Projects> SpinnerProjects()
        {
            var      projects    = new JavaList <Projects>();
            Projects allProjects = null;

            projects.Clear();

            DBHelper dbh = new DBHelper();          //db conn
            ICursor  c   = dbh.ReadAllProjects();   //goal list

            while (c.MoveToNext())
            {
                string projectId       = c.GetString(0);
                string project         = c.GetString(1);
                string projectDesc     = c.GetString(2);
                string projectStart    = c.GetString(3);
                string projectDeadline = c.GetString(4);
                string projectBudget   = c.GetString(5);
                string projectStatus   = c.GetString(6);

                allProjects         = new Projects();
                allProjects.Id      = Convert.ToInt32(projectId);
                allProjects.Project = project;
                projects.Add(project);
            }
            return(projects);
        }
 public void Clear()
 {
     try
     {
         mMyFollowersList.Clear();
         NotifyDataSetChanged();
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
Exemple #9
0
 public void Clear()
 {
     try
     {
         mMyContactsList?.Clear();
         NotifyDataSetChanged();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
 public void Clear()
 {
     try
     {
         mMyContactsList?.Clear();
         NotifyDataSetChanged();
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
        private void ReloadData(int startId)
        {
            m_AllTasks.Clear();
            foreach (var task in DataManager.GetTasks(Settings.SortBy))
            {
                m_AllTasks.Add(task);
            }


#if DEBUG
            if (m_AllTasks.Count == 0)
            {
                m_AllTasks = new JavaList <TaskModel>();
                foreach (var item in m_FakeData)
                {
                    var task = new TaskModel {
                        Task = item
                    };
                    task.ID = DataManager.SaveTask(task);
                    m_AllTasks.Add(task);
                }
            }
#endif
            RunOnUiThread(() =>
            {
                ListAdapter = new TaskAdapter(this, m_AllTasks);
                if (ListView.Visibility == ViewStates.Gone)
                {
                    ListView.Visibility = ViewStates.Visible;
                    ListView.StartAnimation(AnimationUtils.LoadAnimation(this, Resource.Animation.fadein));
                }
            });


            SetChecks();

            SetActionBar();

            if (startId == 0)
            {
                return;
            }

            var firstTask = m_AllTasks.FirstOrDefault(t => t.ID == startId);
            if (firstTask == null)
            {
                return;
            }

            var itemIndex = m_AllTasks.IndexOf(firstTask);
            RunOnUiThread(() => ListView.SetSelection(itemIndex));
        }
Exemple #12
0
 private void DisplayListOnUI <T>(IEnumerable <T> list)
 {
     RunOnUiThread(() =>
     {
         _items.Clear();
         _selectionList.Clear();
         foreach (var c in list)
         {
             _selectionList.Add(c);
             _items.Add(c.ToString());
         }
         ((ArrayAdapter)ListAdapter).NotifyDataSetChanged();
     });
 }
Exemple #13
0
        //Spinner List Items
        public static JavaList <ShoppingLists> SpinnerLists()
        {
            var           lists    = new JavaList <ShoppingLists>();
            ShoppingLists allLists = null;

            lists.Clear();

            DBHelper dbh = new DBHelper();                      //db conn
            ICursor  c   = dbh.ReadAllShoppingLists();          //shopping lists

            while (c.MoveToNext())
            {
                string listId = c.GetString(0);
                string title  = c.GetString(1);

                allLists           = new ShoppingLists();
                allLists.Id        = Convert.ToInt32(listId);
                allLists.ListTitle = title;
                lists.Add(title);
            }
            return(lists);
        }
Exemple #14
0
        public void GetSpaceCrafts()
        {
            HouseList.Clear();
            DBAdapter db = new DBAdapter(this);

            db.openDB();
            ICursor c = db.Retrieve();                     //SpaceCraft s = null;

            if (c != null)
            {
                while (c.MoveToNext())
                {
                    string phone = c.GetString(c.GetColumnIndex("name"));
                    HouseList.Add(phone);
                    Collections.Sort(HouseList);
                }
            }
            db.CloseDB();
            if (HouseList.Size() > 0)
            {
                list.Adapter = adapter;
            }
        }
        //Get Project Tasks
        public static JavaList <ProjectTasks> GetProjectTasks(int pId)
        {
            var          tasks    = new JavaList <ProjectTasks>();
            ProjectTasks allTasks = null;

            tasks.Clear();

            DBHelper dbh = new DBHelper();
            ICursor  c   = dbh.ReadAllProjectTasks(pId);

            while (c.MoveToNext())
            {
                string taskId        = c.GetString(0);
                string task          = c.GetString(1);
                string taskProject   = c.GetString(2);
                string taskDesc      = c.GetString(3);
                string taskStart     = c.GetString(4);
                string taskDeadline  = c.GetString(5);
                string taskExpBudget = c.GetString(6);
                string taskActBudget = c.GetString(7);
                string taskStatus    = c.GetString(8);

                allTasks              = new ProjectTasks();
                allTasks.Id           = Convert.ToInt32(taskId);
                allTasks.Task         = task;
                allTasks.Project      = Convert.ToInt32(taskProject);
                allTasks.TaskDesc     = taskDesc;
                allTasks.TaskStart    = taskStart;
                allTasks.TaskDeadline = taskDeadline;
                allTasks.ExpectedCost = Convert.ToDecimal(taskExpBudget);
                allTasks.ActualCost   = Convert.ToDecimal(taskActBudget);
                allTasks.TaskStatus   = taskStatus;
                tasks.Add(allTasks);
            }

            return(tasks);
        }
Exemple #16
0
        //Get All Shopping List Items
        public static JavaList <ShoppingItems> GetShoppingItems(int lId)
        {
            var           items    = new JavaList <ShoppingItems>();
            ShoppingItems allItems = null;

            items.Clear();

            DBHelper dbh = new DBHelper();
            ICursor  c   = dbh.ReadAllShoppingListItems(lId);

            while (c.MoveToNext())
            {
                string itemId       = c.GetString(0);
                string item         = c.GetString(1);
                string list         = c.GetString(2);
                string itemQty      = c.GetString(3);
                string itemMsr      = c.GetString(4);
                string itemExpPrice = c.GetString(5);
                string itemActPrice = c.GetString(6);
                string itemStatus   = c.GetString(7);

                allItems               = new ShoppingItems();
                allItems.Id            = Convert.ToInt32(itemId);
                allItems.Item          = item;
                allItems.List          = Convert.ToInt32(list);
                allItems.ItemQuantity  = Convert.ToDecimal(itemQty);
                allItems.ItemMeasure   = itemMsr;
                allItems.ExpectedPrice = Convert.ToInt32(itemExpPrice);
                allItems.ActualPrice   = Convert.ToInt32(itemActPrice);
                allItems.ItemStatus    = itemStatus;

                items.Add(allItems);
            }

            return(items);
        }
Exemple #17
0
        //retive
        private void Retrieve()
        {
            hk.Clear();
            DBAdapter db = new DBAdapter(this);

            db.OpenDB();
            ICursor c = db.Retrieve();

            if (c != null)
            {
                while (c.MoveToNext())
                {
                    int    id   = c.GetInt(0);
                    string name = c.GetString(1);
                    hk.Add(name);
                }
            }
            else
            {
                Console.Write("Null Retrieved");
            }
            db.CloseDB();
            sp.Adapter = adapter;
        }
Exemple #18
0
        public void SetTabStyle()
        {
            try
            {
                Models.Clear();

                if (Models != null && Models.Count <= 0)
                {
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_tab_home), Color.ParseColor("#ffffff"))
                               .Title(GetText(Resource.String.Lbl_News_Feed)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_action_notification),
                                   Color.ParseColor("#ffffff")).Title(GetText(Resource.String.Lbl_Notifcations)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_action_trending),
                                   Color.ParseColor("#ffffff")).Title(GetText(Resource.String.Lbl_Trending)).Build());
                    Models.Add(new NavigationTabBar.Model.Builder(
                                   ContextCompat.GetDrawable(this, Resource.Drawable.ic_tab_more), Color.ParseColor("#ffffff"))
                               .Title(GetText(Resource.String.Lbl_More)).Build());

                    if (Settings.SetTabColoredTheme)
                    {
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_News_Feed)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Notifcations)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Trending)).Color =
                            Color.ParseColor(Settings.TabColoredColor);
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_More)).Color =
                            Color.ParseColor(Settings.TabColoredColor);

                        navigationTabBar.BgColor       = Color.ParseColor(Settings.MainColor);
                        navigationTabBar.ActiveColor   = Color.White;
                        navigationTabBar.InactiveColor = Color.White;
                    }
                    else if (Settings.SetTabDarkTheme)
                    {
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_News_Feed)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Notifcations)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_Trending)).Color =
                            Color.ParseColor("#444444");
                        Models.First(a => a.Title == GetText(Resource.String.Lbl_More)).Color =
                            Color.ParseColor("#444444");

                        navigationTabBar.BgColor       = Color.ParseColor("#282828");
                        navigationTabBar.ActiveColor   = Color.White;
                        navigationTabBar.InactiveColor = Color.White;
                    }

                    navigationTabBar.Models = Models;
                    navigationTabBar.SetViewPager(viewPager, 0);
                    navigationTabBar.IsScaled         = false;
                    navigationTabBar.IconSizeFraction = (float)0.450;
                    //navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);
                    if (Settings.SetTabIsTitledWithText)
                    {
                        navigationTabBar.SetTitleMode(NavigationTabBar.TitleMode.All);
                        navigationTabBar.IsTitled = true;
                    }

                    if (!Settings.SetTabOnButton)
                    {
                        //var eee = NavigationTabBar.BadgeGravity.TopIndex = 2;
                        // navigationTabBar.SetBadgeGravity( );
                        navigationTabBar.SetBadgePosition(NavigationTabBar.BadgePosition.Center);

                        var parasms = (CoordinatorLayout.LayoutParams)navigationTabBar.LayoutParameters;
                        parasms.Gravity = (int)GravityFlags.Top;

                        // Check if we're running on Android 5.0 or higher
                        if ((int)Build.VERSION.SdkInt < 23)
                        {
                            parasms.TopMargin = 70;
                        }
                        else
                        {
                            parasms.TopMargin = 115;
                        }

                        navigationTabBar.LayoutParameters = parasms;

                        var parasms2 = (CoordinatorLayout.LayoutParams)FloatingActionButton.LayoutParameters;

                        // Check if we're running on Android 5.0 or higher
                        if ((int)Build.VERSION.SdkInt < 23)
                        {
                            parasms2.BottomMargin = 48;
                        }
                        else
                        {
                            parasms2.BottomMargin = 68;
                        }

                        FloatingActionButton.LayoutParameters = parasms2;
                    }
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Exemple #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MeuOrcamento);

            string id = Intent.GetStringExtra("id") ?? "Data not available";


            btnVoltar    = FindViewById <Button>(Resource.Id.btn_voltar);
            btnAdicionar = FindViewById <Button>(Resource.Id.btn_adicionar);
            btnLimpar    = FindViewById <Button>(Resource.Id.btn_limpar);

            txt = FindViewById <TextView>(Resource.Id.lbl_total);

            listaOrcamentos = FindViewById <ListView>(Resource.Id.listaOrcamentos);
            adapter         = new OrcamentoAdapter(this, orcamentos);

            total = 0;

            if (retrieve(id) == 0)
            {
                txt.Text = "Seu orçamento está vazio!";
            }
            else
            {
                txt.Text = "Total = R$" + total.ToString();
            }



            listaOrcamentos.ItemClick += (sender, e) =>
            {
            };

            btnVoltar.Click += (object sender, EventArgs e) =>
            {
                Finish();
            };

            btnAdicionar.Click += (object sender, EventArgs e) =>
            {
                var intent = new Intent(this, typeof(Orcamento));
                intent.PutExtra("id", id);
                StartActivity(intent);
            };

            btnLimpar.Click += (object sender, EventArgs e) =>
            {
                // setar todos as entradas com visivel=false
                MySqlConnection con = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

                try
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                        Console.WriteLine("Conectado com sucesso!");

                        //conexao

                        for (var i = 0; i < orcamentos.Count; i++)
                        {
                            MySqlCommand cmd = new MySqlCommand("UPDATE orcamento SET visivel = false WHERE id = @id", con);
                            cmd.Parameters.AddWithValue("@id", orcamentos[i].Id);
                            cmd.ExecuteNonQuery();
                        }

                        orcamentos.Clear();
                        orcamentosDisplay.Clear();
                        listaOrcamentos.Adapter = null;
                    }
                }
                catch (MySqlException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    con.Close();
                }


                total = 0;

                if (retrieve(id) == 0)
                {
                    txt.Text = "Seu orçamento está vazio!";
                }
                else
                {
                    txt.Text = "Total = R$" + total.ToString();
                }
            };
        }
Exemple #20
0
        public void retrieve()
        {
            if (materiaisDisplay.Size() > 0)
            {
                materiaisDisplay.Clear();
                materiais.Clear();
            }

            MySqlConnection con = new MySqlConnection("Server=mysql873.umbler.com;Port=41890;database=ufscarpds;User Id=ufscarpds;Password=ufscar1993;charset=utf8");

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                    Console.WriteLine("Conectado com sucesso!");

                    MySqlCommand cmd = new MySqlCommand("select id, nome, categoria, descricao, preco, foto from material", con);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        int id = reader.GetOrdinal("id");

                        while (reader.Read())
                        {
                            materiaisDisplay.Add(reader["nome"].ToString());

                            /* Lendo a foto */
                            int    bufferSize = 65535;
                            byte[] ImageData  = new byte[bufferSize];

                            if (reader["foto"] == null)
                            {
                                Console.WriteLine("Não tem foto!!!");
                            }
                            else
                            {
                                Console.WriteLine("Tem foto.");
                            }

                            reader.GetBytes(reader.GetOrdinal("foto"), 0, ImageData, 0, bufferSize);

                            //Console.WriteLine("ImageData: " + Encoding.Default.GetString(ImageData));

                            materiais.Add(new Material()
                            {
                                Id = reader.GetInt32(id), Nome = reader["nome"].ToString(), Categoria = reader["categoria"].ToString(), Descricao = reader["descricao"].ToString(), Preco = reader.GetDouble(4), Foto = ImageData
                            });
                        }
                    }

                    if (materiaisDisplay.Size() > 0)
                    {
                        lista.Adapter = adapter;
                    }
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
 public void Clear()
 {
     mExplosions.Clear();
     Invalidate();
 }
        void Clear()
        {
            messages.Clear();

            adapter.NotifyDataSetChanged();
        }