void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.AddNewItemClassWindow = ((WPFTools.ItemWindows.AddNewItemClass)(target)); #line 4 "..\..\..\..\ItemWindows\AddNewItemClass.xaml" this.AddNewItemClassWindow.Closing += new System.ComponentModel.CancelEventHandler(this.AddNewItemClassWindow_Closing); #line default #line hidden return; case 2: this.NewClassNameBox = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.CancelNewItemClass = ((System.Windows.Controls.Button)(target)); #line 10 "..\..\..\..\ItemWindows\AddNewItemClass.xaml" this.CancelNewItemClass.Click += new System.Windows.RoutedEventHandler(this.CancelNewItemClass_Click); #line default #line hidden return; case 4: this.SaveNewButtonClass = ((System.Windows.Controls.Button)(target)); #line 11 "..\..\..\..\ItemWindows\AddNewItemClass.xaml" this.SaveNewButtonClass.Click += new System.Windows.RoutedEventHandler(this.SaveNewButtonClass_Click); #line default #line hidden return; case 5: this.label5 = ((System.Windows.Controls.Label)(target)); return; case 6: this.label1 = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
private void AddnewItemClassButton_Click(object sender, RoutedEventArgs e) { if (this.Resources.Contains("ItemDB")) { XmlDataProvider dataProv = (XmlDataProvider)this.Resources["ItemDB"]; if (dataProv.Document != null) { try { var allItemClasses = dataProv.Document.DocumentElement.GetElementsByTagName("AllClasses"); if (allItemClasses.Count < 1) { dataProv.Document.DocumentElement.PrependChild(dataProv.Document.CreateElement("AllClasses")); allItemClasses = dataProv.Document.DocumentElement.GetElementsByTagName("AllClasses"); } ItemWindows.AddNewItemClass itemWin = new WPFTools.ItemWindows.AddNewItemClass((XmlElement)allItemClasses[0]); var helper = new WindowInteropHelper(itemWin); helper.Owner = new WindowInteropHelper(this).Handle; bool? res = itemWin.ShowDialog(); } catch(Exception ex) { Console.Out.WriteLine("Exception occured while fetch root item classes. Exception: " + ex.Message); } } } //ItemWindows.AddNewItemClass itemWin = new WPFTools.ItemWindows.AddNewItemClass( /* * NewEnemyWindow eneWindow = new NewEnemyWindow(dataProv.Document, this); var helper = new WindowInteropHelper(eneWindow); helper.Owner = new WindowInteropHelper(this).Handle; bool? res = eneWindow.ShowDialog(); if (res != null && (bool)res) { } else { //MessageBox.Show("Did not add new enemy"); } */ }