private async void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; switch (button.Tag) { case "removeAllData": if (await CustomDialog.ShowConfirmDialog("清除所有数据", "此操作将会清楚所有用户数据,您确定要继续吗?") == true) { provider.__DeleteAll(); // Navigate to Welcome Page } break; case "viewCatagories": ShowCatagories(); break; } }
private async void HyperlinkButton_Click(object sender, RoutedEventArgs e) { var button = sender as HyperlinkButton; switch (button.Tag) { case "changeUsername": GetInputUsername(); break; case "changeBudget": GetInputBudget(); break; case "changeRenewDate": GetInputRenewDate(); break; case "changeLanguage": CustomDialog.ShowConfirmDialog("更改语言", "不存在的"); break; case "addCatagory": var dialog = new CustomDialog("添加类别"); var l = await dialog.AddTextInput("类别").AddTwinButtons("确定", "取消").ShowInputDialog(); if (l == null) { break; } var i = l[0] as TextBox; if (i != null) { provider.AddCatagory(i.Text); } break; default: break; } }
public static async Task <int> ShowDetailDataEntry(DataEntry item) { var dialog = new CustomDialog("详细信息"); dialog.AddMessage($"金额: {item.Money}"); dialog.AddMessage($"日期: {item.SpendDate.ToShortDateString()}"); dialog.AddMessage($"类别: {item.Catagory}"); dialog.AddMessage($"备注: {item.Comment}"); dialog.AddTwinButtons("返回", "删除"); var result = await dialog.ShowDialog(); if (result == ContentDialogResult.Primary) { return(0); } if (result == ContentDialogResult.Secondary) { return(1); } return(-1); }