private void BackButton_Click(object sender, RoutedEventArgs e) { if (CreateModpack != null) { CreateModpack.Invoke(this, null); } }
private void CreateModpackButton_Click(object sender, RoutedEventArgs e) { if (ModPackName.Text.Equals(string.Empty)) { if (FlexibleMessageBox.Show(null, UIMessages.DefaultModPackNameMessage, UIMessages.NoNameFoundTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { ModPackName.Text = "ModPack"; } else { return; } } char[] invalidChars = { '/', '\\', ':', '*', '?', '"', '<', '>', '|' }; if (ModPackName.Text.IndexOfAny(invalidChars) >= 0) { if (FlexibleMessageBox.Show(null, UIMessages.InvalidCharacterModpackNameMessage, UIMessages.InvalidCharacterModpackNameTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { return; } } string verString = ModPackVersion.Text.Replace("_", "0"); // Replace commas with periods for different culture formats such as FR if (verString.Contains(",")) { verString = verString.Replace(",", "."); } Version versionNumber = Version.Parse(verString); if (versionNumber.ToString().Equals("0.0.0")) { if (FlexibleMessageBox.Show(null, UIMessages.DefaultModPackVersionMessage, UIMessages.NoVersionFoundTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { versionNumber = new Version(1, 0, 0); } else { return; } } if (ModPackAuthor.Text.Equals(string.Empty)) { if (FlexibleMessageBox.Show(null, UIMessages.DefaultModPackAuthorMessage, UIMessages.NoAuthorFoundTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { ModPackAuthor.Text = "TexTools User"; } else { return; } } if (!String.IsNullOrWhiteSpace(ModPackUrl.Text)) { var url = IOUtil.ValidateUrl(ModPackUrl.Text); if (url != null) { ModPackUrl.Text = url; } else { ModPackUrl.Text = ""; } } else { ModPackUrl.Text = ""; } _vm.Author = ModPackAuthor.Text; _vm.Name = ModPackName.Text; _vm.Version = versionNumber; _vm.Description = ModPackDescription.Text; _vm.Url = ModPackUrl.Text; if (CreateModpack != null) { CreateModpack.Invoke(this, _vm); } }