示例#1
0
        /** This function creates objects and calls their methods. First the security methods are called and if they return false call the points updating
         * methods
         */
        private async void AddPointsClicked(object sender, EventArgs e)
        {
            SecurityMethods checks = new SecurityMethods();
            Task <bool>     myTask = checks.DayLimitLock();
            await           myTask;

            Task <bool> myTaskTwo = checks.TimeLimitLock();
            await       myTaskTwo;

            if (myTask.Result)
            {
                await DisplayAlert("Daily Limit Reached", "You can only log 15 Actions per day.", "OK");

                await Navigation.PushAsync(new MainMenu());
            }
            else if (myTaskTwo.Result)
            {
                await DisplayAlert("Too soon", "You must wait 1 minute before logging the next Action.", "OK");

                await Navigation.PushAsync(new MainMenu());
            }
            else
            {
                PointsUpdate helper = new PointsUpdate();
                helper.UpdateBySixPoints();
                ShoppingPointsUpdate helper2 = new ShoppingPointsUpdate();
                helper2.ReBattereisPoints();
                await DisplayAlert("Points Added", AppConstants.sixPointsMsg, "OK");

                await Navigation.PushAsync(new MainMenu());
            }
        }
示例#2
0
        public Point LoadPoint(int idPoint)
        {
            List <Point> children;
            Point        current = null;

            int[] path = GetPathReversed(idPoint);
            if (path.Length == 0)
            {
                return(null);
            }
            foreach (int p in path)
            {
                current = GetPoint(p);
                if (current == null)
                {
                    return(null);
                }
                else
                {
                    if (!current.Loaded)
                    {
                        children = current.Children;
                        PointsUpdate?.Invoke(new PointEventArgs()
                        {
                            ParentPoint = current, Points = children
                        });
                    }
                }
            }
            return(current);
        }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     pointsUpdate   = FindObjectOfType <PointsUpdate>();
     CardsContainer = GameObject.Find("CardsContainer");
     GameContainer  = GameObject.Find("GameContainer");
     playCards();
 }
示例#4
0
        private void LoadChildren(Point point)
        {
            List <Point> children;

            children = point.Children;
            PointsUpdate?.Invoke(new PointEventArgs()
            {
                ParentPoint = point, Points = children
            });
            foreach (Point c in children)
            {
                LoadChildren(c);
            }
        }
示例#5
0
        public List <Point> Search(string searchString)
        {
            List <Point> children;
            List <Point> result = new List <Point>();
            Point        current;
            string       sql = string.Format(@"
select id_point from points where pointname like '%{0}%'
and dbo.treerootid(id_point) in ({1})",
                                             searchString, string.Join(",", roots.Select(r => r.ID.ToString())));
            DataTable found = m.GetData(sql, 60);

            foreach (DataRow row in found.Rows)
            {
                current = this.GetPoint((int)row[0]);
                if (current == null)
                {
                    int[] path = GetPathReversed((int)row[0]);
                    foreach (int id in path)
                    {
                        current = this.GetPoint(id);
                        if (current == null)
                        {
                            break;
                        }
                        if (!current.Loaded)
                        {
                            children = current.Children;
                            PointsUpdate?.Invoke(new PointEventArgs()
                            {
                                Points = children, ParentPoint = current
                            });
                        }
                    }
                }
                if (current?.ID == (int)row[0])
                {
                    result.Add(current);
                }
            }
            return(result);
        }