Esempio n. 1
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button != null)
            {
                var category = button.DataContext as Category;
                if (category != null)
                {
                    VibrationDeviceHelper.Vibrate(TimeSpan.FromMilliseconds(150));

                    var caption = AppResources.ContinueQuestion;
                    var message = string.Format(AppResources.DeleteCategoryMessage, category.Caption);

                    if (MessageBox.Show(message, caption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        if (this.ViewModel.Delete(category))
                        {
                            RaiseEventsManager.RaiseRefreshMainScreen();
                        }
                    }
                }
            }

            this.Focus();
        }
Esempio n. 2
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button != null)
            {
                var op = button.DataContext as IOperation;
                if (op != null)
                {
                    VibrationDeviceHelper.Vibrate(TimeSpan.FromMilliseconds(150));

                    string caption = AppResources.ContinueQuestion;
                    string message = string.Format(AppResources.DeleteOperationMessage, op.Caption, op.Value);

                    if (MessageBox.Show(message, caption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        string tag = button.Tag as string;

                        if (tag == "Credit")
                        {
                            this.ViewModel.CreditsViewModel.Delete((Credit)op);
                        }

                        if (tag == "Debit")
                        {
                            this.ViewModel.DebitsViewModel.Delete((Debit)op);
                        }

                        this.ViewModel.LoadData();
                    }
                }
            }

            this.Focus();
        }
Esempio n. 3
0
        private void Purge_Click(object sender, RoutedEventArgs e)
        {
            string caption = AppResources.ContinueQuestion;
            string message = AppResources.PurgeMessage;

            VibrationDeviceHelper.Vibrate(TimeSpan.FromMilliseconds(500));

            if (MessageBox.Show(message, caption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                this.ViewModel.Purge();

                RaiseEventsManager.RaiseRefreshMainScreen();

                if (base.NavigationService.CanGoBack)
                {
                    base.NavigationService.GoBack();
                }
            }
        }