Beispiel #1
0
 public void PopulateView(FloatingWindow window, SelectionContainer entity, ActionsGraph actionsGraph)
 {
     window.ClearTools();
     foreach (var tool in _tools.Values)
     {
         tool.ViewInfo = ViewInfo;
         if (!tool.AcceptEntity(entity))
         {
             continue;
         }
         window.AddToolsVisualComponent(tool, entity, actionsGraph);
     }
 }
 private void DestroyOldWindow(InteractionContainer entity)
 {
     if (_window == null)
     {
         return;
     }
     if (!IsDifferentEntity(entity == null ? null : entity.Entities[0]))
     {
         return;
     }
     if (_window.IsVisible)
     {
         _window.Close();
     }
     _window = null;
 }
        public void Show(SelectionContainer entity)
        {
            var optionsSetup  = _actionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>();
            var optionSection = optionsSetup.UpdateSectionNode(OptionSectionNames.WelcomePageTitle);

            DestroyOldWindow(entity);

            if (!optionSection.GetBoolValue(1))
            {
                return;
            }

            if (entity == null || entity.Entities.Count == 0)
            {
                return;
            }
            const int deltaX = 16;
            const int deltaY = 16;

            if (IsDifferentEntity(entity.Entities[0]))
            {
                _entity          = entity;
                _window          = new FloatingWindow();
                _window.KeyDown += WindowKeyDown;
                _window.Closed  += WindowClosed;
            }
            var defPnt = new Point();

            GetCursorPos(ref defPnt);

            _window.Left = defPnt.X + deltaX;
            _window.Top  = defPnt.Y + deltaY;
            _factory.PopulateView(_window, _entity, _actionsGraph);
            _window.ShowActivated = false;
            _window.Show();
        }
 private void WindowClosed(object sender, EventArgs e)
 {
     _window = null;
 }