public ScenePlayer(DmxFramework.Fixtures.Fixture pFixture) { InitializeComponent(); MySceneStateChangedDelegate = new delegate_SceneStateChanged(ChangeSceneState); this.TabText = pFixture.Name; this.Text = pFixture.Name; mFixture = pFixture; mSceneManager = mFixture.Manager; this.tableLayoutPanel1.Controls.Clear(); this.tableLayoutPanel1.ColumnCount = 0; this.tableLayoutPanel1.RowCount = 0; this.tableLayoutPanel1.AutoScroll = true; if (mSceneManager.RowCount == 0 || mSceneManager.ColumnCount == 0) { return; } int pourcentage = 100 / mSceneManager.RowCount; this.tableLayoutPanel1.RowStyles.Clear(); this.tableLayoutPanel1.RowCount = mSceneManager.RowCount; for (int i = 0; i < mSceneManager.RowCount; i++) { this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, pourcentage)); } //set columns ... pourcentage = 100 / mSceneManager.ColumnCount; this.tableLayoutPanel1.ColumnStyles.Clear(); this.tableLayoutPanel1.ColumnCount = mSceneManager.ColumnCount; for (int i = 0; i < mSceneManager.ColumnCount; i++) { this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, pourcentage)); } foreach (DmxFramework.Scene.Scene sce in mSceneManager.Scenes) { if (sce.BtnX < 1 || sce.BtnY < 1 || sce.BtnX > mSceneManager.ColumnCount || sce.BtnY > mSceneManager.RowCount) { continue; } DmxSoft.Control.SceneButton sceneBtn = new DmxSoft.Control.SceneButton(sce); sceneBtn.Dock = System.Windows.Forms.DockStyle.Fill; sceneBtn.Location = new System.Drawing.Point(4, 4); this.tableLayoutPanel1.Controls.Add(sceneBtn, sce.BtnX - 1, sce.BtnY - 1); } mSceneManager.OnSceneManagerStateChanged += new DmxFramework.Scene.OnSceneManagerStateChangedHandler(mSceneManager_OnSceneManagerStateChanged); mSceneManager_OnSceneManagerStateChanged(mSceneManager, mSceneManager.State); }
private IDockContent GetContentFromPersistString(string persistString) { if (persistString == typeof(Forms.Explorer).ToString()) { mExplorer = new DmxSoft.Forms.Explorer(mFrameWork); return(mExplorer); } else { string[] parsedStrings = persistString.Split(new char[] { ',' }); if (parsedStrings[0] == typeof(Forms.AdvancedForm).ToString()) { if (parsedStrings.Length > 1) { DmxFramework.Fixtures.Fixture Fixture = mFrameWork.GetFixtureFromPath(parsedStrings[1]); if (Fixture == null) { return(null); } return(new Forms.AdvancedForm(Fixture)); } } else if (parsedStrings[0] == typeof(Forms.ScenePlayer).ToString()) { if (parsedStrings.Length > 1) { return(new Forms.ScenePlayer(mFrameWork.GetFixtureFromPath(parsedStrings[1]))); } } else if (parsedStrings[0] == typeof(Forms.AutoModeConfiguration).ToString()) { if (parsedStrings.Length > 1) { return(new Forms.AutoModeConfiguration(Convert.ToInt16(parsedStrings[1]))); } } else if (parsedStrings[0] == typeof(Forms.DmxOutPut).ToString()) { if (parsedStrings.Length > 1) { DmxFramework.Fixtures.Fixture Fixture = mFrameWork.GetFixtureFromPath(parsedStrings[1]); if (Fixture == null) { return(null); } return(new Forms.DmxOutPut(Fixture)); } else { return(new Forms.DmxOutPut(mFrameWork)); } } else if (parsedStrings[0] == typeof(Forms.SceneExplorer).ToString()) { if (parsedStrings.Length > 1) { return(new Forms.SceneExplorer(mFrameWork.GetFixtureFromPath(parsedStrings[1]))); } } } return(null); }