コード例 #1
0
 // hijacking this for an easy resize dialog
 public NewMapDialog(Map oldMap)
 {
     this.InitializeComponent();
     this.SaveButton.Content = "Resize";
     this.Title = "Resize";
     this.resize = true;
     this.OutputMap = oldMap;
     this.mapWidth.Text = oldMap.Width.ToString();
     this.mapHeight.Text = oldMap.Height.ToString();
     this.SaveButton.Click += new RoutedEventHandler(SaveButton_Click);
     this.CancelButton.Click += new RoutedEventHandler(CancelButton_Click);
 }
コード例 #2
0
        void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            int width = int.Parse(this.mapWidth.Text);
            int height = int.Parse(this.mapHeight.Text);

            if (this.resize)
            {
                this.OutputMap.ResizeTo(width, height);
            }
            else
            {
                this.OutputMap = new Map(width, height);
            }
            this.Close();
        }
コード例 #3
0
        void file_open_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog();
            dialog.InitialDirectory = LevelsDirectory;
            dialog.ShowDialog();
            string filename = dialog.FileName;

            try
            {
                this.activeMap = new Map(filename);
                this.activeMap.FillGrids(
                    this.ArtBoard_Front,
                    this.ArtBoard_Middle,
                    this.ArtBoard_Back);
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Invalid file");
            }
            this.RefreshBackground();
        }
コード例 #4
0
        void file_new_Click(object sender, RoutedEventArgs e)
        {
            NewMapDialog dialog = new NewMapDialog();
            dialog.ShowDialog();
            if (dialog.OutputMap != null)
            {
                this.activeMap = dialog.OutputMap;

                this.ArtBoard_Back.Children.Clear();
                this.ArtBoard_Middle.Children.Clear();
                this.ArtBoard_Front.Children.Clear();

                this.activeMap.FillGrids(
                    this.ArtBoard_Front,
                    this.ArtBoard_Middle,
                    this.ArtBoard_Back);

                this.RefreshBackground();
            }
        }