コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                noLabel = new LabelViewModel(new LabelMock() { Text = "No label" }, this);

                openNote = new OpenNoteCommand(this);
                newNote = new NewNoteCommand(this);
                closeNote = new CloseNoteCommand(this);
                deleteNote = new DeleteNoteCommand(this);
                saveNote = new SaveNoteCommand(this);
                delayedSaveNote = new DelayedSaveNoteCommand(this);
                simpleSearch = new SimpleSearchCommand(this);
                search = new ComplexSearchCommand(this);
                toggleSearch = new ToggleAdvancedSearchCommand(this);
                hideSearch = new HideSearchViewCommand(this);
                hideComplexSearch = new HideComplexSearchCommand(this);

                OpenNotes.CollectionChanged += openNotes_CollectionChanged;
                SearchResults.CollectionChanged += searchResults_CollectionChanged;
            }
        }
コード例 #2
0
 public LabelViewModel GetViewModel(ILabel model)
 {
     LabelViewModel vm;
     if (labelViewModels.ContainsKey(model.ID))
     {
         vm = labelViewModels[model.ID];
         vm.Model = model;
     }
     else
     {
         vm = new LabelViewModel(model, this);
     }
     return vm;
 }
コード例 #3
0
 internal void RegisterViewModel(ILabel model, LabelViewModel vm)
 {
     if (labelViewModels.ContainsKey(model.ID) == false)
         labelViewModels.Add(model.ID, vm);
 }