public void Creates_A_New_Database_If_No_Database_Has_Been_Previously_Loaded() { IDatabaseForm form = MockRepository.GenerateMock <IDatabaseForm>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); DatabasePresenter presenter = new DatabasePresenter(panel, form); AutoResetEvent arEvent = new AutoResetEvent(false); presenter.NewDatabaseCreated += (sender, e) => arEvent.Set(); Assert.That(presenter.Database, Is.Null); form.Stub(t => t.SelectedDatabaseType).Return(DatabaseTypes.SQLCE); form.Stub(t => t.SelectedDatabase).Return("1Table3Columns.sdf"); var raiser = form.GetEventRaiser(t => t.RefreshSchema += null); raiser.Raise(form, null); Assert.That(arEvent.WaitOne(10000, true), "The test timed out waiting for the NewDatabaseCreated event to be triggered"); Assert.That(presenter.Database, Is.Not.Null); Assert.That(presenter.Database.Name, Is.EqualTo("1Table3Columns")); }
public void The_Presenter_Refreshes_The_Database_And_Attempts_To_Show_The_Results() { IDatabaseForm form = MockRepository.GenerateMock <IDatabaseForm>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); IDatabase db = MockRepository.GenerateStub <IDatabase>(); db.Stub(d => d.Tables).Return(new ReadOnlyCollection <ITable>(new List <ITable>())); var presenter = new DatabasePresenter(panel, form); presenter.AttachToModel(db); AutoResetEvent arEvent = new AutoResetEvent(false); presenter.SchemaRefreshed += (sender, e) => arEvent.Set(); form.Stub(t => t.SelectedDatabaseType).Return(DatabaseTypes.SQLCE); form.Stub(t => t.SelectedDatabase).Return("1Table3Columns.sdf"); var raiser = form.GetEventRaiser(t => t.RefreshSchema += null); raiser.Raise(form, null); Assert.That(arEvent.WaitOne(10000, true), "The test timed out waiting for the SchemaRefreshed event to be triggered"); panel.AssertWasCalled(p => p.ShowDatabaseRefreshResults( Arg <DatabaseMergeResult> .Matches(t => t.TableOperations.Count() == 1))); }
public void Triggering_The_AddProperty_Event_Adds_A_New_Property_To_The_Entity() { IMainPanel mainPanel = MockRepository.GenerateStub <IMainPanel>(); IEntityForm form = MockRepository.GenerateMock <IEntityForm>(); Entity entity = new EntityImpl("Entity1") { Key = new EntityKeyImpl() }; entity.AddProperty(new PropertyImpl("Prop1")); form.Expect(f => f.SetProperties(Arg <IEnumerable <Property> > .List.ContainsAll(entity.ConcreteProperties))); var presenter = new EntityPresenter(mainPanel, form); presenter.AttachToModel(entity); form.Raise(f => f.AddNewProperty += null, form, new EventArgs()); Assert.That(entity.Properties.Count(), Is.EqualTo(2)); form.AssertWasCalled(f => f.Mappings = entity.Mappings(), c => c.Repeat.Twice()); form.AssertWasCalled(f => f.SetSelectedPropertyName(entity.Properties.ElementAt(1))); form.VerifyAllExpectations(); }
public void The_Presenter_Fills_In_The_Form() { IMainPanel mainPanel = MockRepository.GenerateStub <IMainPanel>(); IReferenceForm form = MockRepository.GenerateMock <IReferenceForm>(); Reference reference = TestHelper.GetReference(); //var presenter = new ReferencePresenter(mainPanel, form); //presenter.AttachToModel(reference); form.AssertWasCalled(f => f.Clear()); form.AssertWasCalled(f => f.Entity1 = reference.Entity1); form.AssertWasCalled(f => f.Entity2 = reference.Entity1); form.AssertWasCalled(f => f.End1Enabled = reference.End1Enabled); form.AssertWasCalled(f => f.End2Enabled = reference.End2Enabled); form.AssertWasCalled(f => f.End1Name = reference.End1Name); form.AssertWasCalled(f => f.End2Name = reference.End2Name); form.AssertWasCalled(f => f.End1Cardinality = reference.Cardinality1); form.AssertWasCalled(f => f.End2Cardinality = reference.Cardinality2); form.AssertWasCalled(f => f.EntityList = reference.EntitySet.Entities); form.AssertWasCalled(f => f.MappedTableList = reference.PossibleMappedTables()); form.AssertWasCalled(f => f.MappedRelationshipList = reference.PossibleMappedRelationships()); form.AssertWasCalled(f => f.MappedTable = reference.MappedTable()); form.AssertWasCalled(f => f.MappedRelationship = reference.MappedRelationship()); form.AssertWasCalled(f => f.SetVirtualProperties(reference.Ex)); }
public IndexPresenter(IMainPanel panel, IIndexForm form) : base(panel) { this.form = form; SetupForm(); form.IndexNameChanged += (sender, e) => { if (!Detached) { Index.Name = form.IndexName; } }; form.DatatypeChanged += (sender, e) => { if (!Detached) { Index.Datatype = form.Datatype; } }; form.DescriptionChanged += (sender, e) => { if (!Detached) { Index.Description = form.Description; } }; form.SelectedColumnChanged += (sender, e) => { if (!Detached) { mainPanel.ShowObjectPropertyGrid(form.SelectedColumn); } }; form.DeleteColumn += form_DeleteColumn; }
public PropertyPresenter(IMainPanel panel, IPropertyForm form) : base(panel) { this.form = form; form.DatatypeChanged += (s, e) => { if (!Detached) { property.Type = form.Datatype; } }; form.PropertyNameChanged += (s, e) => { if (!Detached) { property.Name = form.PropertyName; } }; form.ReadOnlyChanged += (s, e) => { if (!Detached) { property.ReadOnly = form.ReadOnly; } }; form.IsKeyChanged += (s, e) => { if (!Detached) { property.IsKeyProperty = form.IsKeyProperty; } }; form.RemoveProperty += form_RemoveProperty; form.ShouldShowNullable = true; form.ShouldShowReadOnly = true; form.ShouldShowIsKeyProperty = true; SetupForm(); }
public void Triggering_The_CreateTable_Event_Creates_A_Table_With_One_To_One_Mapping_To_The_Entity() { IMainPanel mainPanel = MockRepository.GenerateStub <IMainPanel>(); IEntityForm form = MockRepository.GenerateMock <IEntityForm>(); Entity entity = new EntityImpl("Entity1"); entity.AddProperty(new PropertyImpl("Property1") { Type = "System.Int32" }); EntitySet entitySet = new EntitySetImpl(); entitySet.AddEntity(entity); IDatabase database = new Database("DB1"); new MappingSetImpl(database, entitySet); var presenter = new EntityPresenter(mainPanel, form); presenter.AttachToModel(entity); form.Raise(f => f.CreateNewTableFromEntity += null, form, new EventArgs()); Assert.That(database.Tables.Count, Is.EqualTo(1)); ITable table = database.Tables[0]; Assert.That(table.Name, Is.EqualTo("Entity1s")); Assert.That(table.Columns.Count, Is.EqualTo(1)); Assert.That(table.Columns[0].Name, Is.EqualTo("Property1")); }
public EntityPresenter(IMainPanel mainPanel, IEntityForm form) : base(mainPanel) { this.form = form; form.NameChanged += (sender, e) => { if (!Detached) { entity.Name = form.EntityName; } }; form.AddNewProperty += form_AddNewProperty; form.PropertyNameChanged += form_PropertyNameChanged; form.CreateNewTableFromEntity += form_CreateNewTableFromEntity; form.RemoveEntity += form_RemoveEntity; form.RemoveProperty += form_RemoveProperty; form.EditProperty += form_EditProperty; form.MappingsChanged += form_MappingsChanged; form.NewMappingAdded += form_NewMappingAdded; form.CopyProperty += form_CopyProperty; form.MappingRemoved += form_MappingRemoved; form.SingleMappingChanged += form_SingleMappingChanged; form.DiscriminatorChanged += form_DiscriminatorChanged; form.ParentEntityChanged += form_ParentEntityChanged; form.ChildEntityAdded += form_ChildEntityAdded; form.ChildEntityRemoved += form_ChildEntityRemoved; SetupForm(); }
public void SetUp() { mainPanel = MockRepository.GenerateStub <IMainPanel>(); form = MockRepository.GenerateMock <IEntityForm>(); ms = MockRepository.GenerateStub <MappingSet>(); Property property = new PropertyImpl("Prop1"); EntityKey key = new EntityKeyImpl(); entity = new EntityImpl("Entity1") { Key = key }; entity.AddProperty(property); key.AddProperty(property); mapping = new MappingImpl(); form.Stub(f => f.Mappings).Return(new List <Mapping> { mapping }); EntitySet es = new EntitySetImpl(); es.AddEntity(entity); ms.EntitySet = es; es.MappingSet = ms; ms.Stub(m => m.GetMappingsContaining(entity)).Return(new List <Mapping>()); var presenter = new EntityPresenter(mainPanel, form); presenter.AttachToModel(entity); }
public KeyPresenter(IMainPanel panel, IKeyForm form) : base(panel) { this.form = form; SetupForm(); form.KeyNameChanged += (sender, e) => { if (!Detached) { Key.Name = form.KeyName; } }; form.KeytypeChanged += (sender, e) => { if (!Detached) { Key.Keytype = form.Keytype; } }; form.DescriptionChanged += (sender, e) => { if (!Detached) { Key.Description = form.Description; } }; form.EditColumn += (sender, e) => { if (!Detached) { mainPanel.ShowObjectPropertyGrid(form.SelectedColumn); } }; form.DeleteKey += form_DeleteKey; form.AddNewColumn += form_AddNewColumn; form.RemoveColumn += form_RemoveColumn; }
public DatabaseTablePresenter(IMainPanel panel, ITableForm form) : base(panel) { this.form = form; SetupForm(); form.DeleteEntity += form_DeleteEntity; form.AddNewColumn += form_AddNewColumn; form.DeleteColumn += form_DeleteColumn; form.AddNewKey += form_AddNewKey; form.DeleteKey += form_DeleteKey; form.EntityNameChanged += (sender, e) => { if (!Detached) { Table.Name = form.EntityName; } }; form.DescriptionChanged += (sender, e) => { if (!Detached) { Table.Description = form.Description; } }; form.EditColumn += ((s, e) => { if (Detached) { return; } mainPanel.ShowObjectPropertyGrid(e.Object); }); form.EditKey += ((s, e) => { if (Detached) { return; } mainPanel.ShowObjectPropertyGrid(e.Object); }); }
public void The_DatabaseName_Is_Wired_Up_Correctly_With_Database() { IDatabaseForm form = MockRepository.GenerateMock <IDatabaseForm>(); Database obj = new Database("Database1"); ISQLServer2005DatabaseConnector connector = MockRepository.GenerateStub <ISQLServer2005DatabaseConnector>(); connector.ConnectionInformation = new ConnectionStringHelper { UserName = "******", Password = "******", ServerName = "Server", UseFileName = false }; connector.DatabaseName = "DatabaseName"; obj.Loader = new SQLServer2005DatabaseLoader(connector); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); var presenter = new DatabasePresenter(panel, form); presenter.AttachToModel(obj); form.AssertWasCalled(a => a.SelectedDatabaseType = DatabaseTypes.SQLServer2005); form.AssertWasCalled(a => a.SetDatabase("DatabaseName")); form.AssertWasCalled(a => a.Username = "******"); form.AssertWasCalled(a => a.Password = "******"); form.AssertWasCalled(a => a.SelectedServerName = "Server"); form.AssertWasCalled(a => a.DatabaseHelper = Arg <IServerAndDatabaseHelper> .Is.NotNull); }
public void Setup() { mainPanel = MockRepository.GenerateStub <IMainPanel>(); form = MockRepository.GenerateMock <IMappingForm>(); mapping = MockRepository.GenerateStub <Mapping>(); mapping.MappingSet = new MappingSetImpl(); //presenter = new MappingPresenter(mainPanel, form); }
public void Setup() { mainPanel = MockRepository.GenerateStub<IMainPanel>(); form = MockRepository.GenerateMock<IMappingForm>(); mapping = MockRepository.GenerateStub<Mapping>(); mapping.MappingSet = new MappingSetImpl(); //presenter = new MappingPresenter(mainPanel, form); }
public CreateOneToOneMappingPresenter(ICreateOneToOneMappingsForm form, IMainPanel mainPanel, MappingSet set) : base(mainPanel) { Form = form; Set = set; form.ChangesAccepted += (s, e) => AcceptChanges(); form.Cancelled += (s, e) => CancelChanges(); }
public void The_DatabaseHelper_Is_Filled_In() { IDatabaseForm form = MockRepository.GenerateMock <IDatabaseForm>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); new DatabasePresenter(panel, form); form.AssertWasCalled(a => a.DatabaseHelper = Arg <IServerAndDatabaseHelper> .Is.NotNull); }
/// <summary> /// Configuration panel with the Main Panel. /// </summary> /// <param name="homePanel">Main Panel interface</param> public Config(IMainPanel homePanel) { InitializeComponent(); _homePanel = homePanel; _jsonFileContent = string.Empty; cbDatabaseType.DataSource = Constants.DatabaseTypeStrings.Values.ToList(); }
public void The_Presenter_Fills_In_The_Form() { IMainPanel mainPanel = MockRepository.GenerateStub <IMainPanel>(); IEntityForm form = MockRepository.GenerateMock <IEntityForm>(); form.Expect(f => f.Mappings = null) .IgnoreArguments() .WhenCalled(action => Assert.That(((IEnumerable <Mapping>)action.Arguments[0]).Count(), Is.EqualTo(0))); form.Expect(f => f.SetAvailableTables(null)) .IgnoreArguments() .WhenCalled(action => Assert.That(((IEnumerable <ITable>)action.Arguments[0]).Count(), Is.EqualTo(0))); form.Expect(f => f.SetProperties(null)) .IgnoreArguments() .WhenCalled(action => Assert.That(((IEnumerable <Property>)action.Arguments[0]).Count(), Is.EqualTo(1))); form.Expect(f => f.SetAvailableEntities(null)) .IgnoreArguments() .WhenCalled(action => Assert.That(((IEnumerable <Entity>)action.Arguments[0]).Count(), Is.EqualTo(2))); form.Expect(f => f.SetChildEntities(null)) .IgnoreArguments() .WhenCalled(action => Assert.That(((IEnumerable <Entity>)action.Arguments[0]).Count(), Is.EqualTo(1))); Entity parentEntity = new EntityImpl("Parent"); Entity childEntity = new EntityImpl("Child"); Property property = new PropertyImpl("Prop1"); EntityKey key = new EntityKeyImpl(); Entity entity = new EntityImpl("Entity1") { Key = key }; entity.Parent = parentEntity; entity.AddChild(childEntity); entity.AddProperty(property); key.AddProperty(property); EntitySet es = new EntitySetImpl(); es.AddEntity(parentEntity); es.AddEntity(entity); es.AddEntity(childEntity); MappingSet ms = new MappingSetImpl(); ms.EntitySet = es; var presenter = new EntityPresenter(mainPanel, form); presenter.AttachToModel(entity); form.AssertWasCalled(f => f.EntityName = entity.Name); form.AssertWasCalled(f => f.Discriminator = entity.Discriminator); form.AssertWasCalled(f => f.ParentEntity = entity.Parent); form.AssertWasCalled(f => f.SetVirtualProperties(entity.Ex)); form.VerifyAllExpectations(); }
public static void Clear() { MainPanel = null; Managed = null; //SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo = null; SystemInfo = null; CacheMenu = null; CacheMenuPermissionList = new List <string>(); }
public MappingPresenter(IMainPanel panel, IMappingForm form) : base(panel) { this.form = form; form.ToEntityChanged += (s, e) => { if (!Detached) mapping.ToEntity = form.ToEntity; }; form.FromTableChanged += (s, e) => { if (!Detached) mapping.FromTable = form.FromTable; }; form.MappingsChanged += (s, e) => { if (!Detached) mapping.SetMappings(form.Mappings); }; form.RemoveMapping += form_RemoveMapping; }
public SimpleDBMergeResultPresenter( ISimpleDBMergeResultForm form, IMainPanel panel, DatabaseMergeResult results) : base(panel) { this.form = form; this.results = results; SetupForm(); }
public void Show_Was_Called() { IMainPanel mainPanel = MockRepository.GenerateStub <IMainPanel>(); IMappingForm form = MockRepository.GenerateMock <IMappingForm>(); //var presenter = new MappingPresenter(mainPanel, form); //presenter.Show(); //mainPanel.AssertWasCalled(m => m.ShowPropertyGrid(form)); }
public static void Clear() { MainPanel = null; Managed = null; //SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo = null; SystemInfo = null; CacheMenu = null; CacheMenuPermissionList = new List<string>(); }
public void Clear_Called() { ITableForm form = MockRepository.GenerateMock <ITableForm>(); ITable obj = MockRepository.GenerateMock <ITable>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new DatabaseTablePresenter(panel, form); //presenter.AttachToModel(obj); form.AssertWasCalled(f => f.Clear()); }
public EntityKeyPresenter(IMainPanel panel, IEntityKeyForm form) : base(panel) { this.form = form; form.AddNewProperty += form_AddNewProperty; form.ComponentChanged += form_ComponentChanged; form.KeyTypeChanged += form_KeyTypeChanged; form.RemoveProperty += form_RemoveProperty; form.RunKeyConversionWizard += form_RunKeyConversionWizard; }
public ComponentPresenter(IMainPanel panel, IComponentForm form) : base(panel) { this.form = form; form.PropertyMappingChanged += form_PropertyMappingChanged; form.ComponentNameChanged += form_ComponentNameChanged; form.DeleteComponent += form_DeleteComponent; SetupForm(); }
public void Form_Events_Are_Attached_To() { IPropertyForm form = MockRepository.GenerateMock <IPropertyForm>(); ComponentProperty obj = MockRepository.GenerateMock <ComponentProperty>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //new ComponentPropertyPresenter(panel, form); form.AssertWasCalled(f => f.DatatypeChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.PropertyNameChanged += null, c => c.IgnoreArguments()); }
public void Form_Events_Are_Attached_To() { IComponentForm form = MockRepository.GenerateMock <IComponentForm>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); new ComponentPresenter(panel, form); form.AssertWasCalled(f => f.PropertyMappingChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.ComponentNameChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.DeleteComponent += null, c => c.IgnoreArguments()); }
private void Test_Event_Registered(Action <ICollectionForm <IColumn> > action) { ICollectionForm <IColumn> form = MockRepository.GenerateMock <ICollectionForm <IColumn> >(); IColumnContainer obj = new Table("Table1"); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = (ItemCollectionPresenter<IColumn>) new ColumnCollectionPresenter(panel, form); //presenter.AttachToModel(obj); form.AssertWasCalled(action, c => c.IgnoreArguments()); }
public DatabasePresenter(IMainPanel mainPanel, IDatabaseForm form) : base(mainPanel) { this.form = form; SetupForm(); //form.TestConnection += (sender, e) => TestConnection(true); //form.RefreshSchema += (sender, e) => RefreshSchema(); form.DatabaseHelper = new ServerAndDatabaseHelper(); form.SelectedDatabaseTypeChanged += form_SelectedDatabaseTypeChanged; }
public RelationshipPresenter(IMainPanel mainPanel, IRelationshipForm form) : base(mainPanel) { this.form = form; SetupForm(); form.RelationshipNameChanged += (sender, e) => { if (!Detached) relationship.Name = form.RelationshipName; }; form.PrimaryKeyChanged += form_Key1Changed; form.ForeignKeyChanged += form_Key2Changed; form.DeleteRelationship += form_DeleteRelationship; }
public void Property_Changed_Registered() { IPropertyForm form = MockRepository.GenerateMock <IPropertyForm>(); ComponentProperty obj = MockRepository.GenerateMock <ComponentProperty>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //ComponentPropertyPresenter presenter = new ComponentPropertyPresenter(panel, form); //presenter.AttachToModel(obj); obj.AssertWasCalled(o => o.PropertyChanged += null, c => c.IgnoreArguments()); }
public void Clear_Called() { IKeyForm form = MockRepository.GenerateMock <IKeyForm>(); IKey obj = MockRepository.GenerateMock <IKey>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new KeyPresenter(panel, form); //presenter.AttachToModel(obj); form.AssertWasCalled(f => f.Clear()); }
public void Show_Property_Grid_Called() { IPropertyForm form = MockRepository.GenerateMock <IPropertyForm>(); ComponentProperty obj = MockRepository.GenerateMock <ComponentProperty>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //ComponentPropertyPresenter presenter = new ComponentPropertyPresenter(panel, form); //presenter.AttachToModel(obj); //presenter.Show(); //panel.AssertWasCalled(p => p.ShowPropertyGrid(form)); }
public IndexPresenter(IMainPanel panel, IIndexForm form) : base(panel) { this.form = form; SetupForm(); form.IndexNameChanged += (sender, e) => { if (!Detached) Index.Name = form.IndexName; }; form.DatatypeChanged += (sender, e) => { if (!Detached) Index.Datatype = form.Datatype; }; form.DescriptionChanged += (sender, e) => { if (!Detached) Index.Description = form.Description; }; form.SelectedColumnChanged += (sender, e) => { if (!Detached) mainPanel.ShowObjectPropertyGrid(form.SelectedColumn); }; form.DeleteColumn += form_DeleteColumn; }
public ComponentPropertyPresenter(IMainPanel panel, IPropertyForm form) : base(panel) { this.form = form; form.ShouldShowNullable = false; form.ShouldShowReadOnly = false; form.ShouldShowIsKeyProperty = false; form.DatatypeChanged += (s, e) => { if (!Detached) property.Type = form.Datatype; }; form.PropertyNameChanged += (s, e) => { if (!Detached) property.Name = form.PropertyName; }; form.RemoveProperty += form_RemoveProperty; SetupForm(); }
private void OnShowToggle(object obj) { bool @checked = ((IMenuItem)obj).IsChecked; if (viewPanel != null && viewPanel.IsOpen && !@checked) { ui.RemoveMainPanel(panelHandle); this.viewPanel = null; } else if (viewPanel == null && @checked) { this.ShowViewPanel(); } }
private void ShowViewPanel() { if (this.viewPanel != null) { ui.RemoveMainPanel(this.panelHandle); } this.viewPanel = ui.NewMainPanel(title:"Session Details", content:new SessionView()); this.viewPanel.Closed += viewPanel_Closed; this.panelHandle = ui.AddMainPanel(this.viewPanel, new PanelLocation()); this.viewMenuToggle.IsChecked = true; }
public DatabaseTablePresenter(IMainPanel panel, ITableForm form) : base(panel) { this.form = form; SetupForm(); form.DeleteEntity += form_DeleteEntity; form.AddNewColumn += form_AddNewColumn; form.DeleteColumn += form_DeleteColumn; form.AddNewKey += form_AddNewKey; form.DeleteKey += form_DeleteKey; form.EntityNameChanged += (sender, e) => { if (!Detached) Table.Name = form.EntityName; }; form.DescriptionChanged += (sender, e) => { if (!Detached) Table.Description = form.Description; }; form.EditColumn += ((s, e) => { if (Detached) return; mainPanel.ShowObjectPropertyGrid(e.Object); }); form.EditKey += ((s, e) => { if (Detached) return; mainPanel.ShowObjectPropertyGrid(e.Object); }); }
public ColumnPresenter(IMainPanel panel, IColumnForm form) : base(panel) { this.form = form; SetupForm(); form.ColumnNameChanged += (sender, e) => { if (!Detached) Column.Name = form.ColumnName; }; form.ColumnScaleChanged += (sender, e) => { if (!Detached) Column.Scale = form.ColumnScale; }; form.DatatypeChanged += (sender, e) => { if (!Detached) Column.Datatype = form.Datatype; }; form.DefaultChanged += (sender, e) => { if (!Detached) Column.Default = form.Default; }; form.DescriptionChanged += (sender, e) => { if (!Detached) Column.Description = form.Description; }; form.IsNullableChanged += (sender, e) => { if (!Detached) Column.IsNullable = form.IsNullable; }; form.OrdinalPositionChanged += (sender, e) => { if (!Detached) Column.OrdinalPosition = form.OrdinalPosition; }; form.PrecisionChanged += (sender, e) => { if (!Detached) Column.Precision = form.Precision; }; form.ColumnSizeChanged += Form_SizeChanged; form.ColumnSizeIsMaxChanged += Form_SizeChanged; form.DeleteColumn += Form_DeleteColumn; }
public ReferencePresenter(IMainPanel panel, IReferenceForm form) : base(panel) { this.form = form; SetupForm(); form.Entity1Changed += (sender, e) => { if (!Detached) reference.Entity1 = form.Entity1; }; form.Entity2Changed += (sender, e) => { if (!Detached) reference.Entity2 = form.Entity2; }; form.End1EnabledChanged += (sender, e) => { if (!Detached) reference.End1Enabled = form.End1Enabled; }; form.End2EnabledChanged += (sender, e) => { if (!Detached) reference.End2Enabled = form.End2Enabled; }; form.End1NameChanged += (sender, e) => { if (!Detached) reference.End1Name = form.End1Name; }; form.End2NameChanged += (sender, e) => { if (!Detached) reference.End2Name = form.End2Name; }; form.End1CardinalityChanged += (sender, e) => { if (!Detached) reference.Cardinality1 = form.End1Cardinality; }; form.End2CardinalityChanged += (sender, e) => { if (!Detached) reference.Cardinality2 = form.End2Cardinality; }; form.MappedTableChanged += form_MappedTableChanged; form.MappedRelationshipChanged += form_MappedRelationshipChanged; form.DeleteRelationship += form_DeleteRelationship; }
public void SetUp() { mainPanel = MockRepository.GenerateStub<IMainPanel>(); form = MockRepository.GenerateMock<IEntityForm>(); ms = MockRepository.GenerateStub<MappingSet>(); Property property = new PropertyImpl("Prop1"); EntityKey key = new EntityKeyImpl(); entity = new EntityImpl("Entity1") { Key = key }; entity.AddProperty(property); key.AddProperty(property); mapping = new MappingImpl(); form.Stub(f => f.Mappings).Return(new List<Mapping> { mapping }); EntitySet es = new EntitySetImpl(); es.AddEntity(entity); ms.EntitySet = es; es.MappingSet = ms; ms.Stub(m => m.GetMappingsContaining(entity)).Return(new List<Mapping>()); var presenter = new EntityPresenter(mainPanel, form); presenter.AttachToModel(entity); }
public EntityPresenter(IMainPanel mainPanel, IEntityForm form) : base(mainPanel) { this.form = form; form.NameChanged += (sender, e) => { if (!Detached) entity.Name = form.EntityName; }; form.AddNewProperty += form_AddNewProperty; form.PropertyNameChanged += form_PropertyNameChanged; form.CreateNewTableFromEntity += form_CreateNewTableFromEntity; form.RemoveEntity += form_RemoveEntity; form.RemoveProperty += form_RemoveProperty; form.EditProperty += form_EditProperty; form.MappingsChanged += form_MappingsChanged; form.NewMappingAdded += form_NewMappingAdded; form.CopyProperty += form_CopyProperty; form.MappingRemoved += form_MappingRemoved; form.SingleMappingChanged += form_SingleMappingChanged; form.DiscriminatorChanged += form_DiscriminatorChanged; form.ParentEntityChanged += form_ParentEntityChanged; form.ChildEntityAdded += form_ChildEntityAdded; form.ChildEntityRemoved += form_ChildEntityRemoved; SetupForm(); }
private void viewPanel_Closed(object obj) { this.viewPanel = null; this.viewMenuToggle.IsChecked = false; }
public int AddMainPanel(IMainPanel panel, PanelLocation preferredLocation) { if (lastTabID == Int32.MaxValue) throw new IndexOutOfRangeException(); if (panel.GetType() != typeof(MainPanel)) { throw new IncompatibleObjectException(panel); } MainPanel mainPanel = (MainPanel)panel; mainPanel.Closed += (sender) => { this.RemoveMainPanel((MainPanel)sender); }; if (preferredLocation.Side == PanelSide.Any) { this.leftTabControl.AddTab(mainPanel.GetTabItem()); preferredLocation = new PanelLocation(PanelSide.Left); } else if (preferredLocation.Side == PanelSide.Left) { this.leftTabControl.AddTab(mainPanel.GetTabItem()); } else if (preferredLocation.Side == PanelSide.Right) { this.rightTabControl.AddTab(mainPanel.GetTabItem()); } else throw new NotImplementedException(); // Use the preferred location to start mainPanel.Location = preferredLocation; panels.Add(lastTabID, mainPanel); mainPanel.IsOpen = true; return lastTabID++; }
protected PresenterBase(IMainPanel mainPanel) { this.mainPanel = mainPanel; Detached = true; }
public static void Clear() { MainPanel = null; CacheMenuPermissionList = new List<string>(); }