Beispiel #1
0
        private void DeleteServerMenuUI()
        {
            if (((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.DeleteServerGroup(this.Content.ToString()) != 0)
            {
                return;
            }

            ServerGroupRootPanel sgrp = ((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel);

            sgrp?.DeleteChild(this.Parent as ServerGroupPanel);
        }
Beispiel #2
0
        public ServerMenu()
        {
            InitializeComponent();

            DataContext  = new ServerViewModel();
            panel_server = new ServerGroupRootPanel();
            grid_server.Children.Add(panel_server);

            this.ContextMenu = new ContextMenu();
            MenuItem item;

            item        = new MenuItem();
            item.Click += BtnAddServerMenu_Click;
            item.Header = "Add Server Group";
            item.Icon   = new PackIconMaterial()
            {
                Kind = PackIconMaterialKind.FolderPlus,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };
            this.ContextMenu.Items.Add(item);
        }
Beispiel #3
0
        private void BtnAddServerMenu_Click(object sender, RoutedEventArgs e)
        {
            Window_AddServerMenu wms = new Window_AddServerMenu();
            Point pt = this.PointToScreen(new Point(0, 0));

            wms.Left = pt.X;
            wms.Top  = pt.Y;
            if (wms.ShowDialog() == true)
            {
                string server_menu_name = wms.textBox_name.Text;

                if (((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel)?.ServerViewModel.AddServerGroup(server_menu_name) != 0)
                {
                    return;
                }

                ServerGroupRootPanel sgrp = ((this.Parent as ServerGroupPanel)?.Parent as ServerGroupRootPanel);
                sgrp?.AddChild(new ServerGroupPanel()
                {
                    Content = server_menu_name
                });
            }
        }