private void EmbContextMenu_UsedBy_Click(object sender, RoutedEventArgs e) { try { if (!IsForContainer) { MessageBox.Show("Used By not available for non-container EMBs.", "Used By", MessageBoxButton.OK, MessageBoxImage.Error); return; } var texture = listBox_Textures.SelectedItem as EmbEntry; if (texture != null) { List <string> assets = container.TextureUsedBy(texture); assets.Sort(); StringBuilder str = new StringBuilder(); foreach (var asset in assets) { str.Append(String.Format("{0}\r", asset)); } LogForm logForm = new LogForm(String.Format("The following {0} assets use this texture:", AssetTypeWildcard), str.ToString(), String.Format("{0}: Used By", texture.Name), this, true); logForm.Show(); } } catch (Exception ex) { parent.SaveExceptionLog(ex.ToString()); MessageBox.Show(String.Format("An error occured.\n\nDetails: {0}\n\nA log containing more details about the error was saved at \"{1}\".", ex.Message, SettingsManager.Instance.GetErrorLogPath()), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void ContextMenu_UsedBy_Click(object sender, RoutedEventArgs e) { var material = dataGrid.SelectedItem as Material; if (material != null) { List <string> assets = container.MaterialUsedBy(material); assets.Sort(); StringBuilder str = new StringBuilder(); foreach (var asset in assets) { str.Append(String.Format("{0}\r", asset)); } LogForm logForm = new LogForm(String.Format("The following {0} assets use this material:", AssetTypeWildcard), str.ToString(), String.Format("{0}: Used By", material.Str_00), this, true); logForm.Show(); } }
private void Done_Click(object sender, RoutedEventArgs e) { var selectedEffects = GetSelectedEffects(); if (selectedEffects.Count > 0) { if (currentMode == Mode.ImportEffect) { bool wasError = false; StringBuilder str = new StringBuilder(); foreach (var effect in selectedEffects) { if (MainContainerFile.IsEffectIdUsed(effect.ImportIdIncrease)) { wasError = true; str.Append(String.Format("Effect ID: {0} > New ID: {1}\r", effect.IndexNum, effect.ImportIdIncrease)); } } if (wasError) { LogForm log = new LogForm("The following effect IDs are conflicting.\nPlease change them to be unique.", str.ToString(), "ID Conflict", this, true); log.Show(); } else { SelectedEffects = selectedEffects; Close(); } } else { SelectedEffects = selectedEffects; Close(); } } }