protected virtual void OnTransactionAdd4(TransactionAddState state, InputDialogGump ui) { double value; if (String.IsNullOrWhiteSpace(ui.InputText) || !Double.TryParse(ui.InputText, out value)) { User.SendMessage(0x22, "Value '{0}' is not valid.", ui.InputText); ui.Refresh(); return; } state.Value = value; OnTransactionAdd(state); }
protected virtual void OnTransactionAdd3(TransactionAddState state, InputDialogGump ui) { if (String.IsNullOrWhiteSpace(ui.InputText) || AutoDonate.Transactions.ContainsKey(ui.InputText)) { User.SendMessage(0x22, "Transaction ID '{0}' is not valid.", ui.InputText); ui.Refresh(); return; } state.ID = ui.InputText.Trim(); OnTransactionAdd4(state); }
protected virtual void OnTransactionAdd4(TransactionAddState state) { var ui = new InputDialogGump(User, Refresh()) { Title = "Add Transaction: Step 4", Html = "Manually add a transaction.\n\n" + // "Value:\nEnter the " + AutoDonate.CMOptions.MoneySymbol + " " + AutoDonate.CMOptions.MoneyAbbr + " value for this transaction.\n\n" + // "Click OK to continue or Cancel to exit.", // InputText = state.Value.ToString("F2"), CancelHandler = Refresh }; ui.Callback = (b, val) => OnTransactionAdd4(state, ui); ui.Send(); }
protected virtual void OnTransactionAdd2(TransactionAddState state, InputDialogGump ui) { if (String.IsNullOrWhiteSpace(ui.InputText) || ui.InputText.Count(c => c == '@') != 1 || ui.InputText.LastIndexOf('.') < ui.InputText.LastIndexOf('@') || ui.InputText.Any(c => c != '.' && c != '@' && c != '-' && c != '_' && !Char.IsLetterOrDigit(c))) { User.SendMessage(0x22, "Email '{0}' is not valid.", ui.InputText); ui.Refresh(); return; } state.Email = ui.InputText.Trim(); OnTransactionAdd3(state); }
protected virtual void OnTransactionAdd3(TransactionAddState state) { var ui = new InputDialogGump(User, Refresh()) { Title = "Add Transaction: Step 3", Html = "Manually add a transaction.\n\n" + // "Transaction ID:\nEnter the unique ID for this transaction.\n\n" + // "Click OK to continue or Cancel to exit.", // InputText = state.ID, CancelHandler = Refresh }; ui.Callback = (b, id) => OnTransactionAdd3(state, ui); ui.Send(); }
protected virtual void OnTransactionAdd2(TransactionAddState state) { var ui = new InputDialogGump(User, Refresh()) { Title = "Add Transaction: Step 2", Html = "Manually add a transaction.\n\n" + // "Email Address:\nEnter the Email Address for this transaction.\n\n" + // "Click OK to continue or Cancel to exit.", // InputText = state.Email, CancelHandler = Refresh }; ui.Callback = (b, email) => OnTransactionAdd2(state, ui); ui.Send(); }
protected virtual void OnTransactionAdd1(TransactionAddState state, InputDialogGump ui) { IAccount acc; if (String.IsNullOrWhiteSpace(ui.InputText) || (acc = Accounts.GetAccount(ui.InputText)) == null) { User.SendMessage(0x22, "Account '{0}' could not be found.", ui.InputText); ui.Refresh(); return; } state.Account = acc; state.Email = acc.Email; OnTransactionAdd2(state); }
protected virtual void OnTransactionAdd1(TransactionAddState state) { var ui = new InputDialogGump(User, Refresh()) { Title = "Add Transaction: Step 1", Html = "Manually add a transaction.\n\n" + // "Account Name:\nEnter the account name of the recipient for this transaction.\n\n" + // "Click OK to continue or Cancel to exit.", // InputText = User.Account.Username, CancelHandler = Refresh }; ui.Callback = (b, username) => OnTransactionAdd1(state, ui); ui.Send(); }
protected void BeginRename(PlayerMobile m) { if (m == null || m.Deleted) { return; } _NameInput = SuperGump.Send( new InputDialogGump(m) { Limit = 16, Title = "Name Your Entity", Html = "Give your talisman entity a name!\n\n" + "Name length must be between 1 and 16 letters and contain no invalid characters, numbers, or white-space.\n\n" + "When you're done, click OK to summon your entity!", AcceptHandler = b => _NameInput = null, CancelHandler = b => { _NameInput = null; m.SendMessage("You decide not to name your entity."); }, Callback = (b, t) => { if (VerifyName(m, t, true) != NameResultMessage.Allowed) { return; } EntityName = t; SummonEntity(m); } }); }
protected virtual void OnTransactionImport() { var input = new InputDialogGump(User, Hide()) { Title = "Import Transactions", Html = "Import transactions from a file.\n\n" + // "File Formats: \n*.json\n\n" + // "Root Directory: " + Core.BaseDirectory }; input.AcceptHandler = b => { input.InputText = IOUtility.GetSafeFilePath(input.InputText, true); var path = Path.Combine(Core.BaseDirectory, input.InputText); if (!Insensitive.EndsWith(path, ".json")) { input.InputText = String.Empty; input.User.SendMessage("File not supported: {0}", path); input.Refresh(true); return; } if (!File.Exists(path)) { input.InputText = String.Empty; input.User.SendMessage("File not found: {0}", path); input.Refresh(true); return; } OnTransactionImport(new FileInfo(path)); }; input.CancelHandler = Refresh; input.Send(); }