Esempio n. 1
0
        public MenuItem(string content, Action action, MainWindow mainWindow)
        {
            _action = action;
            InitializeComponent();

            Title.Text = content;
            
            MouseLeftButtonUp += (sender, args) =>
            {
                if (_action != null)
                {
                    mainWindow.Close();
                    _action();
                }
            };

        }
Esempio n. 2
0
        public void ShowMenu()
        {           
            var definition = GetDefinition();

            var window = new MainWindow(definition.Menu);
            window.WindowStyle = WindowStyle.None;

            var location = GetMousePosition();
            window.Left = location.X;
            window.Top = location.Y;

            window.Height = 150;
            window.Width = 300;
            window.ResizeMode = ResizeMode.NoResize;

            window.ShowInTaskbar = false;
            window.ShowActivated = true;

            window.Show();
        }
Esempio n. 3
0
        private void ellipse_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            if (!(sender is Grid))
                return;

            var ellipse = sender as Grid;
            if (!(ellipse.Tag is ClippyTag))
                return;

            var tag = ellipse.Tag as ClippyTag;

            var definition = tag.GetDefinition();

            var window = new MainWindow(definition.Menu);
            window.WindowStyle = WindowStyle.None;

            var location = GetMousePosition();
            window.Left = location.X;
            window.Top = location.Y;

            window.Height = 150;
            window.Width = 300;
            window.ResizeMode = ResizeMode.NoResize;

            window.ShowInTaskbar = false;
            window.ShowActivated = true;

            window.Show();
        }