public void Save(ElvenarEnv elvenar, int myPosition, IEnumerable <string> polierenList, IEnumerable <string> quests, TextWriter writer) { elvenar.MyPosition = myPosition; elvenar.Polieren = polierenList.ToArray(); elvenar.Quests = quests.ToArray(); var serializer = new XmlSerializer(elvenar.GetType()); serializer.Serialize(writer, elvenar); IsModified = false; }
private void InitServices(ElvenarEnv elvenar) { _elvenar = elvenar; _macroService = new MacroService(elvenar.Symbols, elvenar.Macros, LeftClick, GetMousePosition, KeyPress); _views = new ObservableCollection <ViewModelBase> { new QuestViewModel(elvenar.Quests, _macroService), new PolierenViewModel(elvenar.Polieren, elvenar.MyPosition, _macroService), new OtherViewModel(), }; NotifyPropertyChanged("CurrentView"); }
private void Load(object sender, RoutedEventArgs e) { var dlg = new OpenFileDialog(); dlg.Filter = "Elvenar Macro|*.elm"; if (!string.IsNullOrEmpty(_filename)) { dlg.FileName = _filename; } else { dlg.InitialDirectory = Path.GetDirectoryName(GetType().Assembly.Location); } if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { return; } _filename = dlg.FileName; Title = "Elvenar Makros - " + _filename; ElvenarEnv elvenar = _elvenarService.Load(_filename); InitServices(elvenar); }
public void Save(ElvenarEnv elvenar, int myPosition, IEnumerable <string> polierenList, IEnumerable <string> quests, string filename) { Save(elvenar, myPosition, polierenList, quests, new StreamWriter(filename)); }