public static void Popup(string title, string format, params object[] ps)
        {
            string msg = Format(format, ps);

            if (Thread.CurrentThread.ManagedThreadId == MainThreadID)
            {
                PopupImpl?.Invoke(title, msg);
            }
            else
            {
                lock (PopupThreadQueue)
                {
                    PopupThreadQueue.Enqueue(LogPopup.Make(title, msg));
                }
            }
        }
        public ExerciseViewModel(ExerciseModel content = null, string pageType = "Chest")
        {
            Title = content.Name;
            // order it to be up to date using comprator then update
            ExerciseModel pageContent = content;

            pageContent.Data.Sort(SortByDate);

            ObservableCollection <LogModel> loglist = new ObservableCollection <LogModel>();

            foreach (LogModel i in pageContent.Data)
            {
                loglist.Add(i);
            }

            LogList = loglist;

            List <Entry> entries = LoadGraph();

            Chart = new LineChart()
            {
                Entries               = entries,
                MinValue              = 0,
                LineSize              = 6,
                LabelOrientation      = Orientation.Horizontal,
                ValueLabelOrientation = Orientation.Horizontal,
                LineMode              = LineMode.Straight,
                PointMode             = PointMode.Square,
                //LineMode = LineMode.Spline,
                LabelTextSize = 36,
            };

            _popup   = PopupNavigation.Instance;
            _logPage = new LogPopup(pageType, content.Name);
            this.BackButtonCommand = new Command(this.BackButtonClicked);
            this.AddLogCommand     = new Command(this.AddLogClicked);
        }