public void TestInitialize() { queueManager = Substitute.For <IQueueManagerAsync>(); view = Substitute.For <IExplorerView>(); eventAggregator = Substitute.For <IEventAggregator>(); windowManagerEx = Substitute.For <IWindowManagerEx>(); networkOperations = Substitute.For <INetworkOperations>(); explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations); queue = new Queue("TestQueue"); subQueue = new Queue("TestQueue.Subscriptions"); IList <Queue> queues = new List <Queue> { queue, subQueue }; queueManager.GetQueues(Arg.Any <string>()).Returns(Task.Run(() => queues)); queueManager.GetQueues().Returns(Task.Run(() => queues)); queueManager.GetMessageCount(Arg.Any <Queue>()).Returns(Task.Run(() => queues.Count)); queueManager.IsMsmqInstalled(Arg.Any <string>()).Returns(Task.Run(() => true)); AsyncHelper.Run(() => explorer.AttachView(view, null)); AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName)); queueNode = explorer.MachineRoot.Children.OfType <QueueExplorerItem>().First(); }
public static void ExpandNodeIfRequired(this IExplorerView explorerView, ITreeNode nodeToExpand, bool shouldExpand) { if (shouldExpand) { ExpandNode(explorerView, nodeToExpand); } }
/// <summary> /// Attach the view to this presenter and begin populating the view. /// </summary> /// <param name="model">The simulation model</param> /// <param name="view">The view used for display</param> /// <param name="explorerPresenter">The presenter for this object</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.CommandHistory = new CommandHistory(); this.ApsimXFile = model as Simulations; this.view = view as IExplorerView; this.mainMenu = new MainMenu(this); this.ContextMenu = new ContextMenu(this); ApsimXFile.Links.Resolve(ContextMenu); this.view.Tree.SelectedNodeChanged += this.OnNodeSelected; this.view.Tree.DragStarted += this.OnDragStart; this.view.Tree.AllowDrop += this.OnAllowDrop; this.view.Tree.Droped += this.OnDrop; this.view.Tree.Renamed += this.OnRename; Refresh(); ApsimFileMetadata file = Configuration.Settings.GetMruFile(ApsimXFile.FileName); if (file != null && file.ExpandedNodes != null) { this.view.Tree.ExpandNodes(file.ExpandedNodes); } this.PopulateMainMenu(); }
/// <summary>Constructor.</summary> /// <param name="pathOfParent">The path of the parent model to add the child to.</param> /// <param name="childStringToAdd">The string representation of the model to add.</param> /// <param name="explorerView">The explorer view to work with.</param> /// <param name="explorerPresenter">The explorer presenter to work with.</param> public AddModelCommand(string pathOfParent, string childStringToAdd, IExplorerView explorerView, ExplorerPresenter explorerPresenter) { parentPath = pathOfParent; childString = childStringToAdd; view = explorerView; presenter = explorerPresenter; }
/// <summary> /// Attach the view to this presenter and begin populating the view. /// </summary> /// <param name="model">The simulation model</param> /// <param name="view">The view used for display</param> /// <param name="explorerPresenter">The presenter for this object</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { // When the user undoes/redoes something we want to select the affected // model. Therefore we can use the same callback for both events. this.ApsimXFile = model as Simulations; this.view = view as IExplorerView; this.CommandHistory = new CommandHistory(this.view.Tree); this.mainMenu = new MainMenu(this); this.ContextMenu = new ContextMenu(this); ApsimXFile.Links.Resolve(ContextMenu); this.view.Tree.SelectedNodeChanged += this.OnNodeSelected; this.view.Tree.DragStarted += this.OnDragStart; this.view.Tree.AllowDrop += this.OnAllowDrop; this.view.Tree.Droped += this.OnDrop; this.view.Tree.Renamed += this.OnRename; Populate(); ApsimFileMetadata file = Configuration.Settings.GetMruFile(ApsimXFile.FileName); if (file != null && file.ExpandedNodes != null) { this.view.Tree.ExpandNodes(file.ExpandedNodes); } this.PopulateMainMenu(); }
protected void HelpRequestedEventHandler(object sender, HelpRequestedEventArgs e) { if (_helpView == null) { if (string.IsNullOrEmpty(e.HelpBaseUri)) { e.Cancel = true; } else { _helpView = WorkItem.SmartParts.AddNew <ExplorerView>(); SmartPartInfo info = new SmartPartInfo(); info.Title = string.Format(StringResources.Application_Help_Title, Id); Uri helpUri = new Uri(new Uri(e.HelpBaseUri), Id + "/default.htm"); _helpView.SetUrl(info.Title, helpUri.AbsoluteUri); ShellInteractionService.Show(_helpView, info); } } else { ShellInteractionService.Show(_helpView); } }
/// <summary>Initializes a new instance of the <see cref="AddModelCommand"/> class.</summary> /// <param name="xmlOfModelToAdd">The XML of the model to add</param> /// <param name="toParent">The parent model to add the child to</param> public AddModelCommand(IModel parent, XmlNode child, TreeViewNode nodeDescription, IExplorerView explorerView) { this.parent = parent; this.child = child; this.nodeDescription = nodeDescription; this.explorerView = explorerView; }
/// <summary> /// Constructor. /// </summary> public MoveModelCommand(Model FromModel, Model ToParent, NodeDescriptionArgs nodeDescription, IExplorerView explorerView) { this.FromModel = FromModel; this.ToParent = ToParent; this.nodeDescription = nodeDescription; this.explorerView = explorerView; }
/// <summary>The constructor</summary> /// <param name="modelToDelete">The model to delete</param> /// <param name="explorerView">The explorer view.</param> public DeleteModelCommand(IModel modelToDelete, NodeDescriptionArgs nodeDescription, IExplorerView explorerView) { this.modelToDelete = modelToDelete; this.nodeDescription = nodeDescription; this.explorerView = explorerView; this.parent = modelToDelete.Parent; }
/// <summary>Constructor.</summary> /// <param name="pathOfParent">The path of the parent model to add the child to.</param> /// <param name="child">The string representation of the model to add.</param> /// <param name="explorerView">The explorer view to work with.</param> /// <param name="explorerPresenter">The explorer presenter to work with.</param> public AddModelCommand(string pathOfParent, IModel child, IExplorerView explorerView, ExplorerPresenter explorerPresenter) { parentPath = pathOfParent; this.child = child; view = explorerView; presenter = explorerPresenter; }
protected override void Context() { _treeNodeFactory = A.Fake <ITreeNodeFactory>(); _projectRetriever = A.Fake <IProjectRetriever>(); _observedDataTask = A.Fake <IObservedDataTask>(); sut = new ObservedDataInExplorerPresenter(_projectRetriever, _treeNodeFactory, _observedDataTask); _explorerPresenter = A.Fake <IExplorerPresenter>(); _classificationPresenter = A.Fake <IClassificationPresenter>(); _explorerView = A.Fake <IExplorerView>(); A.CallTo(() => _explorerPresenter.BaseView).Returns(_explorerView); _rootNodeObservedDataFolder = new RootNodeType("ObservedData", ApplicationIcons.ObservedDataFolder, ClassificationType.ObservedData); _rootNodeIndividualFolder = new RootNodeType("Individual", ApplicationIcons.IndividualFolder); _observationRootNode = new RootNode(_rootNodeObservedDataFolder); _individualRootNode = new RootNode(_rootNodeIndividualFolder); sut.InitializeWith(_explorerPresenter, _classificationPresenter, _rootNodeObservedDataFolder); _project = A.Fake <IProject>(); A.CallTo(() => _explorerPresenter.NodeByType(_rootNodeObservedDataFolder)).Returns(_observationRootNode); A.CallTo(() => _explorerView.TreeView.NodeById(_rootNodeObservedDataFolder.Id)).Returns(_observationRootNode); A.CallTo(() => _explorerView.AddNode(A <ITreeNode> ._)).ReturnsLazily(s => s.Arguments[0].DowncastTo <ITreeNode>()); }
/// <summary> /// Creates an Explorer /// </summary> /// <param name="view"></param> public PiscesSettings(IExplorerView view) { this.m_view = view; //Defaults(m_db); // read TimeWindow settings. // m_db.ReadSettingsFromDatabase(TimeWindow); }
public override void AttachView(object view, object context) { base.AttachView(view, context); _view = view as IExplorerView; if (!IsConnected) { ConnectToQueue(Environment.MachineName); } }
/// <summary>Constructor.</summary> /// <param name="explorerView">The explorer view.</param> /// <param name="modelToMove">The model to move.</param> /// <param name="up">if set to <c>true</c> [up].</param> public MoveModelUpDownCommand(IModel modelToMove, bool up, IExplorerView explorerView) { if (modelToMove.ReadOnly) { throw new ApsimXException(modelToMove, string.Format("Unable to move {0} - it is read-only.", modelToMove.Name)); } this.modelToMove = modelToMove; this.moveUp = up; this.explorerView = explorerView; }
/// <summary>Initializes a new instance of the <see cref="AddModelCommand"/> class.</summary> /// <param name="xmlOfModelToAdd">The XML of the model to add</param> /// <param name="toParent">The parent model to add the child to</param> public AddModelCommand(IModel parent, XmlNode child, TreeViewNode nodeDescription, IExplorerView explorerView) { if (parent.ReadOnly) { throw new ApsimXException(parent, string.Format("Unable to add model to {0} - it is read-only.", parent.Name)); } this.parent = parent; this.child = child; this.nodeDescription = nodeDescription; this.explorerView = explorerView; }
/// <summary>The constructor</summary> /// <param name="modelToDelete">The model to delete</param> /// <param name="explorerView">The explorer view.</param> public DeleteModelCommand(IModel modelToDelete, TreeViewNode nodeDescription, IExplorerView explorerView) { if (modelToDelete.ReadOnly) { throw new ApsimXException(modelToDelete, string.Format("Unable to delete {0} - it is read-only.", modelToDelete.Name)); } this.modelToDelete = modelToDelete; this.nodeDescription = nodeDescription; this.explorerView = explorerView; this.parent = modelToDelete.Parent; }
/// <summary>Constructor.</summary> /// <param name="explorerView">The explorer view.</param> /// <param name="modelToReplace">The model to move.</param> /// <param name="modelToInsert">The new model to put in place of the old one</param> public ReplaceModelCommand(IModel modelToReplace, IModel modelToInsert, ExplorerPresenter presenter) { if (modelToReplace.ReadOnly) { throw new ApsimXException(modelToReplace, string.Format("Unable to replace {0} - it is read-only.", modelToReplace.Name)); } this.modelToReplace = modelToReplace; this.modelToInsert = modelToInsert; this.explorerView = presenter.GetView() as IExplorerView; this.presenter = presenter; }
public override async void AttachView(object view, object context) { base.AttachView(view, context); _view = view as IExplorerView; if (!IsConnected) { IsMSMQInstalled = await _queueManager.IsMsmqInstalled(LocalMachineName); if (IsMSMQInstalled) { await ConnectToQueue(LocalMachineName); } } }
/// <summary> /// Constructor. /// </summary> public MoveModelCommand(Model FromModel, Model ToParent, TreeViewNode nodeDescription, IExplorerView explorerView) { if (FromModel.ReadOnly) { throw new ApsimXException(FromModel, string.Format("Unable to move {0} to {1} - {0} is read-only.", FromModel.Name, ToParent.Name)); } if (ToParent.ReadOnly) { throw new ApsimXException(ToParent, string.Format("Unable to move {0} to {1} - {1} is read-only.", FromModel.Name, ToParent.Name)); } this.FromModel = FromModel; this.ToParent = ToParent; this.nodeDescription = nodeDescription; this.explorerView = explorerView; }
public TestExplorer(IExplorerView view, IEventAggregator events, ITestFilterBar filterBar, ITestFilter filter, IIconService icons) { _view = view; _events = events; _filter = filter; _icons = icons; if (filterBar != null) { filterBar.Observer = this; } _navigator = new SuiteNavigator { TestFilter = _filter.Matches, SuiteFilter = _filter.Matches }; }
/// <summary> /// Attach the view to this presenter and begin populating the view. /// </summary> /// <param name="model">The simulation model</param> /// <param name="view">The view used for display</param> /// <param name="explorerPresenter">The presenter for this object</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.CommandHistory = new CommandHistory(); this.ApsimXFile = model as Simulations; this.view = view as IExplorerView; this.mainMenu = new MainMenu(this); this.contextMenu = new ContextMenu(this); ApsimXFile.Links.Resolve(contextMenu); this.view.Tree.SelectedNodeChanged += this.OnNodeSelected; this.view.Tree.DragStarted += this.OnDragStart; this.view.Tree.AllowDrop += this.OnAllowDrop; this.view.Tree.Droped += this.OnDrop; this.view.Tree.Renamed += this.OnRename; Refresh(); this.PopulateMainMenu(); }
/// <summary> /// Attach the view to this presenter and begin populating the view. /// </summary> /// <param name="model">The simulation model</param> /// <param name="view">The view used for display</param> /// <param name="explorerPresenter">The presenter for this object</param> public void Attach(object model, object view, ExplorerPresenter explorerPresenter) { this.CommandHistory = new CommandHistory(); this.ApsimXFile = model as Simulations; this.view = view as IExplorerView; this.mainMenu = new MainMenu(this); this.contextMenu = new ContextMenu(this); this.view.ShortcutKeys = new string[] { "F5" }; this.view.SelectedNodeChanged += this.OnNodeSelected; this.view.DragStarted += this.OnDragStart; this.view.AllowDrop += this.OnAllowDrop; this.view.Droped += this.OnDrop; this.view.Renamed += this.OnRename; this.view.ShortcutKeyPressed += this.OnShortcutKeyPress; this.view.Refresh(GetNodeDescription(this.ApsimXFile)); this.WriteLoadErrors(); PopulateMainMenu(); }
public override void Run() { Xceed.Wpf.DataGrid.Licenser.LicenseKey = "DGP60-PF4JB-GTREY-3UXA"; ShellInteractionService.HyperlinkExecuted += HyperlinkExecutedEventHandler; ShellInteractionService.SmartPartClosing += (s, e) => { if (e.SmartPart == _helpView) { WorkItem.SmartParts.Remove(_helpView); _helpView = null; } }; Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { WorkflowRuntime runtime = WorkItem.Services.AddNew <WorkflowRuntime>(); runtime.StartRuntime(); }), DispatcherPriority.ApplicationIdle); base.Run(); }
public static bool IsNodeExpanded(this IExplorerView explorerView, ITreeNode treeNode) { return(explorerView.TreeView.IsNodeExpanded(treeNode)); }
public static void ToggleExpandState(this IExplorerView explorerView, ITreeNode node) { explorerView.TreeView.ToggleExpandState(node); }
public override void AttachView(object view, object context) { base.AttachView(view, context); _view = view as IExplorerView; }
/// <summary>Constructor.</summary> /// <param name="oldPath">The old path.</param> /// <param name="newPath">The new path.</param> /// <param name="explorerView">The explorer view.</param> public SelectNodeCommand(string oldPath, string newPath, IExplorerView explorerView) { this.explorerView = explorerView; this.oldPath = oldPath; this.newPath = newPath; }
public void TestInitialize() { queueManager = Substitute.For<IQueueManagerAsync>(); view = Substitute.For<IExplorerView>(); eventAggregator = Substitute.For<IEventAggregator>(); windowManagerEx = Substitute.For<IWindowManagerEx>(); networkOperations = Substitute.For<INetworkOperations>(); explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations); queue = new Queue("TestQueue"); subQueue = new Queue("TestQueue.Subscriptions"); IList<Queue> queues = new List<Queue> { queue, subQueue }; queueManager.GetQueues(Arg.Any<string>()).Returns(Task.Run(() => queues)); queueManager.GetQueues().Returns(Task.Run(() => queues)); queueManager.GetMessageCount(Arg.Any<Queue>()).Returns(Task.Run(() => queues.Count)); queueManager.IsMsmqInstalled(Arg.Any<string>()).Returns(Task.Run(() => true)); AsyncHelper.Run(() => explorer.AttachView(view, null)); AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName)); queueNode = explorer.MachineRoot.Children.OfType<QueueExplorerItem>().First(); }
public PiscesEngine(IExplorerView view, string fileName) { this.m_view = view; Open(fileName); }
/// <summary>Constructor.</summary> /// <param name="explorerView">The explorer view.</param> /// <param name="modelToMove">The model to move.</param> /// <param name="up">if set to <c>true</c> [up].</param> public MoveModelUpDownCommand(IModel modelToMove, bool up, IExplorerView explorerView) { this.modelToMove = modelToMove; this.moveUp = up; this.explorerView = explorerView; }
public FixtureExplorer(IExplorerView view, IContainer container) { _view = view; _container = container; }