Example #1
0
        void AddSourceBtn_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFile = new System.Windows.Forms.OpenFileDialog();
            if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                mainController.AddController(openFile.FileName);

                int         key       = 0;
                SourceField newSource = new SourceField();
                if (sources.Count != 0)
                {
                    key = keys[keys.Count - 1];
                    while (keys.IndexOf(key) != -1)
                    {
                        key++;
                    }
                    keys.Add(++key);
                }
                else
                {
                    keys.Add(key);
                }
                sources.Add(key, newSource);
                newSource.Key         = key;
                newSource.Path        = openFile.FileName;
                newSource.KeyChanged += OnSourceKeyChanged;
                SourceStack.Children.Add(newSource);
                if (SourceAdded != null)
                {
                    SourceAdded(newSource, new EventArgs());
                }
            }
        }
Example #2
0
        static void Main()
        {
            bool student = false;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Form AppView = null;

            if (student)
            {
                StartView view = new StartView();
                ShowStartController controller = new ShowStartController(view);

                AppView = view;
            }
            else
            {
                MainView view = new MainView();
                MainController maincontroller = new MainController(view);

                ListQuestionView viewQuestion = new ListQuestionView();
                ListQuestionController questionController = new ListQuestionController(viewQuestion);
                maincontroller.AddController(questionController);

                ListQuestionListView viewQuestionList = new ListQuestionListView();
                ListQuestionListController listQuestionListController = new ListQuestionListController(viewQuestionList);
                maincontroller.AddController(listQuestionListController);

                listQuestionListController.SelectedListChanged += questionController.LoadList;
                listQuestionListController.Load();

                AppView = view;
            }

            Application.Run(AppView);
        }