public MainWindow()
        {
            InitializeComponent();
            // Review TK: Please try to avoid tight coupling.
            generator = new WindowGenerator(this);
            string connectionString = ConfigurationManager.ConnectionStrings["EnglishJediConnection"].ConnectionString;

            try
            {
                _testRepository = new TestRepository(connectionString);
                // Review TK: Please use {} with if statement.
                if (_testRepository == null)
                {
                    throw new NoConnectionToDBException();
                }
                _markRepository = new MarkRepository(connectionString);
                if (_markRepository == null)
                {
                    throw new NoConnectionToDBException();
                }
            }
            catch (NoConnectionToDBException e)
            {
                MessageBox.Show("Lost connection to DB! " + e.Message);
            }
        }
Exemple #2
0
        public static void Execute(ScriptContext scriptContext, Window window)
        {
            var repsts = Helpers.CreateRepStructures(scriptContext.StructureSet);
            var gen    = new WindowGenerator(repsts);

            window.Content = gen.ConstructAndGenerateWindow(scriptContext.StructureSet);
        }
        private void RenameTab()
        {
            Func <string, string> validateFileName = newName => {
                if (string.IsNullOrEmpty(newName))
                {
                    return("Name cannot be left blank.");
                }
                if (newName.Length > 30)
                {
                    return("Name cannot be longer than 30 characters.");
                }

                var notAllowedChars     = Path.GetInvalidFileNameChars();
                var currentInvalidChars = newName.Where(x => notAllowedChars.Contains(x)).Distinct().ToArray();
                if (currentInvalidChars.Length > 0)
                {
                    return($"Name cannot contain {string.Join(" ", currentInvalidChars)}");
                }

                return("");
            };

            RenameViewModel renameVm = null;

            WindowGenerator.CreateAndShowModal(x => renameVm = new RenameViewModel(validateFileName, DocumentVM.FileName.Value, x), false, 100, 350, "#EEEEEE");
            if (string.IsNullOrEmpty(renameVm.ValidationError.Value) && (renameVm.DialogResult ?? false))
            {
                DocumentVM.FileName.Value = renameVm.Name.Value;
            }
        }
Exemple #4
0
 public void LoginGuiTest()
 {
     WpfApprovals.Verify(WindowGenerator.GenerateWindow(new LoginViewModel(this.contextSwitcher.Object, new List <string>()
     {
         "user1", "user2", "user3"
     }), "DartTraining"));
 }
Exemple #5
0
    private void Start()
    {
        numToClean = Random.Range(5, 12);
        player     = GameObject.Find("player");
        sr         = GetComponent <SpriteRenderer>();

        generator       = GameObject.Find("generators");
        windowGenerator = generator.GetComponent <WindowGenerator>();
    }
        public MainWindow()
        {
            InitializeComponent();
            generator = new WindowGenerator(this);
            string connectionString = ConfigurationManager.ConnectionStrings["EnglishJediConnection"].ConnectionString;

            try
            {
                _testRepository = new TestRepository(connectionString);
                if (_testRepository == null)
                {
                    throw new NoConnectionToDBException();
                }
                _markRepository = new MarkRepository(connectionString);
                if (_markRepository == null)
                {
                    throw new NoConnectionToDBException();
                }
            }
            catch (NoConnectionToDBException e)
            {
                MessageBox.Show("Lost connection to DB! " + e.Message);
            }
        }
Exemple #7
0
 public void VerifyMatchConfigView()
 {
     WpfApprovals.Verify(WindowGenerator.GenerateWindow(new MatchConfigViewModel(this.controller.Object), 1024, 768, "DartTraining"));
 }
Exemple #8
0
 public void MenuGuiTest()
 {
     WpfApprovals.Verify(WindowGenerator.GenerateWindow(new MenuViewModel(this.contextSwitcher.Object), "DartTraining"));
 }