Exemple #1
0
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            NewEditBoxWindow addBlockWindow = new NewEditBoxWindow(config.BlockTemplates.Select(a => a.Name));

            addBlockWindow.SetEdit(((ChallengerLib.Models.Block)((Button)sender).Tag));
            bool?result = addBlockWindow.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                if (addBlockWindow.NewBlock.Value)
                {
                    config.BlockTemplates.Add(addBlockWindow.CreatedBlock);
                }

                EditAllFromGrid(addBlockWindow.CreatedBlock);

                SaveConfiguration();
                LoadSimulationBlocks();
                LoadConfigurationBlocks();
            }
        }
Exemple #2
0
        private void AddBlockButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(config.Name))
            {
                //MessageBox.Show("Configuration name must not be empty.", "Action Not Allowed", MessageBoxButton.OK, MessageBoxImage.Error);
                notifier.ShowError("Configuration name must not be empty.");
                return;
            }

            NewEditBoxWindow addBlockWindow = new NewEditBoxWindow(config.BlockTemplates.Select(a => a.Name).ToList());
            bool?            result         = addBlockWindow.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                previousHeight = config.Height;
                previousWidth  = config.Width;
                config.BlockTemplates.Add(addBlockWindow.CreatedBlock);
                LoadSimulationBlocks();
                SaveConfiguration();
            }
        }
Exemple #3
0
        private void BtnEdit_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            NewEditBoxWindow addBlockWindow = new NewEditBoxWindow(config.BlockTemplates.Select(a => a.Name));

            addBlockWindow.SetEdit(((ChallengerLib.Models.Block)((TextBlock)sender).Tag));
            bool?result = addBlockWindow.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                if (addBlockWindow.NewBlock.Value)
                {
                    config.BlockTemplates.Add(addBlockWindow.CreatedBlock);
                }

                EditAllFromGrid(addBlockWindow.CreatedBlock);

                previousHeight = config.Height;
                previousWidth  = config.Width;

                SaveConfiguration();
                LoadSimulationBlocks();
                LoadConfigurationBlocks();
            }
        }