示例#1
0
        override protected void OnButtonPressed()
        {
            base.OnButtonPressed();
            CreateWidgetCommand createCommand = new CreateWidgetCommand(
                WidgetManager.m_Instance.VideoWidgetPrefab, TrTransform.FromTransform(transform));

            SketchMemoryScript.m_Instance.PerformAndRecordCommand(createCommand);

            VideoWidget videoWidget = createCommand.Widget as VideoWidget;

            videoWidget.SetVideo(m_Video);
            videoWidget.Show(true);
            createCommand.SetWidgetCost(videoWidget.GetTiltMeterCost());

            WidgetManager.m_Instance.WidgetsDormant = false;
            SketchControlsScript.m_Instance.EatGazeObjectInput();
            SelectionManager.m_Instance.RemoveFromSelection(false);
        }
        override protected void OnButtonPressed()
        {
            if (ReferenceImage == null)
            {
                return;
            }

            if (ReferenceImage.NotLoaded)
            {
                // Load-on-demand.
                ReferenceImage.SynchronousLoad();
            }
            else
            {
                CreateWidgetCommand command = new CreateWidgetCommand(
                    WidgetManager.m_Instance.ImageWidgetPrefab, TrTransform.FromTransform(transform));
                SketchMemoryScript.m_Instance.PerformAndRecordCommand(command);
                ImageWidget widget = command.Widget as ImageWidget;
                widget.ReferenceImage = ReferenceImage;
                SketchControlsScript.m_Instance.EatGazeObjectInput();
                SelectionManager.m_Instance.RemoveFromSelection(false);
            }
        }
示例#3
0
 public void Execute(CreateWidgetCommand command)
 {
     _session.SaveOrUpdate(command);
     _session.Flush();
     _bus.Publish(new WidgetCreatedEvent(command.WidgetId));
 }
示例#4
0
        public ActionResult Create(CreateWidgetCommand createWidgetCommand)
        {
            _bus.Execute<bool>(createWidgetCommand);

            return RedirectToAction("Index", new { id = createWidgetCommand.WidgetId });
        }
示例#5
0
        private IEnumerable <MenuItem> CreateMenuItems(IEnumerable <BuildItem> items)
        {
            // Only ButtonMenuItems are created with the attribute method
            var result = new SortedSet <ButtonMenuItem>(new ButtonMenuItemComparer());

            foreach (var i in items)
            {
                ButtonMenuItem previous = null;

                // there is only one iteration for this item.
                // it wants to be a root element, as it has no path.
                if (i.Path == null || i.Path.Length == 0)
                {
                    var type = i.Value as Type;

                    if (type != null)
                    {
                        var cmd = ToolboxApp.Services.GetService(type) as Command;
                        if (cmd != null)
                        {
                            var btn = new ButtonMenuItem(cmd);
                            result.Add(btn);
                        }
                    }

                    // no items to process; move on.
                    continue;
                }

                // this item will have multiple iterations below; one for each path.
                // Example: paths = "Create", "Layout"
                // i will have been iterated for "Create" and "Layout"
                foreach (var step in i.Path)
                {
                    var            isLastStep = i.Path.Last() == step;
                    ButtonMenuItem current;

                    // First time iteration for path
                    if (previous == null)
                    {
                        // Determine if this is the first iteration, ever.
                        previous = current = result.FirstOrDefault(r => r.Text == step);

                        // first iteration ever
                        if (previous == null)
                        {
                            current = new ButtonMenuItem {
                                Text = step
                            };
                            result.Add(current);
                        }
                    }
                    else
                    {
                        // 2nd+ iteration, check if new menu item
                        current = previous.Items.FirstOrDefault(r => r.Text == step) as ButtonMenuItem;

                        // match not found, this is a new menu item
                        if (current == null)
                        {
                            current = new ButtonMenuItem {
                                Text = step
                            };
                            SortedAdd(previous.Items, current);
                        }
                    }

                    // done with this path
                    if (isLastStep)
                    {
                        var submenu = (ISubmenu)current;
                        var type    = i.Value as Type;
                        var view    = i.Value as ViewRegistration;

                        if (type != null)
                        {
                            var cmd = ToolboxApp.Services.GetService(type) as Command;

                            if (cmd != null)
                            {
                                SortedAdd(submenu.Items, cmd);
                            }
                        }

                        if (view != null)
                        {
                            var cmd = new CreateWidgetCommand(ToolboxApp.Bus, ToolboxApp.SocketManager.Socket, ToolboxApp.Log, view);
                            SortedAdd(submenu.Items, cmd);
                        }
                    }

                    previous = current;
                }
            }

            return(result);
        }
 public async Task <ActionResult <Guid> > Create([FromBody] CreateWidgetCommand request)
 {
     return(await mediator.Send(request));
 }