Example #1
0
        public void CopyFrom(TemplateDialogViewModel template)
        {
            IsInternal = template.IsInternal;

            Platforms   = new CheckListUserControlViewModel <Platform>(template.Platforms.Items.Select(p => new CheckedItemViewModel <Platform>(p.Value, p.IsChecked)), "All Platforms ");
            FormFactors = new CheckListUserControlViewModel <FormFactor>(template.FormFactors.Items.Select(ff => new CheckedItemViewModel <FormFactor>(ff.Value, ff.IsChecked)), "All Form Factors");

            Framework   = template.Framework;
            Name        = template.Name;
            Description = template.Description;

            // Deep copy fields.
            Fields = new ListCollectionView(new ObservableCollection <FieldDialogViewModel>((ObservableCollection <FieldDialogViewModel>)template.Fields.SourceCollection));

            View = T4UserControlViewModel.Create(Kernel, template.View.Buffer, null, null);
            View.PropertyChanged += T4OnPropertyChanged;

            ViewModelCSharp = T4UserControlViewModel.Create(Kernel, template.ViewModelCSharp.Buffer, null, null);
            ViewModelCSharp.PropertyChanged += T4OnPropertyChanged;
            CodeBehindCSharp = T4UserControlViewModel.Create(Kernel, template.CodeBehindCSharp.Buffer, null, null);
            CodeBehindCSharp.PropertyChanged += T4OnPropertyChanged;

            ViewModelVisualBasic = T4UserControlViewModel.Create(Kernel, template.ViewModelVisualBasic.Buffer, null, null);
            ViewModelVisualBasic.PropertyChanged += T4OnPropertyChanged;
            CodeBehindVisualBasic = T4UserControlViewModel.Create(Kernel, template.CodeBehindVisualBasic.Buffer, null, null);
            CodeBehindVisualBasic.PropertyChanged += T4OnPropertyChanged;
        }
Example #2
0
        private void InitEmpty()
        {
            Platforms   = new CheckListUserControlViewModel <Platform>(Enum.GetValues(typeof(Platform)).Cast <Platform>().OrderBy(p => p.ToString().ToLower()).Select(p => new CheckedItemViewModel <Platform>(p, false)), "All Platforms");
            FormFactors = new CheckListUserControlViewModel <FormFactor>(Enum.GetValues(typeof(FormFactor)).Cast <FormFactor>().OrderBy(ff => ff.ToString().ToLower()).Select(ff => new CheckedItemViewModel <FormFactor>(ff, false)), "All Form Factors");

            Fields = new ListCollectionView(new ObservableCollection <FieldDialogViewModel>());

            View = T4UserControlViewModel.Create(Kernel, null, null, null);
            View.PropertyChanged += T4OnPropertyChanged;

            ViewModelCSharp = T4UserControlViewModel.Create(Kernel, null, null, null);
            ViewModelCSharp.PropertyChanged += T4OnPropertyChanged;
            CodeBehindCSharp = T4UserControlViewModel.Create(Kernel, null, null, null);
            CodeBehindCSharp.PropertyChanged += T4OnPropertyChanged;

            ViewModelVisualBasic = T4UserControlViewModel.Create(Kernel, string.Empty, null, null);
            ViewModelVisualBasic.PropertyChanged += T4OnPropertyChanged;
            CodeBehindVisualBasic = T4UserControlViewModel.Create(Kernel, string.Empty, null, null);
            CodeBehindVisualBasic.PropertyChanged += T4OnPropertyChanged;
        }
Example #3
0
        private void InitFrom(Template template)
        {
            IsInternal = template.IsInternal;

            Platforms = new CheckListUserControlViewModel <Platform>(Enum.GetValues(typeof(Platform)).Cast <Platform>().OrderBy(p => p.ToString().ToLower()).Select(p => new CheckedItemViewModel <Platform>(p, template.Platforms.Contains(p))), "All Platforms");

            FormFactors = new CheckListUserControlViewModel <FormFactor>(Enum.GetValues(typeof(FormFactor)).Cast <FormFactor>().OrderBy(ff => ff.ToString().ToLower()).Select(ff => new CheckedItemViewModel <FormFactor>(ff, template.FormFactors.Contains(ff))), "All Form Factors");

            Framework   = template.Framework ?? string.Empty;
            Name        = template.Name ?? string.Empty;
            Description = template.Description ?? string.Empty;

            // Deep copy fields.
            var fieldVms = new ObservableCollection <FieldDialogViewModel>();

            foreach (var f in template.Fields)
            {
                var newFieldVm = Kernel.Get <FieldDialogViewModel>();
                newFieldVm.CopyFrom(f);
                fieldVms.Add(newFieldVm);
            }
            Fields = new ListCollectionView(fieldVms);

            View = T4UserControlViewModel.Create(Kernel, template.View, null, null);
            View.PropertyChanged += T4OnPropertyChanged;

            ViewModelCSharp = T4UserControlViewModel.Create(Kernel, template.ViewModelCSharp, null, null);
            ViewModelCSharp.PropertyChanged += T4OnPropertyChanged;
            CodeBehindCSharp = T4UserControlViewModel.Create(Kernel, template.CodeBehindCSharp, null, null);
            CodeBehindCSharp.PropertyChanged += T4OnPropertyChanged;

            ViewModelVisualBasic = T4UserControlViewModel.Create(Kernel, template.ViewModelVisualBasic, null, null);
            ViewModelVisualBasic.PropertyChanged += T4OnPropertyChanged;
            CodeBehindVisualBasic = T4UserControlViewModel.Create(Kernel, template.CodeBehindVisualBasic, null, null);
            CodeBehindVisualBasic.PropertyChanged += T4OnPropertyChanged;
        }