private void InsertDown_Click(object sender, RoutedEventArgs e) { if (ItemsList.SelectedItem is Item itemData) { if (ItemType.Text == "Standard Item") { ItemWindow itemWindow = new ItemWindow() { SelectedIndex = this.ItemsData.IndexOf(itemData) + 1, ActionData = Actions.InsertDown, UserData = this.UserData, ItemsWindowData = this, ReferencesListData = this.ReferencesListData, }; itemWindow.ShowDialog(); } else { NewItemWindow newItemWindow = new NewItemWindow() { SelectedIndex = this.ItemsData.IndexOf(itemData) + 1, ActionData = Actions.InsertDown, UserData = this.UserData, ItemsWindowData = this, ReferencesListData = this.ReferencesListData, }; newItemWindow.ShowDialog(); } } }
private void AddItem_Click(object sender, RoutedEventArgs e) { if (ItemType.Text == "Standard Item") { ItemWindow itemWindow = new ItemWindow() { SelectedIndex = this.ItemsData.Count, ActionData = Actions.New, UserData = this.UserData, ItemsWindowData = this, ReferencesListData = this.ReferencesListData, }; itemWindow.ShowDialog(); } else { NewItemWindow newItemWindow = new NewItemWindow() { UserData = this.UserData, ActionData = Actions.New, SelectedIndex = this.ItemsData.Count, ItemsWindowData = this, ReferencesListData = this.ReferencesListData, }; newItemWindow.ShowDialog(); } }
private void EditItem_Click(object sender, RoutedEventArgs e) { if (ItemsList.SelectedItem is Item itemData) { if (itemData.Type == ItemTypes.NewItem.ToString()) { NewItemWindow newItemWindow = new NewItemWindow() { ActionData = Actions.Edit, UserData = this.UserData, ItemsWindowData = this, ItemData = itemData, ReferencesListData = this.ReferencesListData, }; newItemWindow.ShowDialog(); } else { ItemWindow itemWindow = new ItemWindow() { ActionData = Actions.Edit, UserData = this.UserData, ItemsWindowData = this, ItemData = itemData, ReferencesListData = this.ReferencesListData, }; itemWindow.ShowDialog(); } } }
private void NewItemCheckBox_Click(object sender, RoutedEventArgs e) { if (ActionData == Actions.Edit) { MessageWindow.Show("Items", "Can't change this Item type!!", MessageWindowButton.OK, MessageWindowImage.Warning); } else { NewItemWindow newItemWindow = new NewItemWindow() { UserData = UserData, ActionData = ActionData, SelectedIndex = SelectedIndex, ItemsWindowData = ItemsWindowData, ReferencesListData = ReferencesListData, }; this.Close(); newItemWindow.ShowDialog(); } }