Esempio n. 1
0
        public static void Show(GridObjects.BaseObject tileType, Window owner)
        {
            ConfigPopup newPopup = new ConfigPopup();

            newPopup.Title = "Configure tile: " + tileType.DisplayName;
            newPopup.Owner = owner;
            newPopup.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            if (!tileType.PopulateFields(ref newPopup.CustomContent))
            {
                return;
            }

            newPopup.KeyDown += (sender, args) =>
            {
                if (args.Key == Key.Escape)
                {
                    newPopup.Close();
                }

                if (args.Key == Key.Enter)
                {
                    tileType.ObtainData();
                    newPopup.Close();
                }
            };

            newPopup.OK.Click += (object sender, RoutedEventArgs e) =>
            {
                tileType.ObtainData();
                newPopup.Close();
            };

            newPopup.Cancel.Click += (object sender, RoutedEventArgs e) =>
            {
                newPopup.Close();
            };
            newPopup.WindowStartupLocation = WindowStartupLocation.Manual;
            newPopup.Left = owner.Left + owner.ActualWidth;
            newPopup.Top  = owner.Top;
            newPopup.ShowDialog();
        }
Esempio n. 2
0
 private void GridButton_OnClick(object sender, RoutedEventArgs e)
 {
     ConfigPopup.Show(DataContext as BaseObject, Window.GetWindow(this) as Window);
 }