private void Save_Click(object sender, RoutedEventArgs e) { if (PopUpHelper.WouldYouLikeToSave(CharacterExists(characterName.Text), "Character")) { //save the doc } }
/// <summary> /// Save our data /// </summary> private void ExportToFile() { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineOnAttributes = false; if (spellsToCreate != null && spellsToCreate.Count > 0) { if (PopUpHelper.WouldYouLikeToSave(SpellExists(spellName.Text), "item")) { OnSaveClicked(this, null); } XmlWriter writer = XmlWriter.Create(filePathToConfig, settings); writer.WriteStartDocument(); writer.WriteStartElement("SpellConfig"); //Add all of our spells we have created foreach (var spell in spellsToCreate) { writer.WriteStartElement("Spell"); writer.WriteAttributeString("Name", spell.Name); writer.WriteAttributeString("ID", spell.ID.ToString()); writer.WriteElementString("resourceCost", spell.resourceCost.ToString()); writer.WriteElementString("power", spell.power.ToString()); writer.WriteElementString("coolDown", spell.coolDown.ToString()); writer.WriteElementString("castTime", spell.castTime.ToString()); //Used for all special effects of the spell writer.WriteStartElement("SpellEffects"); writer.WriteElementString("effect", spell.effectType); writer.WriteElementString("radius", spell.radius.ToString()); writer.WriteElementString("duration", spell.duration.ToString()); writer.WriteElementString("interval", spell.interval.ToString()); writer.WriteElementString("spellType", spell.spellType); writer.WriteElementString("spellSchool", spell.spellSchool); writer.WriteEndElement(); writer.WriteElementString("classType", spell.classType); writer.WriteElementString("imagePath", spell.imagePath); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); System.Windows.Forms.MessageBox.Show("Spells successfully exported!"); } else { //Something is wrong no spells added or to create System.Windows.Forms.MessageBox.Show("Somethings went wrong, no spells where found. Are you sure you hit the Save Button?"); } }
/// <summary> /// Save button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Save_Click(object sender, RoutedEventArgs e) { //This has to be based off of the current tab we are on. switch (selectedTab) { //save here case ITEM_TAB.Armor: break; default: if (PopUpHelper.WouldYouLikeToSave(ItemExists(itemName.Text), "item")) { } break; { } } }
private async void DonationButton_Click(object sender, EventArgs e) { PopUpHelper popUpHelper = new PopUpHelper(); PopupWindow popupWindow = popUpHelper.ShowLoadingPopUp(Context, View); string key = Context.GetString(Resource.String.paystack_secret); //Validate input and key before processing. if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(amountText.Text)) { paystack = new PaystackObject(key); AuthorisationDetails authorisationDetails = new PaystackAuthorisationDetails { Amount = amountText.Text, Channels = new string[] { "bank", "card" }, Email = donorEmailAddress.Text }; ProviderAuthorisationResult authResult = await paystack.AuthoriseAsync(authorisationDetails); try { string path = System.IO.Path.Combine(PathHelper.GetOrCreateAuthDetailsPath(), "auth.exr"); //Important if you need to verify later. await paystack.StoreValuesAsync(authResult, path); Intent intent = new Intent(Context, typeof(TestActivity)); intent.PutExtra(PaystackOptions.PAYSTACK_TRANSFER_KEY, authResult.AuthEndpoint); popupWindow.Dismiss(); StartActivityForResult(intent, 2500); } catch { return; } } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { PopUpHelper.SaveAndExit(SpellExists(spellName.Text), "spell"); }
public void ThenPopUpShouldBeDisplayedAsNoResultsFound() { PopUpHelper.AlertTextVerify(DriverContext.Driver.FindElement(HomePage.Headerbutton_search), "No results found"); //WebElementExtension.Click(DriverContext.Driver.FindElement(HomePage.Qs_ibtnLogout)); }
private void Exit_Click(object sender, RoutedEventArgs e) { PopUpHelper.SaveAndExit(CharacterExists(characterName.Text), "character"); }
/// <summary> /// Write out the xml /// </summary> /// <param name="showPopup"></param> private void WriteOutXML(bool showPopup = true) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineOnAttributes = false; var selectedList = getListboxFromTab(selectedTab); if (selectedList != null && selectedList.Items.Count > 0) { if (showPopup && PopUpHelper.WouldYouLikeToSave(ItemExists(itemName.Text), selectedTab.ToString())) { //OnSaveClicked(this, null); } //GetfilePath from selected tab, var configPath = LoadAppConfigs.filePathToData + selectedTab.ToString() + "Config.xml"; XmlWriter writer = XmlWriter.Create(configPath, settings); writer.WriteStartDocument(); writer.WriteStartElement(selectedTab.ToString() + "s"); //Add all of our spells we have created foreach (var item in selectedList.Items) { writer.WriteStartElement(selectedTab.ToString()); writer.WriteAttributeString("itemName", item.ToString()); writer.WriteAttributeString("id", "0"); writer.WriteElementString("isEquipped", "0"); writer.WriteElementString("rarity", "0"); writer.WriteElementString("itemClass", "0"); writer.WriteElementString("type", "0"); writer.WriteElementString("imagePath", "x.png"); //output the specifics based on the tab we are in switch (selectedTab) { case ITEM_TAB.Weapon: writer.WriteElementString("minDmgLow", "1.1"); writer.WriteElementString("minDmgHigh", "1.1"); writer.WriteElementString("maxDmgLow", "1.1"); writer.WriteElementString("maxDmgHigh", "1.1"); writer.WriteElementString("weaponSpeed", "1.1"); break; case ITEM_TAB.Armor: writer.WriteElementString("armorMin", "0"); writer.WriteElementString("armorMax", "100"); break; case ITEM_TAB.Jewelry: writer.WriteElementString("effectedStat", "0"); writer.WriteElementString("value", "0"); break; case ITEM_TAB.Misc: writer.WriteElementString("displayText", "0"); break; } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); writer.Close(); if (showPopup) { System.Windows.Forms.MessageBox.Show(selectedTab.ToString() + "s successfully exported!"); } } else { //Something is wrong no spells added or to create System.Windows.Forms.MessageBox.Show("Somethings went wrong, no items where found. Are you sure you hit the Save Button?"); } }
/// <summary> /// When an image is selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSelectImageClicked(object sender, RoutedEventArgs e) { string fname = ""; itemImage.Source = PopUpHelper.SelectImage(GetEnumFromItemTab(selectedTab), ref fname); }
/// <summary> /// Exit is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Exit_Click(object sender, RoutedEventArgs e) { PopUpHelper.SaveAndExit(ItemExists(itemName.Text), "item"); }