private void MItemNew_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog() { Title = "选择地图背景图", Filter = "图像文件(*.jpg,*.png)|*.jpg;*.png", RestoreDirectory = true, //保存对话框是否记忆上次打开的目录 CheckPathExists = true, //检查目录 }; bool?ok = dialog.ShowDialog(); if (ok == false) { return; } // 使用一张图片来新建项目 NewProject(dialog.FileNames[0]); // 设置参数 OptionWindow optionWindow = new OptionWindow(); optionWindow.ShowDialog(); // 创建地图 CreateMap(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.OptWnd = ((MapEditor.OptionWindow)(target)); #line 9 "..\..\..\Window\OptionWindow.xaml" this.OptWnd.Loaded += new System.Windows.RoutedEventHandler(this.OptWnd_Loaded); #line default #line hidden return; case 2: this.TxtWidth = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.TxtHeight = ((System.Windows.Controls.TextBox)(target)); return; case 4: this.TxtCellSize = ((System.Windows.Controls.TextBox)(target)); #line 18 "..\..\..\Window\OptionWindow.xaml" this.TxtCellSize.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TextChanged); #line default #line hidden return; case 5: this.BtnOk = ((System.Windows.Controls.Button)(target)); #line 20 "..\..\..\Window\OptionWindow.xaml" this.BtnOk.Click += new System.Windows.RoutedEventHandler(this.BtnOk_Click); #line default #line hidden return; case 6: this.CbxScale = ((System.Windows.Controls.ComboBox)(target)); return; case 7: this.TxtName = ((System.Windows.Controls.TextBox)(target)); #line 32 "..\..\..\Window\OptionWindow.xaml" this.TxtName.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TextChanged); #line default #line hidden return; } this._contentLoaded = true; }
private void MItemOpt_Click(object sender, RoutedEventArgs e) { if (MapHandle.Instance.ProjData == null) { return; } OptionWindow window = new OptionWindow(); window.ShowDialog(); if (OptionWindow.changed) { CreateMap(); } }