Exemplo n.º 1
0
        private void BindTree(Course course)
        {
            ObservableCollection<CourseTreeViewItem> collection = new ObservableCollection<CourseTreeViewItem>();
            var theories = new CourseTreeViewItem { Items = new ObservableCollection<object>( course.Theories ), ImageUrl = "../Images/book.jpg" ,Title = "Теорія"};
            var tests = new CourseTreeViewItem { Items = new ObservableCollection<object>(course.Tests), ImageUrl = "../Images/pencil.jpg", Title = "Тести" };
            var results = new CourseTreeViewItem {  Items = new ObservableCollection<object>(), ImageUrl = "../Images/trophy.jpg", Title = "Результати" };
            collection.Add(theories);
            collection.Add(tests);
            collection.Add(results);

            tvMain.ItemTemplate = GetTemplate();
            tvMain.ItemsSource = collection;
            tvMain.SelectedItemChanged += tvMain_SelectedItemChanged;
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            var startupPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location).Replace("\\", "/") + "/";
            startupPath += "resources/";
            webBrowser.Navigate(new Uri(startupPath + "welcome.html"));

            string fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location).Replace("\\", "/") + "/";
            absolutePath = fileName + "course-informatics/";
            fileName += "course-informatics/structure.xml";

            try
            {
                course = Serializer.Deserialize<Course>(fileName);
                BindTree(course);

                resultsReady = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new Microsoft.Win32.OpenFileDialog
                          {
                              DefaultExt = ".xml",
                              Filter =
                                  "Educational course structure (.xml)|*.xml",
                              FileName = "structure.xml"
                          };

            bool? result = dlg.ShowDialog();
            if (result == true)
            {
                string fileName = dlg.FileName;
                absolutePath = Path.GetDirectoryName(fileName).Replace("\\","/") + "/";

                try
                {
                    course = Serializer.Deserialize<Course>(fileName);
                    BindTree(course);

                    resultsReady = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }