Ejemplo n.º 1
0
 public virtual void OptionClicked()
 {
     if (TypedItemViewModel.IsEditable)
     {
         TypedItemViewModel.EndEditing();
     }
     TypedItemViewModel.Select();
     TypedItemViewModel.ShowSelectionListWindow();
 }
Ejemplo n.º 2
0
        public void Execute(SelectTypeCommand command)
        {
            var menu = new SelectionMenu();

            if (command.AllowNoneType)
            {
                menu.AddItem(new SelectionMenuItem("", "None", () =>
                {
                    command.Item.RelatedType = null;
                }));
            }

            // var types = GetRelatedTypes(command).ToArray();
            foreach (var item in GetRelatedTypes(command))
            {
                var type1 = item;
                if (command.Filter == null || command.Filter(item))
                {
                    menu.AddItem(new SelectionMenuItem(item.Group, TypedItemViewModel.TypeAlias(item.TypeName), () =>
                    {
                        var record = type1 as IDataRecord;
                        if (record != null)
                        {
                            command.Item.RelatedType = record.Identifier;
                        }
                        else
                        {
                            // TODO: Change RelatedType from FullName to TypeName, not sure if there is any bug
                            command.Item.RelatedType = type1.TypeName;//type1.FullName;
                        }

                        if (command.OnSelectionFinished != null)
                        {
                            command.OnSelectionFinished();
                        }
                    }));
                }
            }

            if (!command.AllowNoneType)
            {
                menu.OnCancel = () => {
                    if (String.IsNullOrEmpty(command.Item.RelatedType))
                    {
                        command.Item.Node.Repository.Remove(command.Item);
                    }
                };
            }

            Signal <IShowSelectionMenu>(_ => _.ShowSelectionMenu(menu));
        }
Ejemplo n.º 3
0
 public TypedItemDrawer(TypedItemViewModel viewModel)
 {
     ViewModelObject = viewModel;
 }
Ejemplo n.º 4
0
 public TypedItemDrawer(TypedItemViewModel viewModel)
 {
     ViewModelObject = viewModel;
 }