예제 #1
0
 /// <summary>
 /// Initializer for StartPage, sets main to MainWindow passed in
 /// </summary>
 /// <param name="main"></param>
 public StartPage(MainWindow main)
 {
     try {
         InitializeComponent();
         this.main = main;
         NameInput.Focus();
     } catch (Exception ex) {
         throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                             MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
     }
 }
예제 #2
0
        public RenameForm(string label, string oldName, OkAction ok)
        {
            InitializeComponent();

            Label.Text     = label;
            OnOk           = ok;
            OldName        = oldName;
            NameInput.Text = oldName;

            DataContext = this;
            NameInput.Focus();
        }
예제 #3
0
        //---------------------------------------------------------------------------

        private void OnCreateLevelClicked(object sender, EventArgs e)
        {
            string name = NameInput.Text;

            if (string.IsNullOrWhiteSpace(name))
            {
                MessageBox.Show("Input for Name is not correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                NameInput.Focus();
                return;
            }

            int width = 0;

            if (!int.TryParse(WidthInput.Text, out width) || width < 3)
            {
                MessageBox.Show("Input for Width is not correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                WidthInput.Focus();
                return;
            }

            int height = 0;

            if (!int.TryParse(HeightInput.Text, out height) || height < 3)
            {
                MessageBox.Show("Input for Height is not correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                HeightInput.Focus();
                return;
            }

            int tileWidth = 0;

            if (!int.TryParse(TileWidthInput.Text, out tileWidth) || tileWidth == 0)
            {
                MessageBox.Show("Input for TileWidth is not correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                TileWidthInput.Focus();
                return;
            }

            int tileHeight = 0;

            if (!int.TryParse(TileHeightInput.Text, out tileHeight) || tileHeight == 0)
            {
                MessageBox.Show("Input for TileHeight is not correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                TileHeightInput.Focus();
                return;
            }

            MapManager.Get().Create(name, width, height, tileWidth, tileHeight);
            MapManager.Get().UpdateImage();
            //LevelManager.Get().Create(width, height);
            Close();
        }
예제 #4
0
        private void DetectInput()
        {
            string Name  = NameInput.Text;
            string Value = ValueInput.Text;

            if (Trim)
            {
                Name  = Name.Trim();
                Value = Value.Trim();
            }

            if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Value))
            {
                if (string.IsNullOrEmpty(Name))
                {
                    NameInput.Focus(FocusState.Keyboard);
                }
                else
                {
                    ValueInput.Focus(FocusState.Keyboard);
                }
                return;
            }
            else
            {
                IsPrimaryButtonEnabled
                          = IsSecondaryButtonEnabled
                          = NameInput.IsEnabled
                          = ValueInput.IsEnabled
                          = false
                    ;

                Target.Name  = Name;
                Target.Value = Value;

                this.Canceled = false;
                this.Hide();
            }
        }
예제 #5
0
 void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
 {
     NameInput.Focus();
 }
예제 #6
0
 private void NameInputDialog_ContentRendered(object sender, EventArgs e)
 {
     NameInput.Focus();
 }