public AddManifTypeView() { InitializeComponent(); Editing = false; DataContext = new ManifestationType(); descriptionInput.Focus(); }
public AddManifestTypeDialog() { InitializeComponent(); manifestationType = new ManifestationType(); this.DataContext = manifestationType; }
public ChangeManifestTypeDialog(int index) { InitializeComponent(); pos = index; selectedManifestationType = MainWindow.ManifestTypes.ElementAt(index); this.DataContext = this; }
public AddManifTypeView(MainWindow parent, bool editMode) { InitializeComponent(); mainWindow = parent; Editing = editMode; DataContext = new ManifestationType(); descriptionInput.Focus(); }
Manifestation(ManifestationType t, int numD, int numN, double dv, int aC, int sC, int tm) { Type = t; NumDreams = numD; NumNightmares = numN; DvModifier = dv; AdonisChance = aC; ShadowChance = sC; TierModifier = tm; }
public AddType() { InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; type = new ManifestationType(); DataContext = type; idError = false; nameError = false; iconPathError = false; descriptionError = false; }
public EditType(string typeId) { InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; oldId = typeId; type = new ManifestationType(Database.GetType(typeId)); DataContext = type; idError = false; nameError = false; iconPathError = false; descriptionError = false; }
private void SearchManifTypes() { string target = SearchInput.Text; int numberOfFound = 0; for (int i = 0; i < ManifestationTypesTable.Items.Count; i++) { DataGridRow row = (DataGridRow)ManifestationTypesTable.ItemContainerGenerator.ContainerFromIndex(i); if (row != null) { int index = row.GetIndex(); ManifestationType type = row.DataContext as ManifestationType; if (type.Id.Contains(target)) { numberOfFound = numberOfFound + 1; SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(100, 255, 104, 0)); row.Background = brush; } else if (type.Name.Contains(target)) { numberOfFound = numberOfFound + 1; SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(100, 255, 104, 0)); row.Background = brush; } else { SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); row.Background = brush; } } } if (numberOfFound == 0) { searchMessage.Content = "Nothing found with search!"; searchMessage.Foreground = Brushes.Red; } else { searchMessage.Content = ""; } }
private void addTypeBtnClicked(object sender, RoutedEventArgs e) { bool isAutoChecked = autoGenerateId.IsChecked.Value; string typeName = nameInput.Text; string desc = descriptionInput.Text; string iconPath = textBoxIconPath.Text; Repository rep = Repository.GetInstance(); string id; if (!Editing) { idInput.GetBindingExpression(TextBox.TextProperty).UpdateSource(); } nameInput.GetBindingExpression(TextBox.TextProperty).UpdateSource(); descriptionInput.GetBindingExpression(TextBox.TextProperty).UpdateSource(); textBoxIconPath.GetBindingExpression(TextBox.TextProperty).UpdateSource(); if (isAutoChecked && !Editing) { id = $"type{Repository.GetInstance().ManifestationTypeCounter + 1}"; while (rep.FindManifestationType(id) != null) { Repository.GetInstance().ManifestationTypeCounter = Repository.GetInstance().ManifestationTypeCounter + 1; id = $"type{Repository.GetInstance().ManifestationTypeCounter + 1}"; } } else { id = idInput.Text; } if (id == "" || (rep.FindManifestationType(id) != null && !Editing) || typeName == "" || desc == "" || iconPath == "") { AddedTypeMessage.Content = "Manifestation type has not been added successfully."; AddedTypeMessage.Foreground = Brushes.Red; } else { ManifestationType newType = new ManifestationType() { Id = id, Name = typeName, Description = desc, IconPath = iconPath, }; if (!Editing) { rep.AddManifestationType(newType); AddedTypeMessage.Content = $"Successfully added manifestation type: {newType.Id}"; AddedTypeMessage.Foreground = Brushes.Green; nameInput.Text = ""; descriptionInput.Text = ""; textBoxIconPath.Text = ""; if (isAutoChecked) { Repository.GetInstance().ManifestationTypeCounter = Repository.GetInstance().ManifestationTypeCounter + 1; idInput.Text = $"type{Repository.GetInstance().ManifestationTypeCounter + 1}"; while (Repository.GetInstance().FindManifestationType(idInput.Text) != null) { Repository.GetInstance().ManifestationTypeCounter = Repository.GetInstance().ManifestationTypeCounter + 1; idInput.Text = $"type{Repository.GetInstance().ManifestationTypeCounter + 1}"; } nameInput.Focus(); } else { idInput.Text = ""; idInput.Focus(); } } else { rep.UpdateManifestationType(newType); ManifestationTypesView types = new ManifestationTypesView(mainWindow); types.scrollTo(newType.Id); mainWindow.MainContent.Content = types; } } }
public DeleteType(ManifestationType SelectedType) { InitializeComponent(); this.SelectedType = SelectedType; WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; }