private void ChangeApplicationBarButton(ApplicationBarConstant flag) { this.ApplicationBar.Buttons.Clear(); ApplicationBarIconButton btn = new ApplicationBarIconButton(); btn.IsEnabled = true; if (flag == ApplicationBarConstant.Add) { btn.IconUri = new Uri("/Images/add.png", UriKind.Relative); btn.Text = AppResources.New; btn.Click += CreateItem_Click; this.ApplicationBar.Buttons.Add(btn); RemoveSecondButton(); } else if (flag == ApplicationBarConstant.Done) { btn.IconUri = new Uri("/Images/done.png", UriKind.Relative); btn.Text = AppResources.Done; btn.Click += DoneItem_Click; ApplicationBarIconButton cancel = new ApplicationBarIconButton(); cancel.IconUri = new Uri("/Images/cancel.png", UriKind.Relative); cancel.Text = AppResources.Cancel; this.ApplicationBar.Buttons.Add(btn); this.ApplicationBar.Buttons.Add(cancel); cancel.Click += delegate(object sender, EventArgs e) { PopupWindow.HideWindow(true); }; } else if (flag == ApplicationBarConstant.Clean) // Completed items delete { btn.IconUri = new Uri("/Images/delete.png", UriKind.Relative); btn.Text = AppResources.Clean; btn.Click += CleanItem_Click; this.ApplicationBar.Buttons.Add(btn); RemoveSecondButton(); if (App.ViewModel.CompletedToDoItems == null || App.ViewModel.CompletedToDoItems.Count == 0) { btn.IsEnabled = false; } } currentAppBarFlag = flag; }
private void DoneItem_Click(object sender, EventArgs e) { PopupWindow.HideWindow(); }