Exemplo n.º 1
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var errors = ViewModel.Validate();
                if (!errors.Any())
                {
                    using (new SpinnyCursor())
                    {
                        ViewModel.Save();
                    }
                }
                else
                {
                    errors.Insert(0, "Could not save:");
                    MessageBox.Show(string.Join(Environment.NewLine, errors));
                }
            }
            catch (Exception ex)
            {
                string message = (ex is DbEntityValidationException)
                    ? ((DbEntityValidationException)ex).EntityValidationErrors.First().ValidationErrors.First().ErrorMessage
                    : ex.Message;

                MessageBox.Show("Something went wrong  - data not saved (" + message + ")");

                var trelloKey     = ConfigurationManager.AppSettings["TrelloKey"];
                var trelloAuthKey = ConfigurationManager.AppSettings["TrelloAuthKey"];
                var logger        = new TrelloLogger(trelloKey, trelloAuthKey);
                logger.Error("MSOWeb", message, ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        public void TrelloLogger_Works()
        {
            var key = ConfigurationManager.AppSettings["TrelloKey"];
            var auth = ConfigurationManager.AppSettings["TrelloAuthKey"];
            var logger = new TrelloLogger(key, auth);

            logger.Error("Test", "Test message", "Test description");
            // Need to check Trello now!
        }
Exemplo n.º 3
0
        public ErrorDialog(Exception ex) : this()
        {
            this.textBox.Text = "";
            var thisEx = ex;

            while (thisEx != null)
            {
                this.textBox.Text = thisEx.Message + Environment.NewLine + thisEx.StackTrace + Environment.NewLine;
                thisEx            = thisEx.InnerException;
            }
            var trelloKey     = ConfigurationManager.AppSettings["TrelloKey"];
            var trelloAuthKey = ConfigurationManager.AppSettings["TrelloAuthKey"];

            var logger = new TrelloLogger(trelloKey, trelloAuthKey);

            logger.Error("MSOWeb", ex.Message, ex.StackTrace);
        }
Exemplo n.º 4
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            // TODO DI the relevant bits into vm and call methods there
            CalculateRanks();
            CalculatePentamindPoints();

            try
            {
                if (ViewModel.EditingThePast)
                {
                    if (MessageBox.Show("You are editing data for a past Olympiad. Are you sure this is right?",
                                        "MSOOrganiser", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No)
                        == MessageBoxResult.No)
                    {
                        return;
                    }
                }
                var errors = ViewModel.Validate();
                if (!errors.Any())
                {
                    using (new SpinnyCursor())
                    {
                        ViewModel.Save();
                    }
                }
                else
                {
                    errors.Insert(0, "Could not save:");
                    MessageBox.Show(string.Join(Environment.NewLine, errors));
                }
            }
            catch (Exception ex)
            {
                string message = (ex is DbEntityValidationException)
                    ? ((DbEntityValidationException)ex).EntityValidationErrors.First().ValidationErrors.First().ErrorMessage
                    : ex.Message;

                MessageBox.Show("Something went wrong  - data not saved (" + message + ")");

                var trelloKey     = ConfigurationManager.AppSettings["TrelloKey"];
                var trelloAuthKey = ConfigurationManager.AppSettings["TrelloAuthKey"];
                var logger        = new TrelloLogger(trelloKey, trelloAuthKey);
                logger.Error("MSOWeb", message, ex.StackTrace);
            }
        }