public DataVisualization() { DataInteractionV2 div2 = new DataInteractionV2(); //Toast.DisplayText(div2.showCurrWeekNum().ToString()); KeyValuePair <string, double>[] show = div2.readWeeklyTagPercentage(DateTime.Now.Year, div2.showCurrWeekNum()); CircleProgressBarSurfaceItem first = new CircleProgressBarSurfaceItem() { Value = 0.5, BarLineWidth = 20, BackgroundLineWidth = 20, BarColor = Color.Crimson, BackgroundColor = Color.Transparent, BarRadius = 60, }; CircleProgressBarSurfaceItem second = new CircleProgressBarSurfaceItem() { Value = show[1].Value, BarLineWidth = 20, BackgroundLineWidth = 20, BarColor = Color.Magenta, BackgroundColor = Color.Transparent, BarRadius = 80, }; CircleSurfaceItems.Add(first); CircleSurfaceItems.Add(second); }
private void getWeek() { DataInteractionV2 div2 = new DataInteractionV2(); //Toast.DisplayText(div2.readWeeklySum(2020, 24).ToString()); //Toast.DisplayText(div2.showCurrWeekNum().ToString()); div2.readWeeklyTagPercentage(2020, 24); //CircleScrollView csv = new CircleScrollView(); //csv.Content = div2.readWeeklyTagPercentage(2020, 25); }
private void deleteClickedFunc(Object sender, EventArgs e) { DataInteractionV2 di = new DataInteractionV2(); Navigation.PopModalAsync(); Navigation.PopModalAsync(); bool succ = di.deleteRec(deleteId); if (succ) { Toast.DisplayIconText("删除记录成功", "Accept.png"); } else { Toast.DisplayIconText("删除记录失败", "cancel.png"); } }
private void submitClickedFunc(Object sender, EventArgs e) { try { amount = System.Convert.ToDouble(pex.Text); } catch (FormatException) { Toast.DisplayIconText("您需要输入一个数字", "warning.png"); Navigation.PopModalAsync(); Navigation.PopModalAsync(); Navigation.PushModalAsync(new AddRecord()); return; } if (isOut == true && amount > 0) { amount = 0 - amount; } //TagProvider tp = new TagProvider(); tagInput = idb.path; descInput = desc.Text; DataInteractionV2 di = new DataInteractionV2(); TwoButtonPopup twoButtonPopup = new TwoButtonPopup(); var confirmButton = new MenuItem() { IconImageSource = new FileImageSource() { File = "Accept.png" }, Command = new Command(() => { if (di.writeRec(descInput, tagInput, amount)) { Toast.DisplayIconText("已成功添加", "Accept.png"); } twoButtonPopup.Dismiss(); pex.Text = "请输入金额"; desc.Text = "输入描述(可选)"; }) }; var cancelButton = new MenuItem() { IconImageSource = new FileImageSource() { File = "cancel.png" }, Command = new Command(() => { twoButtonPopup.Dismiss(); }), }; twoButtonPopup.FirstButton = confirmButton; twoButtonPopup.SecondButton = cancelButton; twoButtonPopup.Title = "提交确认"; twoButtonPopup.Content = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new Xamarin.Forms.Label { Text = "您确定要提交吗?" } } }; inBtn.IsVisible = true; inBtn.BackgroundColor = Color.Green; isOut = false; outBtn.IsVisible = true; outBtn.BackgroundColor = Color.Red; twoButtonPopup.Show(); Navigation.PopModalAsync(); }
public RecordList(DateTime pCurrTime) { String date = pCurrTime.ToString("yyyy-MM-dd"); cCurrTime = pCurrTime; DataInteractionV2 di = new DataInteractionV2(); ArrayList show = di.readRec(date); PrevBtnClicked += prevClickedFunc; NextBtnClicked += nextClickedFunc; prev.Clicked += PrevBtnClicked; next.Clicked += NextBtnClicked; homeBtnClicked += homeClickedFunc; goHome.Clicked += homeBtnClicked; //尚无记录的page //CirclePage noRec = new CirclePage(); //StackLayout noRecLayout = new StackLayout() //{ // Orientation = StackOrientation.Vertical, // VerticalOptions = LayoutOptions.Center, // Children = // { // prev, // new Label(){ Text = pCurrTime.ToString("yyyy-MM-dd").Substring(5), HorizontalTextAlignment = TextAlignment.Center, FontSize=8}, // new Image(){ Source = "Empty.png", Scale = 0.5, HeightRequest=100 }, // new Label(){ Text = "今日尚无记录哦", HorizontalTextAlignment = TextAlignment.Center, FontSize = 5}, // goHome, // next, // } //}; //noRec.Content = noRecLayout; //if (show.Count == 0 || ((ArrayList)show[0]).Count == 0) //{ // Navigation.PushModalAsync(noRec); // return; //} //show.Add(); DataTemplate dt = new DataTemplate(() => { var tagLable = new Label() { FontSize = 12, HorizontalTextAlignment = TextAlignment.Center }; var detailLable = new Label() { FontSize = 9, HorizontalTextAlignment = TextAlignment.Center }; tagLable.SetBinding(Label.TextProperty, "tagDesc"); detailLable.SetBinding(Label.TextProperty, "detailDesc"); StackLayout sl = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Children = { tagLable, detailLable }, }; return(new ViewCell { View = sl }); }); DataTemplate headerTemplate = new DataTemplate(() => { var headLable = new Label() { TextColor = Color.Blue, HorizontalTextAlignment = TextAlignment.Center }; StackLayout sl = new StackLayout() { HorizontalOptions = LayoutOptions.Center, Children = { headLable }, }; return(new ViewCell() { View = sl }); }); var listGroup = new List <TagDescBind>(); ArrayList tagArray; ArrayList descArray; ArrayList detailedDescArray; ArrayList idArray; string head = " " + date.Substring(5); double sum = di.readTodaySum(date); if (show.Count == 0 || ((ArrayList)show[0]).Count == 0) { tagArray = new ArrayList(); descArray = new ArrayList(); detailedDescArray = new ArrayList(); idArray = new ArrayList(); head = head + "日尚无记录。"; } else { tagArray = (ArrayList)show[0]; descArray = (ArrayList)show[1]; detailedDescArray = (ArrayList)show[2]; idArray = (ArrayList)show[3]; if (sum >= 0) { head += ": +" + sum.ToString(); } else { head += ": " + sum.ToString(); } } for (int i = 0; i < tagArray.Count; i++) { listGroup.Add(new TagDescBind() { tagDesc = (string)tagArray[i], detailDesc = (string)descArray[i], descDesc = (string)detailedDescArray[i], id = (int)idArray[i] }); } CircleListView clv = new CircleListView() { ItemsSource = listGroup, Header = head, ItemTemplate = dt }; clv.ItemTapped += showDetails; StackLayout page = new StackLayout() { Children = { prev, clv, next } }; Content = page; }