private void GenerateCollections(object sender, object data = null) { if (_userTopGeneratorForm == null || _userTopGeneratorForm.IsDisposed) { _userTopGeneratorForm = GuiComponentsProvider.Instance.GetClassImplementing <IUserTopGeneratorForm>(); var model = new UserTopGeneratorModel((a) => _collectionGenerator.CreateCollectionName(new ApiScore() { EnabledMods = (int)(Mods.Hr | Mods.Hd) }, "Piotrekol", a)); model.GenerateUsernames += GenerateUsernames; new UserTopGeneratorFormPresenter(model, _userTopGeneratorForm); model.Start += (s, a) => _collectionGenerator.GenerateCollection(model.GeneratorConfiguration); model.SaveCollections += (s, a) => _collectionEditor.EditCollection(CollectionEditArgs.AddCollections(model.Collections)); model.Abort += (s, a) => _collectionGenerator.Abort(); _collectionGenerator.StatusUpdated += (s, a) => { model.GenerationStatus = _collectionGenerator.Status; model.GenerationCompletionPrecentage = _collectionGenerator.ProcessingCompletionPrecentage; }; _collectionGenerator.CollectionsUpdated += (s, a) => model.Collections = _collectionGenerator.Collections; } _userTopGeneratorForm.Show(); }
public UserTopGeneratorFormPresenter(IUserTopGeneratorModel model, IUserTopGeneratorForm form) { _model = model; _form = form; form.Closing += (s, a) => { _model.EmitAbort(); if (_model.Collections != null) { _model.EmitSaveCollections(); } }; new UserTopGeneratorPresenter(model, form.UserTopGeneratorView); }