Example #1
0
        private void cmdGo_Execute(object argWindow)
        {
            try
            {
                Validate();
            }
            catch (Exception ex)
            {
                DialogCoordinator.Instance.ShowMessageAsync(this, "Ошибка", ex.Message,
                                                            MessageDialogStyle.Affirmative,
                                                            new MetroDialogSettings
                {
                    ColorScheme = MetroDialogColorScheme.Accented
                });
            }

            AddAccounts();
            AddCoffee();
            AddMixes();
            AddPackages();
            AddPacked();
            AddProducts();

            try
            {
                _context.SaveChanges();

                Properties.FirstLaunch = false;
                var window = argWindow as Window;
                window?.Close();
            }
            catch (Exception ex)
            {
                DialogCoordinator.Instance.ShowMessageAsync(this, "Ошибка", ex.Message,
                                                            MessageDialogStyle.Affirmative,
                                                            new MetroDialogSettings
                {
                    ColorScheme = MetroDialogColorScheme.Accented
                });
            }
        }