public PropertyPresenter(IProjectModel model, IPropertyView view)
        {
            this.model = model;
            this.view  = view;

            view.ProcessModel.SelectionList   = new string[] { "Default", "Single", "Separate", "Multiple" };
            view.DomainUsage.SelectionList    = new string[] { "Default", "Single", "Multiple" };
            view.Runtime.SelectionList        = new string[] { "Any", "Net", "Mono" };
            view.RuntimeVersion.SelectionList = new string[] { "1.0.3705", "1.1.4322", "2.0.50727", "4.0.21006" };

            view.BrowseProjectBaseCommand.Execute += BrowseForProjectBase;
            view.BrowseConfigBaseCommand.Execute  += BrowseForConfigBase;
            view.EditConfigsCommand.Execute       += EditConfigs;

            view.AddAssemblyCommand.Execute        += AddAssembly;
            view.RemoveAssemblyCommand.Execute     += RemoveAssembly;
            view.BrowseAssemblyPathCommand.Execute += BrowseForAssemblyPath;

            view.ProjectBase.Validated         += OnProjectBaseChange;
            view.ProcessModel.SelectionChanged += OnProcessModelChange;
            view.DomainUsage.SelectionChanged  += OnDomainUsageChange;
            view.ConfigList.SelectionChanged   += OnSelectedConfigChange;

            view.Runtime.SelectionChanged      += OnRuntimeChange;
            view.RuntimeVersion.TextValidated  += OnRuntimeVersionChange;
            view.ApplicationBase.Validated     += OnApplicationBaseChange;
            view.ConfigurationFile.Validated   += OnConfigurationFileChange;
            view.BinPathType.SelectionChanged  += OnBinPathTypeChange;
            view.PrivateBinPath.Validated      += OnPrivateBinPathChange;
            view.AssemblyList.SelectionChanged += OnSelectedAssemblyChange;
            view.AssemblyPath.Validated        += OnAssemblyPathChange;

            model.Document.ProjectCreated += OnProjectCreated;
            model.Document.ProjectClosed  += OnProjectClosed;
        }
示例#2
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();
            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesGrid = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesGrid).MainWidget, true, false);
            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;
            image.SizeAllocated          += OnSizeAllocated;
#if NETFRAMEWORK
            image.ExposeEvent += OnImageExposed;
#else
            image.Drawn += OnImageExposed;
#endif
            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
示例#3
0
        /// <summary>
        /// Attach the model to the view.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">An <see cref="ExplorerPresenter" /> instance.</param>
        public virtual void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }
            if (explorerPresenter == null)
            {
                throw new ArgumentNullException(nameof(explorerPresenter));
            }

            this.model     = model as IModel;
            this.view      = view as IPropertyView;
            this.presenter = explorerPresenter;

            if (this.model != null && !(this.model is IModel))
            {
                throw new ArgumentException($"The model must be an IModel instance");
            }
            if (this.view == null)
            {
                throw new ArgumentException($"The view must be an IPropertyView instance");
            }

            RefreshView(this.model);
            presenter.CommandHistory.ModelChanged += OnModelChanged;
            this.view.PropertyChanged             += OnViewChanged;
        }
        public PropertyPresenter(IProjectModel model, IPropertyView view)
        {
            this.model = model;
            this.view = view;

            view.ProcessModel.SelectionList = new string[] { "Default", "Single", "Separate", "Multiple" };
            view.DomainUsage.SelectionList = new string[] { "Default", "Single", "Multiple" };
            view.Runtime.SelectionList = new string[] { "Any", "Net", "Mono" };
            view.RuntimeVersion.SelectionList = new string[] { "1.0.3705", "1.1.4322", "2.0.50727", "4.0.21006" };

            view.BrowseProjectBaseCommand.Execute += BrowseForProjectBase;
            view.BrowseConfigBaseCommand.Execute += BrowseForConfigBase;
            view.EditConfigsCommand.Execute += EditConfigs;

            view.AddAssemblyCommand.Execute += AddAssembly;
            view.RemoveAssemblyCommand.Execute += RemoveAssembly;
            view.BrowseAssemblyPathCommand.Execute += BrowseForAssemblyPath;

            view.ProjectBase.Validated += OnProjectBaseChange;
            view.ProcessModel.SelectionChanged += OnProcessModelChange;
            view.DomainUsage.SelectionChanged += OnDomainUsageChange;
            view.ConfigList.SelectionChanged += OnSelectedConfigChange;

            view.Runtime.SelectionChanged += OnRuntimeChange;
            view.RuntimeVersion.TextValidated += OnRuntimeVersionChange;
            view.ApplicationBase.Validated += OnApplicationBaseChange;
            view.ConfigurationFile.Validated += OnConfigurationFileChange;
            view.BinPathType.SelectionChanged += OnBinPathTypeChange;
            view.PrivateBinPath.Validated += OnPrivateBinPathChange;
            view.AssemblyList.SelectionChanged += OnSelectedAssemblyChange;
            view.AssemblyPath.Validated += OnAssemblyPathChange;

            model.Document.ProjectCreated += OnProjectCreated;
            model.Document.ProjectClosed += OnProjectClosed;
        }
示例#5
0
        public PropertyPresenter(IPropertyModel model, IPropertyView view)
        {
            _model = model;
            _view  = view;

            InitializeView();
            WireUpEvents();
        }
 public virtual void CreateAndAttachRightPanel()
 {
     //create a new grid view to be added as a RightHandView
     //nb. the grid view is owned by the tree view not by this presenter.
     this.propertyView = new PropertyView(this.treeview as ViewBase);
     this.treeview.AddRightHandView(this.propertyView);
     this.propertyPresenter.Attach(this.model, this.propertyView, this.explorerPresenter);
 }
        public PropertyPresenter(IPropertyModel model, IPropertyView view)
        {
            _model = model;
            _view = view;

            InitializeView();
            WireUpEvents();
        }
示例#8
0
        public void DefaultAdapter()
        {
            PropertyViewProvider provider = new PropertyViewProvider();
            Guid          guid            = Guid.NewGuid();
            IPropertyView view            = provider.GetTypeView(guid);

            view.ToString().Should().Be(guid.ToString());
            view.Should().HaveCount(0);
        }
示例#9
0
        internal EditorElement(int editorIndex, IPropertyView iw, bool isCulled = false)
        {
            m_EditorIndex   = editorIndex;
            inspectorWindow = iw;
            pickingMode     = PickingMode.Ignore;

            if (isCulled)
            {
                InitCulled();
                return;
            }

            Init();
        }
示例#10
0
        public void RegisteredAdapter()
        {
            PropertyViewProvider provider = new PropertyViewProvider();

            provider.RegisterPropertyViewer <string>(TestViewAdapter.Create);
            string        testObject = "Crazy!";
            IPropertyView view       = provider.GetTypeView(testObject);

            view.ToString().Should().Be("Crazy!");
            view.Should().HaveCount(2);
            IProperty <object> property = view.First();

            property.Name.Should().Be("Upper");
            property.Value.Should().Be("CRAZY!");
        }
示例#11
0
        public void HandleOutput(object value)
        {
            // Transform the output objects to MSBuild ITaskItems

            IPropertyView view = this.PropertyViewProvider.GetTypeView(value);

            MSBuildFramework.ITaskItem taskItem = new TaskItem {
                ItemSpec = view.ToString()
            };
            foreach (var property in view)
            {
                taskItem.SetMetadata(property.Name, property.Value.ToString());
            }

            this.output.Add(taskItem);
        }
示例#12
0
        public void SetUp()
        {
            doc = new ProjectModel();
            doc.LoadXml(NUnitProjectXml.NormalProject);
            model = new PropertyModel(doc);
            model.ActiveConfigName = "Release";

            view = Substitute.For <IPropertyView>();
            view.ConfigList.Returns(new SelectionStub("ConfigList"));
            view.ProcessModel.Returns(new SelectionStub("ProcessModel"));
            view.DomainUsage.Returns(new SelectionStub("DomainUsage"));
            view.Runtime.Returns(new SelectionStub("Runtime"));
            view.RuntimeVersion.Returns(new SelectionStub("RuntimeVersion"));
            view.AssemblyList.Returns(new SelectionStub("AssemblyList"));

            new PropertyPresenter(model, view);
            view.Selected += Raise.Event <ActionHandler>();
        }
示例#13
0
        internal EditorElement(int editorIndex, IPropertyView iw)
        {
            m_EditorIndex   = editorIndex;
            inspectorWindow = iw;
            pickingMode     = PickingMode.Ignore;

            Init();

            Add(m_Header);
            // If the editor targets contain many target and the multi editing is not supported, we should not add this inspector.
            // However, the header and footer are kept since these are showing information regarding this state.
            if ((editor.targets.Length <= 1) || (iw.IsMultiEditingSupported(editor, editor.target)))
            {
                Add(m_InspectorElement);
            }

            Add(m_Footer);
        }
示例#14
0
        public void SetUp()
        {
            doc = new ProjectDocument();
            doc.LoadXml(NUnitProjectXml.NormalProject);
            model = new ProjectModel(doc);
            model.ActiveConfigName = "Release";

            view = Substitute.For<IPropertyView>();
            view.ConfigList.Returns(new SelectionStub("ConfigList"));
            view.ProcessModel.Returns(new SelectionStub("ProcessModel"));
            view.DomainUsage.Returns(new SelectionStub("DomainUsage"));
            view.Runtime.Returns(new SelectionStub("Runtime"));
            view.RuntimeVersion.Returns(new SelectionStub("RuntimeVersion"));
            view.AssemblyList.Returns(new SelectionStub("AssemblyList"));

            presenter = new PropertyPresenter(model, view);
            presenter.LoadViewFromModel();
        }
示例#15
0
        /// <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 virtual void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.model    = model as Model;
            this.treeview = view as IPropertyCategorisedView;
            if (view is null)
            {
                throw new ArgumentException($"The view must be an PropertyCategorisedView instance");
            }

            this.treeview.SelectedNodeChanged += this.OnNodeSelected;
            this.explorerPresenter             = explorerPresenter;

            //Fill in the nodes in the tree view
            this.RefreshTreeView();

            //Initialise the Right Hand View
            this.propertyPresenter = new SimplePropertyPresenter();
            this.propertyView      = new PropertyView(this.treeview as ViewBase);

            this.ShowRightHandView();
        }
示例#16
0
        public IPropertyView GetTypeView <T>(T value)
        {
            // Look for built-in type view support, registered type view, then fall back on default
            IPropertyView typeView = value as IPropertyView;

            if (typeView != null)
            {
                return(typeView);
            }

            object propertyViewer;
            Type   valueType = value.GetType();

            if (this.propertyViewers.TryGetValue(valueType, out propertyViewer))
            {
                Delegate constructor = (Delegate)propertyViewer;
                return((IPropertyView)constructor.DynamicInvoke(value));
            }

            return(DefaultTypeView.Create(value));
        }
示例#17
0
        /// <summary>
        /// Constructor. Initialises the widget and will show a world
        /// map with no markers until <see cref="ShowMap" /> is called.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public MapView(ViewBase owner) : base(owner)
        {
            image = new Gtk.Image();

            image.Halign = Align.Start;
            image.Valign = Align.Start;

            var container = new Gtk.EventBox();

            container.Add(image);

            VPaned box = new VPaned();

            PropertiesView = new PropertyView(this);
            box.Pack1(((ViewBase)PropertiesView).MainWidget, true, false);

            if (((ViewBase)PropertiesView).MainWidget is ScrolledWindow scroller)
            {
                scroller.VscrollbarPolicy = PolicyType.Never;
            }

            box.Pack2(container, true, true);

            container.AddEvents(
                (int)Gdk.EventMask.ButtonPressMask
                | (int)Gdk.EventMask.ButtonReleaseMask
                | (int)Gdk.EventMask.ScrollMask);
            container.ButtonPressEvent   += OnButtonPress;
            container.ButtonReleaseEvent += OnButtonRelease;

            image.Drawn += OnImageExposed;

            container.Destroyed   += OnMainWidgetDestroyed;
            container.ScrollEvent += OnMouseScroll;

            mainWidget = box;
            mainWidget.ShowAll();
        }
示例#18
0
        public MainPresenter(IProjectDocument doc, IMainView view)
        {
            this.doc  = doc;
            this.view = view;

            // Set up property editor triad
            ProjectModel  project      = new ProjectModel(doc);
            IPropertyView propertyView = view.PropertyView;

            this.propertyPresenter = new PropertyPresenter(project, propertyView);

            // Set up XML editor triad
            IXmlView xmlView = view.XmlView;

            this.xmlPresenter = new XmlPresenter(doc, xmlView);

            // Enable and disable menu items
            view.NewProjectCommand.Enabled    = true;
            view.OpenProjectCommand.Enabled   = true;
            view.CloseProjectCommand.Enabled  = false;
            view.SaveProjectCommand.Enabled   = false;
            view.SaveProjectAsCommand.Enabled = false;

            // Set up handlers for view events
            view.FormClosing += OnFormClosing;

            view.NewProjectCommand.Execute    += CreateNewProject;
            view.OpenProjectCommand.Execute   += OpenProject;
            view.SaveProjectCommand.Execute   += SaveProject;
            view.SaveProjectAsCommand.Execute += SaveProjectAs;
            view.CloseProjectCommand.Execute  += CloseProject;
            view.ActiveViewChanging           += this.ValidateActiveViewChange;
            view.ActiveViewChanged            += this.ActiveViewChanged;

            // Set up handlers for model events
            doc.ProjectCreated += OnProjectCreated;
            doc.ProjectClosed  += OnProjectClosed;
        }
示例#19
0
 public EditorDragging(IPropertyView inspectorWindow)
 {
     m_InspectorWindow = inspectorWindow;
 }
示例#20
0
 internal static IEditorElement CreateEditorElement(int editorIndex, IPropertyView iw, string title)
 {
     return(CreateFunctor.Invoke(editorIndex, iw, title));
 }
示例#21
0
        public BubbleChartView(ViewBase owner = null) : base(owner)
        {
            vpaned1               = new VPaned();
            mainWidget            = vpaned1;
            mainWidget.Destroyed += OnDestroyed;

            graphView = new DirectedGraphView(this);
            vpaned1.Pack1(graphView.MainWidget, true, true);

            VBox vbox1 = new VBox(false, 0);

            ctxBox = new VBox(false, 0);

            // Arc selection: rules & actions
            VBox arcSelBox = new VBox();

            Label l1 = new Label("Rules");

            l1.Xalign = 0;
            arcSelBox.PackStart(l1, true, true, 0);
            RuleList = new EditorView(owner);
            RuleList.TextHasChangedByUser += OnRuleChanged;
            //RuleList.ScriptMode = false;

            ScrolledWindow rules = new ScrolledWindow();

            rules.ShadowType = ShadowType.EtchedIn;
            rules.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            rules.Add((RuleList as ViewBase).MainWidget);

            (RuleList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(rules, true, true, 0);
            rules.Show();

            Label l2 = new Label("Actions");

            l2.Xalign = 0;
            arcSelBox.PackStart(l2, true, true, 0);
            ActionList = new EditorView(owner);
            ActionList.TextHasChangedByUser += OnActionChanged;
            //ActionList.ScriptMode = false;

            ScrolledWindow actions = new ScrolledWindow();

            actions.ShadowType = ShadowType.EtchedIn;
            actions.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            actions.Add((ActionList as ViewBase).MainWidget);

            (ActionList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(actions, true, true, 0); actions.Show();
            arcSelWdgt = arcSelBox as Widget;
            arcSelWdgt.Hide();
            ctxBox.PackStart(arcSelWdgt, true, true, 0);

            // Node selection:

            Grid t1 = new Grid();

            Label l3 = new Label("Name");

            l3.Xalign = 0;
            t1.Attach(l3, 0, 0, 1, 1);

            Label l4 = new Label("Description");

            l4.Xalign = 0;
            t1.Attach(l4, 0, 1, 1, 1);

            Label l5 = new Label("Colour");

            l5.Xalign = 0;
            t1.Attach(l5, 0, 2, 1, 1);

            nameEntry          = new Entry();
            nameEntry.Changed += OnNameChanged;
            nameEntry.Xalign   = 0;

            // Setting the WidthRequest to 350 will effectively
            // set the minimum size, beyond which it cannot be further
            // shrunk by dragging the HPaned's splitter.
            nameEntry.WidthRequest = 350;
            t1.Attach(nameEntry, 1, 0, 1, 1);

            descEntry              = new Entry();
            descEntry.Xalign       = 0;
            descEntry.Changed     += OnDescriptionChanged;
            descEntry.WidthRequest = 350;
            t1.Attach(descEntry, 1, 1, 1, 1);
            colourChooser              = new ColorButton();
            colourChooser.Xalign       = 0;
            colourChooser.ColorSet    += OnColourChanged;
            colourChooser.WidthRequest = 350;
            t1.Attach(colourChooser, 1, 2, 1, 1);
            nodeSelWdgt = t1;
            ctxBox.PackStart(t1, true, true, 0);

            // Info
            Label l6 = new Label();

            l6.LineWrap = true;
            l6.Text     = "<left-click>: select a node or arc.\n" +
                          "<right-click>: shows a context-sensitive menu.\n\n" +
                          "Once a node/arc is selected, it can be dragged to a new position.\n\n" +
                          "Nodes are created by right-clicking on a blank area.\n\n" +
                          "Transition arcs are created by firstly selecting a source node,\n" +
                          "then right-clicking over a target node.";
            infoWdgt = l6 as Widget;
            infoWdgt.ShowAll();
            l6.Xalign = 0;
            l6.Yalign = 0;
            l6.Wrap   = false;
            Alignment infoWdgtWrapper = new Alignment(0, 0, 1, 0);

            infoWdgtWrapper.Add(infoWdgt);
            //ctxBox.PackStart(infoWdgt, true, true, 0);
            //vbox1.PackStart(ctxBox, false, false, 0);

            PropertiesView = new PropertyView(this);
            ((ScrolledWindow)((ViewBase)PropertiesView).MainWidget).HscrollbarPolicy = PolicyType.Never;
            // settingsBox = new Table(2, 2, false);
            // settingsBox.Attach(new Label("Initial State"), 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // combobox1 = new ComboBox();
            // combobox1.PackStart(comboRender, false);
            // combobox1.AddAttribute(comboRender, "text", 0);
            // combobox1.Model = comboModel;
            // settingsBox.Attach(combobox1, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // chkVerbose = new CheckButton();
            // chkVerbose.Toggled += OnToggleVerboseMode;
            // settingsBox.Attach(new Label("Verbose Mode"), 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // settingsBox.Attach(chkVerbose, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            hpaned1 = new HPaned();
            hpaned2 = new HPaned();
            Frame frame1 = new Frame("Rotation Settings");

            frame1.Add(((ViewBase)PropertiesView).MainWidget);
            frame1.ShadowType = ShadowType.In;
            Frame frame2 = new Frame();

            frame2.Add(hpaned2);
            frame2.ShadowType = ShadowType.In;
            ctxFrame          = new Frame();
            ctxFrame.Add(ctxBox);
            ctxFrame.ShadowType = ShadowType.In;
            Frame frame4 = new Frame("Instructions");

            frame4.Add(infoWdgtWrapper);
            frame4.ShadowType = ShadowType.In;
            hpaned1.Pack1(frame1, false, false);
            hpaned1.Pack2(frame2, true, false);
            hpaned2.Pack1(ctxFrame, true, false);
            hpaned2.Pack2(frame4, true, false);
            hpaned1.ShowAll();
            Alignment halign = new Alignment(0, 0, 1, 1);

            halign.Add(hpaned1);

            vpaned1.Pack2(halign, false, false);
            vpaned1.Show();

            graphView.OnGraphObjectSelected += OnGraphObjectSelected;
            graphView.OnGraphObjectMoved    += OnGraphObjectMoved;
            //combobox1.Changed += OnComboBox1SelectedValueChanged;

            contextMenuHelper              = new ContextMenuHelper(graphView.MainWidget);
            contextMenuHelper.ContextMenu += OnPopup;

            ContextMenu.SelectionDone += OnContextMenuDeactivated;
            ContextMenu.Mapped        += OnContextMenuRendered;

            // Ensure the menu is populated
            Select(null);
        }
示例#22
0
 public IEditorElement CreateCulledEditorElement(int editorIndex, IPropertyView iw, string title) => new EditorElement(editorIndex, iw, true)
 {
     name = title
 };