示例#1
0
        public static void AttachWidgets(Camera camera)
        {
            if (SelectedObjects.Count == 1)
            {
                var selected = SelectedObjects[0].UserObject as ISelectable;
                if (selected != CurrentSelectedObject)
                {
                    CurrentSelectedObject = selected;

                    // fire an event of selected object being changed
                    SelectedObjectChanged?.Invoke(selected, EventArgs.Empty);
                }

                // attach the widget
                TranslationalWidget.Attach(CurrentSelectedObject as ITranslatable, camera);
            }
            else
            {
                if (SelectedObjects.Count == 0 || !(CurrentSelectedObject is Manipulator))
                {
                    CurrentSelectedObject = null;
                }

                // detach the widget
                TranslationalWidget.Detach();
            }
        }
 /// <summary>
 /// Deselects the simulation's selected object.
 /// </summary>
 public void DeselectObject()
 {
     if (IsObjectSelected)
     {
         SelectedObject.Selected = false;
         SelectedObject          = null;
         IsObjectSelected        = false;
         SelectedObjectChanged?.Invoke(null, new EventArgs());
     }
 }
        /// <summary>
        /// Selects an object in the simulation.
        /// </summary>
        /// <param name="object">Object to select.</param>
        public void SelectObject(ISelectable @object)
        {
            if (@object != SelectedObject)
            {
                DeselectObject();

                @object.Selected = true;
                SelectedObject   = @object;
                IsObjectSelected = true;
                SelectedObjectChanged?.Invoke(SelectedObject, new EventArgs());
            }
        }
 public void SelectObject(CollisionObject selectedObject)
 {
     if (selectedObject == null)
     {
         SelectedObject = null;
         SelectedObjectChanged?.Invoke(this, new SelectEventArgs(SelectedObject));
     }
     else if (selectedObject.UserObject is ObjectBlock)
     {
         SelectedObject = selectedObject;
         SelectedObjectChanged?.Invoke(this,
                                       new SelectEventArgs(SelectedObject));
     }
 }
        protected virtual void OnSelectedObjectChanged(object Value)
        {
            if (Value != null)
            {
                Properties.Reset(Value);

                //IsLoading = true;
                await SetObject(Value);

                IsLoading = false;
            }
            else if (AcceptsNullObjects)
            {
                Properties.Reset(null);
            }

            SelectedObjectChanged?.Invoke(this, new EventArgs <object>(Value));
        }
示例#6
0
 public void SetSelectedObject(object sender, object obj)
 {
     SelectedObjectChanged?.Invoke(sender, obj);
 }
示例#7
0
 /// <summary>
 /// Overridable method to handle selection changing
 /// </summary>
 protected virtual void OnSelectedObjectChanged()
 {
     SelectedObjectChanged?.Invoke(this, new EventArgs());
 }
示例#8
0
 private void selectionBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelectedObject = selectionBox.SelectedItem;
     SelectedObjectChanged?.Invoke(SelectedObject, e);
 }
示例#9
0
 private void UICBTeamMembers_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SelectedObjectChanged?.Invoke(getSelectedObjectName());
 }
示例#10
0
 public static void RequestSelectionChange(Component o)
 {
     SelectedObjectChanged?.Invoke(o);
 }