private void Button_LaunchWindowerPathDialog_Click(object sender, RoutedEventArgs e) { var inputDialog = new CustomInputDialog("Windower Path:", Settings.Default.WindowerPath); if (inputDialog.ShowDialog() == true && !string.IsNullOrEmpty(inputDialog.DialogValue) && Directory.Exists(inputDialog.DialogValue)) { Settings.Default.WindowerPath = inputDialog.DialogValue.Trim(); Settings.Default.Save(); FillLists(true); } }
private void SaveSettings() { var fname = "default"; if (_ELITEAPI != null) { fname = _ELITEAPI.Player.Name + "_" + _Res.Jobs[_ELITEAPI.Player.MainJob] + "_" + _Res.Jobs[_ELITEAPI.Player.SubJob]; } var inputDialog = new CustomInputDialog("Save as...", fname); if (inputDialog.ShowDialog() == true) { SaveSettingsToFile(inputDialog.DialogValue.Replace(".txt", "") + ".txt"); } }
private void Button_SaveBuffs_Click(object sender, RoutedEventArgs e) { if (_HbData == null) { return; } var inputDialog = new CustomInputDialog("Buff list name:", "mybuffs"); if (inputDialog.ShowDialog() == true) { var bufflistname = inputDialog.DialogValue; if (!string.IsNullOrEmpty(bufflistname)) { bufflistname = bufflistname.ToLower().Trim(); // handle duplicate list names automatically var check = _HbData.BuffLists.Where(x => x.Name.ToLower() == bufflistname).FirstOrDefault(); if (check != null) { int i = 1; while (check != null) { i++; var temp = bufflistname + i.ToString(); check = _HbData.BuffLists.Where(x => x.Name.ToLower() == temp).FirstOrDefault(); } } var buffs = new List <string>(); foreach (var item in Lb_Buffs.Items) { if (item.ToString().Contains(_ELITEAPI.Player.Name)) { buffs.Add(item.ToString().Replace(_ELITEAPI.Player.Name + " ", "").Trim()); } } var bufflist = new BuffList { Name = bufflistname, List = new Dictionary <string, List <string> > { { "me", buffs } } }; var msg = new CustomMessageDialog("Saved!", "Buff List: '" + bufflistname + "' has been saved to [..healbot\\data\\buffLists.lua]"); if (_HbData.SaveBuffList(bufflist)) { _HbData = new HealbotData(Settings.Default.WindowerPath); // reload the settings } else { msg = new CustomMessageDialog("ERROR", "An error occured while trying to save the set of buffs!" + Environment.NewLine + Environment.NewLine + "Buff list name: '" + bufflistname + "'"); } msg.ShowDialog(); } } else { var msg = new CustomMessageDialog("ERROR", "A name must be provided in order to save the buffs as a list in [..healbot\\data\\buffLists.lua]"); msg.ShowDialog(); } }