Ejemplo n.º 1
0
        private void ChangeType(object p)
        {
            // ToDo: Bad practice to call a view from the viewmodel. Fix using IOC
            var           typeSelectionPopup = new TypeSelectionPopup();
            TypeViewModel typeViewModel      = TypeViewModelLocator.GetTypeVM();

            // Close the type selection box
            typeViewModel.CloseTrigger = false;
            typeViewModel.TypeGroup    = "ControlObject";
            // Filter the type collection on the type group
            typeViewModel.FilterText = typeViewModel.TypeGroup;
            // To have one popup for all type groups (object, template, property etc) the popup is embedded in a dialog
            typeSelectionPopup.ShowDialog();
        }
Ejemplo n.º 2
0
        private void AddComponentExecute(object obj)
        {
            var dlg    = new TypeSelectionPopup(new DefaultTypeProvider());
            var result = dlg.ShowDialog();

            if (result.Value)
            {
                var comp = Helper.CreateComponentFromTypeString(dlg.Result);
                App.DataService.AddComponent(comp);
                var item = new SelectorItemViewModel(comp.UID, comp.Name ?? "{ Leer }");
                Components.Add(item);
                CurrentItem = item;
                Messenger.Default.Send <OpenDetailsMessage>(new OpenDetailsMessage()
                {
                    Uid = item.Uid
                });
            }
        }