/// <summary>
        /// класс конвертации курса 
        /// xslt
        /// </summary>
        /// <param name="_course">представление курса</param>
        /// <param name="_params">xslt параметры</param>
        /// <exception cref="ArgumentNullException"></exception>
        public XSLTConvertView(ICourseViewModel _course,XSLTParamsView _params)
        {
            if (_course == null || _params == null)
                throw new ArgumentNullException();

            course = _course;
            convParams = _params;

            course.CheckedItem += ChangeProperty;
            convParams.Updated += ChangeProperty;
            СonvertCommand = new ConvertCommand(this);
        }
        /// <summary>
        /// класс конвертации курса
        /// xslt
        /// </summary>
        /// <param name="_course">представление курса</param>
        /// <param name="_params">xslt параметры</param>
        /// <exception cref="ArgumentNullException"></exception>
        public XSLTConvertView(ICourseViewModel _course, XSLTParamsView _params)
        {
            if (_course == null || _params == null)
            {
                throw new ArgumentNullException();
            }

            course     = _course;
            convParams = _params;


            course.CheckedItem += ChangeProperty;
            convParams.Updated += ChangeProperty;
            СonvertCommand      = new ConvertCommand(this);
        }
Esempio n. 3
0
        /// <summary>
        /// установить курс
        /// </summary>
        /// <param name="_course">курс</param>
        /// <param name="_absPathToParamsFolder">путь до папки с параметрами</param>
        /// <exception cref="ArgumentNullException"></exception>
        public void SetCourse(ICourseModel _course, string _absPathToParamsFolder)
        {
            if (_course == null || string.IsNullOrEmpty(_absPathToParamsFolder) )
                throw new ArgumentNullException();

            pnlConvParam.IsEnabled = true;

            //XSLTParamFromXML xmlPrm = new XSLTParamFromXML(_absPathToParamsFolder);
            XSLTConvertParams prm = new XSLTConvertParams();
            XSLTParamsView prmv = new XSLTParamsView(prm);
            CourseViewModel ivm = new CourseViewModel(_course);
            XSLTConvertView cv = new XSLTConvertView(ivm, prmv);
            this.DataContext = ivm;
            tree.ItemsSource = ivm.Children;
            convBtn.Command = cv.СonvertCommand;

            Binding bi0 = new Binding();
            bi0.Source = prmv;
            bi0.Path = new PropertyPath("TemplateFilePath");
            bi0.Mode = BindingMode.TwoWay;
            bi0.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

            tbParam.SetBinding(TextBox.TextProperty, bi0);

            Binding bi1 = new Binding();
            bi1.Source = prmv;
            bi1.Path = new PropertyPath("OutputAbsPath");
            bi1.Mode = BindingMode.TwoWay;
            bi1.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            bi1.ValidationRules.Add(new FolderTryValidation());
            tbPath.SetBinding(TextBox.TextProperty, bi1);

            Binding bi2 = new Binding();
            bi2.Source = prmv;
            bi2.Path = new PropertyPath("IsToScorm");
            bi2.Mode = BindingMode.TwoWay;
            bi2.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            IsScorm.SetBinding(CheckBox.IsCheckedProperty, bi2);
               // Binding bi = new Binding();
              //  bi.Source = _course.Items;
            // bi.Path = new PropertyPath("Sections");
            //  bi.Mode = BindingMode.TwoWay;
            // bi.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            //tvCourse.SetBinding(TreeView.ItemsSourceProperty, bi);
            base.CommandBindings.Add(
               new CommandBinding(
                   ApplicationCommands.Undo,
                   (sender, e) => // Execute
                   {
                       e.Handled = true;
                       ivm.IsChecked = false;
                       this.tree.Focus();
                   },
                   (sender, e) => // CanExecute
                   {
                       e.Handled = true;
                       e.CanExecute = (ivm.IsChecked != false);
                   }));

            base.CommandBindings.Add(
              new CommandBinding(
                  ApplicationCommands.Redo,
                  (sender, e) => // Execute
                  {
                      e.Handled = true;
                      ivm.IsChecked = true;
                      this.tree.Focus();
                  },
                  (sender, e) => // CanExecute
                  {
                      e.Handled = true;
                      e.CanExecute = (ivm.IsChecked != true);
                  }));

            this.tree.Focus();
        }