コード例 #1
0
 public AddParticleDlg(AddParticleDlgViewModel model)
 {
     InitializeComponent();
     Loaded += (sender, args) =>
     {
         var hwnd = new WindowInteropHelper(this).Handle;
         WindowHelper.SetWindowAsDialog(hwnd);
         DataContext = model;
     };
 }
コード例 #2
0
ファイル: TextModel.cs プロジェクト: yetanothervan/conspector
        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);
        }