public AddParticleDlg(AddParticleDlgViewModel model) { InitializeComponent(); Loaded += (sender, args) => { var hwnd = new WindowInteropHelper(this).Handle; WindowHelper.SetWindowAsDialog(hwnd); DataContext = model; }; }
public void AddToIdea() { var vm = new AddParticleDlgViewModel(_particlesManager, typeof (Entity.Idea), _blockManager); SetExistParticle(vm.AddParticleVm); SetNewParticle(vm.AddParticleVm); var dlg = new AddParticleDlg(vm); var res = dlg.ShowDialog(); if (!res.HasValue || !res.Value) return; if (vm.AddParticleVm.AddParticle && vm.AddParticleVm.UseNewParticle) { var bl = new TextBlockParticle { Caption = vm.BlockCaption, Id = vm.ParticleId, MyAnchor = new AnchorSegment(_textEditor.Document, _textEditor.SelectionStart, _textEditor.SelectionLength) }; Blocks.Add(bl); InsertCaptionForBlock(bl); } //Save! SaveMaterial(_textEditor.Text); }