private void InitViewModels() { Messenger = new PMessenger <ParserEventArgs> { EventAcquired = OnEventAcquired }; TreeViewModel = new ParserTreeViewModel() { Messenger = this.Messenger }; PropertyGridViewModel = new PropertyGridViewModel() { Messenger = this.Messenger }; ExportViewModel = new ExportViewModel() { Messenger = this.Messenger }; LogViewModel = new LogViewModel() { Messenger = this.Messenger }; }
public void OnEventAcquired(object sender, ParserEventArgs args) { try { //Update property window anyway PropertyGridViewModel.Clear(); DataViewModel?.Clear(); if (args == null) { throw new NullReferenceException("Invalid arguments passed"); } PropertyGridViewModel.AddData(args.TreeNode?.Properties); var argsType = args.ArgsType; if ((argsType & MessageType.ProcessAll) != 0) { DataViewModel = MarkupManager.Resolve(args.TreeNode?.Markup) ?? new DataGridViewModel(); DataViewModel.ProcessNodeData(args.TreeNode); } DataViewModel?.Refresh(); PropertyGridViewModel.Refresh(); } catch (Exception ex) { MessageBoxInstance.Raise(ex.Message); } }
public void VerifyThatPropertiesArePopulated() { var person = new Person(); var vm = new PropertyGridViewModel(person, this.session.Object); Assert.IsNotNull(vm.Thing); Assert.IsNotNull(vm.Caption); Assert.IsNotNull(vm.ToolTip); }
public void VerifyThatThingChangeOccursWhenSelectedThingChanges() { var person = new Person(); var vm = new PropertyGridViewModel(person, this.session.Object); var expectedPerson = new Person(); CDPMessageBus.Current.SendMessage(new SelectedThingChangedEvent(expectedPerson, this.session.Object)); Assert.That(vm.Thing, Is.EqualTo(expectedPerson)); }
/// <summary> /// Initializes a new instance of the <see cref="ResultViewModel" /> class. /// </summary> /// <param name="runtime">The runtime service.</param> /// <param name="queryResults">The query results.</param> /// <param name="messages">The WITSML messages.</param> /// <param name="soapMessages">The SOAP messages.</param> public ResultViewModel(IRuntimeService runtime, TextEditorViewModel queryResults, TextDocument messages, TextDocument soapMessages) { _log.Debug("Creating view model instance"); Runtime = runtime; ObjectData = new DataGridViewModel(runtime); ObjectProperties = new PropertyGridViewModel(runtime, ObjectData); QueryResults = queryResults; Messages = new TextEditorViewModel(runtime, "XML", true) { Document = messages }; SoapMessages = new TextEditorViewModel(runtime, "XML", true) { Document = soapMessages }; }
public static void RegisterFileSource(this PropertyGridViewModel propertyGridViewModel, FileSourceViewModel fileSource, string category = null) { if (category == null) { category = Tx.T("TasksCommon:Utilities.FileSource"); } propertyGridViewModel.RegisterProperty(() => fileSource.Url, Tx.T("TasksCommon:Utilities.FileSource.Url"), Tx.T("TasksCommon:Utilities.FileSource.Url.Description"), category); propertyGridViewModel.RegisterProperty(() => fileSource.LocalPath, Tx.T("TasksCommon:Utilities.FileSource.LocalPath"), Tx.T("TasksCommon:Utilities.FileSource.LocalPath.Description"), category); var hashCategory = category + " - " + Tx.T("TasksCommon:Utilities.FileSource.Hash"); propertyGridViewModel.RegisterProperty(() => fileSource.HashAlgorithm, Tx.T("TasksCommon:Utilities.FileSource.Algorithm"), Tx.T("TasksCommon:Utilities.FileSource.Algorithm.Description"), hashCategory); propertyGridViewModel.RegisterProperty(() => fileSource.FileHash, Tx.T("TasksCommon:Utilities.FileSource.Hash"), Tx.T("TasksCommon:Utilities.FileSource.Hash.Description"), hashCategory); }
public void ChangeFoldingTextColorOfAvalonEdit() { PropertyGridViewModel.ChangeFoldingTextColorOfAvalonEdit(); }