public OptionsWindow(ViewModel generatedJsFile)
        {
            _generatedJsFile = generatedJsFile;
            _classes = new ObservableCollection<JsClassViewModel>(generatedJsFile.Classes);

            InitializeComponent();

            this.PreviewKeyDown += OptionsWindow_PreviewKeyDown;
            this.DataContext = generatedJsFile;
            generatedJsFile.Generate();
        }
Example #2
0
 public JsClassViewModel(ViewModel parentViewModel)
 {
     this.ParentViewModel = parentViewModel;
 }
Example #3
0
        public static ViewModel MapViewModelFromJsFile(JsFile jsFile)
        {
            var viewModel = new ViewModel
                {
                    FullPath = jsFile.FullPath,
                    Classes = new ObservableCollection<JsClassViewModel>(),
                    CamelCase = true
                };

            foreach (var file in jsFile.Files)
            {
                var jsClass = new JsClassViewModel(viewModel)
                    {
                        Name = file.Name,
                        Properties = new ObservableCollection<JsPropertyViewModel>(),
                        Ignore = false,
                        Enable = false
                    };

                file.Properties.ForEach(p => jsClass.Properties.Add(new JsPropertyViewModel(jsClass)
                    {
                        Ignore = p.Ignore,
                        Name = p.Name,
                        OfType = p.OfType,
                        IsArray = p.IsArray,
                        IsObservable = p.IsObservable
                    }));

                viewModel.Classes.Add(jsClass);
            }

            return viewModel;
        }
 public JsClassViewModel(ViewModel parentViewModel)
 {
     this.ParentViewModel = parentViewModel;
 }