public void CloseWindow()
 {
     if (_win != null)
     {
         _win.Close();
     }
     else
     {
         throw new Exception("Win was nothing!!!");
     }
 }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            _items = GetItems();

            foreach (var item in _items)
            {
                AddItemToGrid(item, Button_Click_AddContext);
            }

            AddItemToGrid(new ContextItem {
                KeyPath = "Add all to context menu"
            }, (_, _) =>
            {
                AddAllMenus();
            });

            AddItemToGrid(new ContextItem {
                KeyPath = "Remove all from context menu"
            }, (_, _) =>
            {
                RemoveAllChanges();
            });

            AddItemToGrid(new ContextItem {
                KeyPath = "Exit"
            }, (_, _) =>
            {
                AppWindow.Close();
            });

            if (!CheckAdminRights())
            {
                MessageBox.Show("not admin");
                //IsAdminText.Visibility = Visibility.Visible;
            }
        }
Exemplo n.º 3
0
 // Sample event handler:
 private void CloseButtonClick(object sender, RoutedEventArgs e)
 {
     AppWindow.Close();
 }