Exemple #1
0
        public Main()
        {
            InitializeComponent();

            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
            this.dockContentLayout = new DeserializeDockContent(this.GetLayout);
        }
        private void AdditionalCancerRiskFactorsView_Load(object sender, EventArgs e)
        {
            if (!ViewClosing)
            {
                theDockPanel.AllowEndUserDocking = SessionManager.Instance.AllowDockDragAndDrop;

                string configFile = SessionManager.SelectDockConfig("AdditionalCancerRiskFactorsView.config");
                DeserializeDockContent m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

                if (File.Exists(configFile))
                {
                    theDockPanel.LoadFromXml(configFile, m_deserializeDockContent);

                }
                else
                {
                    bcrf = new BreastCancerRiskFactors();
                    bcrf.Show(theDockPanel);
                    bcrf.DockState = DockState.Document;

                    ccrf = new ColonCancerRiskFactors();
                    ccrf.Show(theDockPanel);
                    ccrf.DockState = DockState.Document;
                }
            }
        }
Exemple #3
0
		public MainForm()
		{
			InitializeComponent();

#if DockSample1 // todo		// eucaly, 151205
			SetSplashScreen();
#endif      // eucaly, 151205
			Text = "logPLot - program loading";		// Form Title		// eucaly, 151205
			CreateStandardControls();

			showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
			RightToLeftLayout = showRightToLeft.Checked;
			// m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
			m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
			
#if DockSample1 // todo		// eucaly, 151205
			vS2012ToolStripExtender1.DefaultRenderer = _toolStripProfessionalRenderer;
			vS2012ToolStripExtender1.VS2012Renderer = _vs2012ToolStripRenderer;
			vS2012ToolStripExtender1.VS2013Renderer = _vs2013ToolStripRenderer;
#endif      // eucaly, 151205

			this.topBar.BackColor = this.bottomBar.BackColor = Color.FromArgb(0xFF, 41, 57, 85);

			SetSchema(this.menuItemSchemaVS2013Blue, null);
		}
        private void DiagnosticReportsView_Load(object sender, EventArgs e)
        {
            if (!ViewClosing)
            {
                theDockPanel.AllowEndUserDocking = SessionManager.Instance.AllowDockDragAndDrop;
                string configFile = SessionManager.SelectDockConfig("RiskClinicDiagnosticReportsViewDockPanel.config");

                DeserializeDockContent m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

                if (File.Exists(configFile))
                    theDockPanel.LoadFromXml(configFile, m_deserializeDockContent);
                else
                {
                    tv = new TestsView();
                    tv.InitialDx = InitialDx;
                    tv.Show(theDockPanel);
                    tv.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Document;

                    ov = new OrdersView();
                    ov.Show(theDockPanel);
                    ov.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Document;
                }

                patientRecordHeader1.setPatient(SessionManager.Instance.GetActivePatient());
            }
        }
Exemple #5
0
        private void CancerRiskView_Load(object sender, EventArgs e)
        {
            if (!ViewClosing)
            {
                theDockPanel.AllowEndUserDocking = SessionManager.Instance.AllowDockDragAndDrop;

                string configFile = SessionManager.SelectDockConfig("CancerRiskViewDockPanel.config");
                DeserializeDockContent m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

                if (File.Exists(configFile))
                {
                    theDockPanel.LoadFromXml(configFile, m_deserializeDockContent);

                }
                else
                {
                    colorv = new ColoEndoCancerRiskView();
                    colorv.Show(theDockPanel);
                    colorv.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Document;

                    bocrv = new BrOvCancerRiskView();
                    bocrv.Show(theDockPanel);
                    bocrv.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Document;

                }

                bocrv.SetOvarianRiskVisibility(true);
            }
        }
        public Main()
        {
            InitializeComponent();

            MainMenuStrip.MdiWindowListItem = windowToolStripMenuItem;
            m_xmlNodeExplorer.RightToLeftLayout = RightToLeftLayout;
            m_serverExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            m_serverExplorer.SQLServerSelected += new EventHandler<ServerTreeEventArgs>(m_serverExplorer_SQLServerSelected);
            m_serverExplorer.DBSelected += new EventHandler<DBTreeEventArgs>(m_serverExplorer_DBSelected);
            m_serverExplorer.DBUnSelected += new EventHandler<DBTreeEventArgs>(m_serverExplorer_DBUnSelected);
            m_serverExplorer.SchemaGenerationStarted += new EventHandler<DBTreeEventArgs>(m_serverExplorer_SchemaGenerationStarted);
            m_serverExplorer.SchemaCompareStarted += new EventHandler<SchemaGeneratedEventArgs>(m_serverExplorer_SchemaCompareStarted);
            m_serverExplorer.SchemaGenerated += new EventHandler<DBTreeEventArgs>(m_serverExplorer_SchemaGenerated);
            m_serverExplorer.SchemaCompared += new EventHandler<SchemaGeneratedEventArgs>(m_serverExplorer_SchemaCompared);
            m_serverExplorer.TableSelected += new EventHandler<TableTreeEventArgs>(m_serverExplorer_TableSelected);
            m_serverExplorer.TableUnSelected += new EventHandler<TableTreeEventArgs>(m_serverExplorer_TableUnSelected);
            m_serverExplorer.TableCompareStarted += new EventHandler<TableTreeEventArgs>(m_serverExplorer_TableCompareStarted);
            dockPanel.ContentAdded += new EventHandler<DockContentEventArgs>(dockPanel_ContentAdded);
            dockPanel.ContentRemoved += new EventHandler<DockContentEventArgs>(dockPanel_ContentRemoved);
            dockPanel.ActiveDocumentChanged += new EventHandler(dockPanel_ActiveDocumentChanged);
            dockPanel.ActiveContentChanged += new EventHandler(dockPanel_ActiveContentChanged);
            windowToolStripMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(windowToolStripMenuItem_DropDownItemClicked);

            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            optionsFileName = Path.Combine(appPath, "options.config");
            configFileName = Path.Combine(appPath, "dockPanel.config");
            windowsSettingsFile = Path.Combine(appPath, "windows.config");

            btnHTML.Enabled = true;

            this.progressIndicator.Visible = false;
        }
Exemple #7
0
 //-------------------------------------------------------------------------------------------------------------------------------
 public MainFrm(string configFile)
 {
     InitializeComponent();
     this.configFile = configFile;
     //decerialization helper
     m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
 }
Exemple #8
0
        public SpriteForm()
        {
            InitializeComponent();

            _currentPath = Extensions.CheckDirectorySeparator(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            _spriteListWindow = new SpriteListWindow();
            _spriteListWindow.SpriteChanged += SpriteListWindowSpriteChanged;
            _spritePreviewWindow = new SpritePreviewWindow();
            _spriteDeltasWindow = new SpriteDeltasWindow();
            _spriteDeltasWindow.CheckedDeltaItemsChanged += SpriteDeltasWindowCheckedDeltaItemsChanged;
            _spriteRemapsWindow = new SpriteRemapsWindow();
            _spriteRemapsWindow.RemapChanged += SpriteRemapsWindowRemapChanged;

            _deserializeDockContent += DeserializeDockContent;

            var layoutFile = _currentPath + LayoutFile;
            try
            {
                dockPanel.LoadFromXml(layoutFile, _deserializeDockContent);
            }
            catch (Exception)
            {
                var stream = Assembly.GetAssembly(GetType()).GetManifestResourceStream(GetType().Namespace + ".Resources.SpriteFormDefaultLayout.xml");
                dockPanel.LoadFromXml(stream, _deserializeDockContent);
                if (stream != null)
                    stream.Close();
            }

            //Thread
            LoadPalette(_currentPath + Globals.GraphicsSubDir + Path.DirectorySeparatorChar + Globals.PaletteSuffix + Globals.TextureImageFormat);
            LoadSprites(_currentPath + Globals.GraphicsSubDir + Path.DirectorySeparatorChar + Globals.SpritesSuffix + Globals.XmlFormat);
            LoadDeltas(_currentPath + Globals.GraphicsSubDir + Path.DirectorySeparatorChar + Globals.DeltasSuffix + Globals.XmlFormat);
            CreateSpriteData(_spriteListWindow.TextureAltas);
        }
Exemple #9
0
        public MainForm()
        {
            InitializeComponent();
			_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            _threadList = new Dictionary<string, Thread>();
            _taskManagerList = new Dictionary<string, TaskManager>();
            _hasRemindDialog = false;
        }
        public FrmMain()
        {
            InitializeComponent();
            var splash = new FrmSplash();

              //      splash.Show();
            _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }
Exemple #11
0
		public MainForm2() {
			InitializeComponent();
			showRightToLeft.Checked = ( RightToLeft == RightToLeft.Yes );
			RightToLeftLayout = showRightToLeft.Checked;
			m_solutionExplorer = new DummySolutionExplorer();
			m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
			m_deserializeDockContent = new DeserializeDockContent( GetContentFromPersistString );
		}
 public MainForm()
 {
     InitializeComponent();
     CreateMDIForm();
     //iReaperNotifyManager.InitSysIcon(this.components);
     Application.Idle += new EventHandler(Application_Idle);
     CoreData.CoreDataContent[CoreDataTypes.ApplicationForm] = this;
     this.deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
 }
        public FormMain()
        {
            InitializeComponent();
            this.Shown += FormMain_Shown;
            this.WindowState = FormWindowState.Maximized;
            CreateStandardControls();

            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }
 public static void LoadFromXml(DockPanel dockPanel, string fileName,
     DeserializeDockContent deserializeContent)
 {
     FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
     try{
         LoadFromXml(dockPanel, fs, deserializeContent);
     } finally{
         fs.Close();
     }
 }
Exemple #15
0
		public DataCreator()
		{
			DOMConfigurator.Configure();

			m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
			InitializeComponent();
			_frmConnection.ChangedDBEvent+=new DBConnection.ChangedDBHandler( this.ChangeDB );
			_frmConnection.ChangedServerEvent += new DBConnection.ChangedServerHandler(this.ChangeServer);
			_frmTables.ScriptEvent+= new TableForm.ScriptHandler(HandleScript);
		}
Exemple #16
0
        public Workbench(DockPanel dockPanel)
        {
            this.dockPanel = dockPanel;
            this.deserializeDockContent = new DeserializeDockContent(getContentFromPersistString);

            this.toolWorkplaceWindow = new WorkplaceExplorer(this);
            this.toolPropertyWindow = new PropertyWindow(this);
            this.toolHistoryWindow = new HistoryWindow(this);
            this.toolTaskWindow = new TaskWindow(this);

            workplaceOpenDialog = new OpenFileDialog();
            documentOpenDialog = new OpenFileDialog();
        }
Exemple #17
0
        public MainForm()
        {
            InitializeComponent();

            CreateStandardControls();

            dockPanel.Theme = new VS2012LightTheme();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }
Exemple #18
0
        public MainForm()
        {
            InitializeComponent();

            CreateStandardControls();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            SASstatusMsg.Text = "SAS Connection = Not Connected";
            Instance.mainForm = this;
        }
        public MainForm()
        {
            InitializeComponent();

            CreateStandardControls();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            vS2012ToolStripExtender1.DefaultRenderer = _system;
            vS2012ToolStripExtender1.VS2012Renderer = _custom;
        }
Exemple #20
0
        //static private GEForm _geForm;
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            _telemetryComms.InitializeComPort();
            _videoForm = new VideoForm(_telemetryComms.Data);
            _mapForm = new MapForm();
            _settingsForm = new SettingsForm();
            _outputForm = new OutputForm();
            _telemetryForm = new TelemetryForm(_telemetryComms.Data);
            //_geForm = new GEForm();

            _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }
Exemple #21
0
        /**************************************************************************************************/
        private void RiskClinicFamilyHistoryView_Load(object sender, EventArgs e)
        {
            string configFile = SessionManager.SelectDockConfig("AdminMainForm.config");

            DeserializeDockContent m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            if (File.Exists(configFile))
                theDockPanel.LoadFromXml(configFile, m_deserializeDockContent);
            else
            {
                masterParagraphView = new MasterParagraphListView();
                masterParagraphView.Show(theDockPanel);
                masterParagraphView.DockState = WeifenLuo.WinFormsUI.Docking.DockState.Document;
            }
        }
        public MainForm()
        {
            InitializeComponent();
            AutoScaleMode = AutoScaleMode.Dpi;

            SetSplashScreen();
            CreateStandardControls();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            vsToolStripExtender1.DefaultRenderer = _toolStripProfessionalRenderer;
            SetSchema(this.menuItemSchemaVS2013Blue, null);
        }
Exemple #23
0
        public FormMain()
        {
            // set static instance
            _instance = this;
            // set analysis solver
            CasePalletAnalysis.Solver = new treeDiM.StackBuilder.Engine.CasePalletSolver();
            PackPalletAnalysis.Solver = new treeDiM.StackBuilder.Engine.PackPalletSolver();
            CylinderPalletAnalysis.Solver = new treeDiM.StackBuilder.Engine.CylinderSolver();
            HCylinderPalletAnalysis.Solver = new treeDiM.StackBuilder.Engine.HCylinderSolver();
            BoxCasePalletAnalysis.Solver = new treeDiM.StackBuilder.Engine.BoxCasePalletSolver();
            BoxCaseAnalysis.Solver = new treeDiM.StackBuilder.Engine.BoxCaseSolver();
            // load content
            _deserializeDockContent = new DeserializeDockContent(ReloadContent);

            InitializeComponent();

            // plugins
            if (Properties.Settings.Default.HasPluginINTEX)
                this.toolStripSplitButtonNew.DropDownItems.Add(this.ToolStripMenuNewFileINTEX); // add new menu item in "New" ToolStripSplitButton

            // load file passed as argument
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length >= 2)
            {
                string joinedString = string.Empty;
                for (int i = 1; i < args.Length; ++i)
                    joinedString += (i > 1 ? " " : "") + args[i];
                if (File.Exists(args[1]))
                    OpenDocument(args[1]);
                else if (File.Exists(joinedString))
                    OpenDocument(joinedString);
            }
            // or show splash sceen 
            else
            {
                bool multithreaded = false;
                if (multithreaded)
                {
                    // --- instantiate and start splach screen thread
                    Thread th = new Thread(new ThreadStart(DoSplash));
                    th.Start();
                    // ---
                }
                else
                    DoSplash();
            }
        }
        public frmMain()
        {
            InitializeComponent();

            if (!FirstRun())
            {
                if (File.Exists(LayoutFile))
                {
                    dockPanel.LoadFromXml(LayoutFile, m_deserializeDockContent);
                    m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                }
            }
            else
            {
                AppSetup();
            }
        }
        //########################################### 构造和初始化 #######################################################
        //private Form_BaseClipsEditor clipsManager = null;
        public Form_MAnimation(Form_Main form_MainT)
        {
            InitializeComponent();
            form_Main = form_MainT;
            Control.CheckForIllegalCrossThreadCalls = false;
            layoutPath = Consts.PATH_EXE_FOLDER + "\\layout_local.xml";

            form_MActorList = new Form_MActorsList(this);
            form_MFrameEdit = new Form_MFrameEdit(this);
            form_MFrameLevel = new Form_MFrameLevel(this);
            form_MConfig = new Form_MConfig(this);
            form_MImgsList = new Form_MImgsList(this);
            form_MCLib = new Form_MCLib();
            form_MTimeLine = new Form_MTimeLine(this);
            form_MAnimPW = new Form_MAnimPlay(this);

            dockContentes.Add(form_MActorList);
            dockContentes.Add(form_MFrameEdit);
            dockContentes.Add(form_MFrameLevel);
            dockContentes.Add(form_MConfig);
            dockContentes.Add(form_MImgsList);
            dockContentes.Add(form_MCLib);
            dockContentes.Add(form_MTimeLine);
            dockContentes.Add(form_MAnimPW);

            for (int i = 0; i < dockContentes.Count; i++)
            {
                DockContent dockI = ((DockContent)dockContentes[i]);
                dockI.HideOnClose = true;
                dockI.DockStateChanged += new EventHandler(all_DockStateChanged);
                dockI.SizeChanged += new EventHandler(all_DockStateChanged);
                dockI.FormClosing += new FormClosingEventHandler(all_DockContentClosing);
            }
            if (File.Exists(layoutPath))
            {
                DeserializeDockContent dsd = new DeserializeDockContent(IDockContentMe);
                panel_DockPanel.LoadFromXml(layoutPath, dsd);
                refreshDockState();
            }
            else
            {
                resetPanels();
            }
            historyManager = new MA_HistoryManager(this);
        }
Exemple #26
0
        public MainForm()
        {
            InitializeComponent();

            SetSplashScreen();
            CreateStandardControls();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            vS2012ToolStripExtender1.DefaultRenderer = _toolStripProfessionalRenderer;
            vS2012ToolStripExtender1.VS2012Renderer = _vs2012ToolStripRenderer;

            vS2013ToolStripExtender1.DefaultRenderer = _toolStripProfessionalRenderer;
            vS2013ToolStripExtender1.Vs2013Renderer = _vs2013ToolStripRenderer;

            SetSchema(menuItemSchemaVS2013Light, null);
        }
Exemple #27
0
        public MainForm()
        {
            InitializeComponent();

            SetSplashScreen();
            CreateStandardControls();

            showRightToLeft.Checked = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout = showRightToLeft.Checked;
            m_solutionExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            
            vS2012ToolStripExtender1.DefaultRenderer = _toolStripProfessionalRenderer;
            vS2012ToolStripExtender1.VS2012Renderer = _vs2012ToolStripRenderer;
            vS2012ToolStripExtender1.VS2013Renderer = _vs2013ToolStripRenderer;

            this.topBar.BackColor = this.bottomBar.BackColor = Color.FromArgb(0xFF, 41, 57, 85);

            SetSchema(this.menuItemSchemaVS2013Blue, null);
        }
Exemple #28
0
        public MainForm()
        {
            InitializeComponent();
            mDeserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            // monitor name and dirty flag.
            Project.ProjectDirtyChanged += new EventHandler(UpdateTitleBar);
            Project.ProjectNameChanged += new EventHandler(UpdateTitleBar);

            // monitor range selection.
            mGraphForm.DisplayRangeChanged += new EventHandler(mGraphForm_DisplayRangeChanged);

            mJumpForm.SelectedEntryChanged += new EventHandler(mJumpForm_SelectedEntryChanged);

            // update once.
            UpdateTitleBar(null, EventArgs.Empty);

            // load settings.
            Settings.Instance.Load();
        }
Exemple #29
0
        public Mainform()
        {
            InitializeComponent();
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            try{
            core.currentUAV.Connect();
            }catch (Exception ex){
                MessageBox.Show("Verbindungsfehler: Netzwerkkarte nicht eingesteckt?");
            }

                try{
                    if (File.Exists("DefaultLayout.dat"))
                    {
                        using (FileStream stream = File.OpenRead("DefaultLayout.dat")){
                            UAVCommons.UAVBase.LoadValues(stream, core.currentUAV);
                            core.currentUAV.initialised = true;
                        }
                        }

            if (File.Exists("DefaultLayout.uav")) this.dockPanel1.LoadFromXml("DefaultLayout.uav", m_deserializeDockContent);
            }catch (Exception ex){
            MessageBox.Show("Fehler beim Laden des Standart Layouts"+ex.Message,"GroundControl");
            }
        }
 static LayoutManager()
 {
     PluginPanels        = new List <DockContent>();
     ContentDeserializer = new DeserializeDockContent(GetContentFromPersistString);
     RestoredPlugins     = new List <String>();
 }
 /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="LoadFromXml"]/*'/>
 /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="LoadFromXml(string, DeserializeDockContent)"]/*'/>
 public void LoadFromXml(string filename, DeserializeDockContent deserializeContent)
 {
     DockPanelPersist.LoadFromXml(this, filename, deserializeContent);
 }
Exemple #32
0
 /// <summary>
 ///     Loads layout from a stream.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="deserializeContent">Deserialization handler.</param>
 /// <exception cref="Exception">Deserialization might throw exceptions.</exception>
 /// <remarks>
 ///     The stream is closed after deserialization.
 /// </remarks>
 public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent)
 {
     Persistor.LoadFromXml(this, stream, deserializeContent, true);
 }
Exemple #33
0
        /**************************************************************************************************/
        //
        private void MainForm_Load(object sender, EventArgs e)
        {
            theDockPanel.AllowEndUserDocking = SessionManager.Instance.AllowDockDragAndDrop;

            MainFormLoading fml = new MainFormLoading();

            toolStripProgressBar1.Visible = false;
            toolStripStatusLabel1.Visible = false;

            if (fml.ShowDialog() == DialogResult.Cancel)
            {
                failedLogin = true;
                this.Close();
            }
            else
            {
                PushViewDelegate = PushViewOnMainWindow;

                string configFile = SessionManager.SelectDockConfig("MainFormDockPanel.config");
                DeserializeDockContent m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                if (File.Exists(configFile))
                {
                    try
                    {
                        theDockPanel.LoadFromXml(configFile, m_deserializeDockContent);
                    }
                    catch (NullDockingConfigException)
                    {
                        InitDefaultConfig();
                    }
                }
                else
                {
                    InitDefaultConfig();
                }

                startRiskServiceAvailabilityChecking();

                if (bid != null)
                {
                    bid.SetRoleAccess(fml.roleName);
                }

                switch (fml.roleName)
                {
                // Administrative Staff cannot access PMR data (i.e., the dashboard and reports); can access other Utilities menu items.
                case "Administrative Staff":
                    if (rcd != null)
                    {
                        rcd.Enabled = false;
                        rcd.Visible = false;
                    }



                    standardAndRiskClinicReportsToolStripMenuItem.Enabled = false;
                    clinicReportToolStripMenuItem.Enabled        = false;
                    auditReportsToolStripMenuItem.Enabled        = false;
                    editPedigreeSymbolsToolStripMenuItem.Enabled = false;

                    toolStripSeparator4.Visible = false;
                    toolStripSeparator5.Visible = false;
                    standardAndRiskClinicReportsToolStripMenuItem.Visible = false;
                    clinicReportToolStripMenuItem.Visible        = false;
                    auditReportsToolStripMenuItem.Visible        = false;
                    editPedigreeSymbolsToolStripMenuItem.Visible = false;
                    usersToolStripMenuItem.Visible          = false;
                    editSurveyListToolStripMenuItem.Visible = false;
                    editQueueParameterList.Visible          = false;
                    break;

                case "Clinician":
                    editPedigreeSymbolsToolStripMenuItem.Visible = false;
                    editProvidersToolStripMenuItem.Visible       = false;
                    usersToolStripMenuItem.Visible          = false;
                    editSurveyListToolStripMenuItem.Visible = false;
                    editQueueParameterList.Visible          = false;
                    break;

                case "Technologist":
                    editPedigreeSymbolsToolStripMenuItem.Visible = false;
                    editProvidersToolStripMenuItem.Visible       = false;
                    usersToolStripMenuItem.Visible          = false;
                    editSurveyListToolStripMenuItem.Visible = false;
                    editQueueParameterList.Visible          = false;
                    adminToolStripMenuItem.Visible          = false;
                    toolStripSeparator2.Visible             = false;
                    break;

                case "Administrator":
                    break;

                default:
                    editPedigreeSymbolsToolStripMenuItem.Enabled = false;
                    editPedigreeSymbolsToolStripMenuItem.Visible = false;
                    editSurveyListToolStripMenuItem.Visible      = false;
                    editQueueParameterList.Visible = false;
                    break;
                }
            }

            Thread.CurrentThread.Name = "MainGUI";
        }
Exemple #34
0
 public static void LoadFromXml(DockContainer dockPanel, Stream stream, DeserializeDockContent deserializeContent)
 {
     LoadFromXml(dockPanel, stream, deserializeContent, true);
 }
Exemple #35
0
 /// <summary>
 ///     Loads layout from XML file.
 /// </summary>
 /// <param name="fileName">The file name.</param>
 /// <param name="deserializeContent">Deserialization handler.</param>
 /// <exception cref="Exception">Deserialization might throw exceptions.</exception>
 public void LoadFromXml(string fileName, DeserializeDockContent deserializeContent)
 {
     Persistor.LoadFromXml(this, fileName, deserializeContent);
 }
 /// <summary>
 /// Loads layout from a stream.
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="deserializeContent">Deserialization handler.</param>
 /// <param name="deserializePane">Deserialization handler.</param>
 /// <param name="deserializeFloatWindow">Deserialization handler.</param>
 /// <exception cref="Exception">Deserialization might throw exceptions.</exception>
 /// <remarks>
 /// The stream is closed after deserialization.
 /// </remarks>
 public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent,
                         DeserializeDockPane deserializePane, DeserializeFloatWindow deserializeFloatWindow)
 {
     Persistor.LoadFromXml(this, stream, deserializeContent, deserializePane, deserializeFloatWindow, true);
 }
Exemple #37
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                #region 测试版

//#if DEBUG
//                try
//                {
//                    var apiHelper = new ApiHelper();
//                    DateTime now = apiHelper.GetDate(DateType.SysDate);
//                    if (now > AboutBox.PublishDate.AddMonths(1)) //发布一个月失效
//                    {
//                        SplashScreen.CloseSplashScreen();
//                        MsgBox.ShowErrorMessage("该测试版已失效,请下在最新版!");
//                        OpenIE(Config.ProxyHeroCloudSetting.UpdateUrl);
//                        Exit_Click(Exit, new EventArgs());
//                    }
//                }
//                catch (WebException)
//                {
//                    Config.InitErrorInfo = Config.LocalLanguage.Messages.InitializeFailed + "," +
//                                           Config.LocalLanguage.Messages.PleaseCheckNetworkSettingsAreCorrect;
//                }
//#endif

                #endregion

                #region

                _languageLoader         = new LanguageLoader();
                TimerAutoSwitchingProxy = new Timer();
                TimerAutoChangeIcon     = new Timer();

                //SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.InitializeDatabase);

                _deserializeDockContent = GetContentFromPersistString;

                SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.LoadingLanguages);
                LoadLanguage();



                #endregion

                #region 初始化配置

                GetNetConfigAndCheckVersion();

                #endregion

                #region 连接云引擎

                try
                {
                    DelegateVoid dv    = ConnectCloud;
                    var          thred = new Thread(new ThreadStart(dv));
                    thred.Start();
                }
                catch
                {
                    SetCloudStatus(Config.LocalLanguage.Messages.ConnectCloudEngineFailed, Resources.cloudno);
                }

                #endregion

                #region Hotkey

                //Hotkey hotkey = new Hotkey(this.Handle);
                //Hotkey1 = hotkey.RegisterHotkey(System.Windows.Forms.Keys.T, Hotkey.KeyFlags.MOD_CONTROL);
                //hotkey.OnHotkey += new HotkeyEventHandler(OnHotkey);

                #endregion

                #region UI

                MainToolbar.Visible = false;
                MainStatusBar.Items.Insert(2, new ToolStripSeparator());
                MainStatusBar.Items.Insert(4, new ToolStripSeparator());
                MainStatusBar.Items.Insert(6, new ToolStripSeparator());
                MainStatusBar.Items.Insert(8, new ToolStripSeparator());
                MainStatusBar.Items.Insert(10, new ToolStripSeparator());
                tsslVersion.Text = @"Version:" + Assembly.GetExecutingAssembly().GetName().Version;
                if (Config.LocalLanguage != null)
                {
                    CloudStatus.Text = Config.LocalLanguage.Messages.ConnectingCloudEngine;
                }

                _httpHelper.HttpOption.Timeout = 60 * 1000;

                SetProxyStatusLabel();
                if (Config.LocalLanguage != null)
                {
                    AutoSwitchProxyStatus.Text = Config.LocalLanguage.Messages.AutomaticSwitchingOff;
                }
                StatusLabel.Spring = true;
                SetStatusText(Config.InitErrorInfo);

                #endregion

                #region timer

                TimerAutoSwitchingProxy.Enabled  = false;
                TimerAutoSwitchingProxy.Interval = 1000;
                TimerAutoSwitchingProxy.Elapsed += timerAutoSwitchingProxy_Elapsed;

                TimerAutoChangeIcon.Enabled  = false;
                TimerAutoChangeIcon.Interval = 1000;
                TimerAutoChangeIcon.Elapsed += timerAutoChangeIcon_Elapsed;

                #endregion

                #region DockPanel

                if (Config.LocalLanguage != null)
                {
                    SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.InitializeDockPanel);
                    if (System.IO.File.Exists(Config.DockSettingFileName))
                    {
                        try
                        {
                            MainDockPanel.LoadFromXml(Config.DockSettingFileName, _deserializeDockContent);
                        }
                        catch
                        {
                            _hasDockSettingExceptioin = true;
                            if (System.IO.File.Exists(Config.DockSettingFileName))
                            {
                                SplashScreen.CloseSplashScreen();
                                System.IO.File.Delete(Config.DockSettingFileName);
                                MsgBox.ShowErrorMessage(Config.LocalLanguage.Messages.InitializeFailed);
                                Application.Exit();
                            }
                        }
                    }
                    else
                    {
                        #region dock

                        StartPage.Show(MainDockPanel, DockState.Document);
                        OutputPage.Show(MainDockPanel, DockState.DockBottomAutoHide);
                        OutputPage.Hide();
                        ProxyPage.Show(MainDockPanel, DockState.Document);

                        #endregion
                    }
                }

                #endregion

                #region

                LoadViewSetting();

                if (Config.LocalLanguage != null)
                {
                    SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.CheckUpdate);
                }
                CheckVersionAndDownLoad();

                #region 读取上次代理

                if (System.IO.File.Exists(Config.LastProxyFileName))
                {
                    ProxyData.ProxyList =
                        (List <ProxyServer>)
                        XmlHelper.XmlDeserialize(Config.LastProxyFileName, typeof(List <ProxyServer>));
                    ProxyPage.BindData();
                }

                #endregion

                if (Config.LocalLanguage != null)
                {
                    SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.LoadingPlugins);
                }
                PluginManager.LoadAllPlugins();
                //如果没有获取代理网页列表,则禁止使用
#if !DEBUG
                if (Config.ProxySiteUrlList.Count == 0)
                {
                    this.ProxyPage.Enabled = false;
                }
#endif

                SplashScreen.CloseSplashScreen();
                StartPage.Activate();
                Activate();
                if (Config.ProxyHeroCloudSetting.EnableCommercialPage == "1") //如果显示弹出广告
                {
#if !DEBUG
                    if (Config.IsChineseOs)
                    {
                        this.OpenNewTab(Config.ProxyHeroCloudSetting.CommercialUrl);
                    }
                    else
                    {
                        this.OpenNewTab(Config.ProxyHeroCloudSetting.EnglishCommercialUrl);
                    }
#else
                    OpenNewTab(Config.IsChineseLanguage
                                   ? Config.ProxyHeroCloudSetting.CommercialUrl
                                   : Config.ProxyHeroCloudSetting.EnglishCommercialUrl);
#endif
                }

                #region 用户登录
                //if (BmobUser.CurrentUser == null)
                //{
                //    var userForm = new BmobUserForm();
                //    userForm.ShowDialog();
                //}
                #endregion

                #endregion
            }
            catch (Exception ex)
            {
                SplashScreen.CloseSplashScreen();
                MsgBox.ShowExceptionMessage(ex);
            }
        }
Exemple #38
0
 public static void LoadFromXml(DockPanel dockPanel, string filename, DeserializeDockContent deserializeContent)
 {
 }
Exemple #39
0
        public void Init()
        {
            //Panels
            deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            LoadPanels();

            //Status Bar
            statusProgressBar.Visible = false;
            statusLabel.Visible       = false;

            //Settings
            EditorCore.Settings.Load();    //Load if file exists
            EditorCore.Settings.Save();    //Ensure file exists

            //Load last project
            if (File.Exists(EditorCore.Settings.LastProject))
            {
                ResourcesHandler.LoadProjectFile(EditorCore.Settings.LastProject);
                EditorCore.ProjectExplorer.ResyncAllFiles();
            }

            //Memory usage
            RefreshMemoryUsage();

            statusTimer          = new Timer();
            statusTimer.Interval = 2000;
            statusTimer.Tick    += new EventHandler(delegate
            {
                RefreshMemoryUsage();
            });
            statusTimer.Start();

//#if DEBUG

/*
 *          // * INTENT
 *          //
 *          // Debug code to generate 5000 dummy dialogues (150,000 sentences, 2,700,000 words) (Bible is less than 800,000 words)
 *          // -> 10 chapters, 10 quest each, 50 files each, 30 sentences each.
 *          //
 *          //  * USAGE
 *          //
 *          // uncomment and tweak this section
 *          // open the tool
 *          // wait one minute for the generation to finish (you can look at the chapter folders being created as a countdown)
 *          // close the tool
 *          // comment this section
 *          // reopen the tool
 *          //
 *          // * NOTES
 *          //
 *          // it's faster in release ;)
 *          // you must have a project already opened previously (LastProject != null)
 *          // you can create a 'ProjectBig' folder to store this test project, its included in the git ignore file
 *          //
 *
 *          if (ResourcesHandler.Project.ListActors.Count == 0)
 *          {
 *              ResourcesHandler.Project.AddActor(new Actor() { ID = ResourcesHandler.Project.GenerateNewActorID(), Name = "Default Speaker" });
 *          }
 *
 *          Actor defaultSpeaker = ResourcesHandler.Project.ListActors[0];
 *
 *          int indexFile = 0;
 *          for (int a = 1; a <= 10; ++a)
 *          {
 *              string chapter = string.Format("Chapter_{0:000000}", a);
 *
 *              for (int b = 1; b <= 10; ++b)
 *              {
 *                  string quest = string.Format("Quest_{0:000000}", b);
 *
 *                  for (int c = 1; c <= 50; ++c)
 *                  {
 ++indexFile;
 *                      string file = string.Format("File_{0:000000}", indexFile);
 *                      Dialogue dialogue = ResourcesHandler.CreateDialogueFile(Path.Combine(chapter, quest, file));
 *                      if (dialogue != null)
 *                      {
 *                          DialogueNode current = dialogue.RootNode;
 *                          for (int s = 1; s <= 30; ++s)
 *                          {
 *                              DialogueNodeSentence sentence = new DialogueNodeSentence();
 *                              dialogue.AddNode(sentence);
 *                              sentence.SpeakerID = defaultSpeaker.ID;
 *                              sentence.Sentence = "Hello, I'm a dialogue sentence. I'm just here to fill this void space. Please enjoy your day - " + indexFile + "_" + sentence.ID;
 *                              current.Next = sentence;
 *
 *                              current = sentence;
 *                          }
 *
 *                          ResourcesHandler.SaveDialogue(dialogue);
 *                      }
 *                  }
 *              }
 *          }
 *
 *          EditorCore.ProjectExplorer.ResyncAllFiles();
 */
//#endif
        }
Exemple #40
0
 public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent)
 {
 }
Exemple #41
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //this.TerminalForm.PortOpen += TerminalForm_PortOpen;
            //this.TerminalForm.PortClose += TerminalForm_PortClose;

            string configFile = this.DockPanelConfigFile;

            if (!File.Exists(configFile))
            {
            }
            else
            {
                try
                {
                    deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanel1.LoadFromXml(configFile, this.deserializeDockContent);
                }
                catch (Exception ex)
                {
                    Helpers.ErrorBox(ex.Message + "\r\n\r\n" + "请重新启动程序!");
                    this.TerminalForm.Close();
                    this.Close();
                    return;
                }
            }

            this.CurretPortName = Properties.Settings.Default.PortName;

            if (this.TerminalForm == null)
            {
                this.TerminalForm = new TerminalForm();
                this.TerminalForm.Show(this.dockPanel1, DockState.DockBottom);
            }
            if (this.yunfile == null)
            {
                this.yunfile = new yunfile(this);
                this.yunfile.Show(this.dockPanel1, DockState.DockLeft);
                this.yunfile.Hide();
            }
            //
            //if (!this.ComportIsExists)
            //{
            //    this.btnConnect.Enabled = false;
            //    MessageBox.Show($"Serialport \"{this.CurretPortName}\" does not exists!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
            //else
            //{
            this.btnConnect.Enabled = true;
            //}
            this.UpdateUI();
            //打开关联文件
            string command = Environment.CommandLine;//获取进程命令行参数

            string[] para = command.Split('\"');

            if (para.Length > 3)
            {
                string pathC = para[3];//获取打开的文件的路径
                //下面就可以自己编写代码使用这个pathC参数了
                //FileStream fs = new FileStream(pathC, FileMode.Open, FileAccess.Read);
                FileFormats ff = EditorForm.EditorFileFormats;
                OpenFromFile(pathC, ff);
                MessageBox.Show(pathC);
            }
        }
Exemple #42
0
        public FormMain()
        {
            InitializeComponent();

            _DeserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
        }
 /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="LoadFromXml(Stream, DeserializeDockContent)"]/*'/>
 public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent)
 {
     DockPanelPersist.LoadFromXml(this, stream, deserializeContent);
 }
Exemple #44
0
            public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
            {
                if (dockPanel.Contents.Count != 0)
                {
                    throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
                }

                XmlTextReader xmlIn = new XmlTextReader(stream);

                xmlIn.WhitespaceHandling = WhitespaceHandling.None;
                xmlIn.MoveToContent();

                while (!xmlIn.Name.Equals("DockPanel"))
                {
                    if (!MoveToNextElement(xmlIn))
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                }

                string formatVersion = xmlIn.GetAttribute("FormatVersion");

                if (!IsFormatVersionValid(formatVersion))
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
                }

                DockPanelStruct dockPanelStruct = new DockPanelStruct();

                dockPanelStruct.DockLeftPortion         = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
                dockPanelStruct.DockRightPortion        = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
                dockPanelStruct.DockTopPortion          = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
                dockPanelStruct.DockBottomPortion       = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
                dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"), CultureInfo.InvariantCulture);
                dockPanelStruct.IndexActivePane         = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);

                // Load Contents
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "Contents")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                ContentStruct[] contents = LoadContents(xmlIn);

                // Load Panes
                if (xmlIn.Name != "Panes")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                PaneStruct[] panes = LoadPanes(xmlIn);

                // Load DockWindows
                if (xmlIn.Name != "DockWindows")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);

                // Load FloatWindows
                if (xmlIn.Name != "FloatWindows")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);

                if (closeStream)
                {
                    xmlIn.Close();
                }

                dockPanel.SuspendLayout(true);

                dockPanel.DockLeftPortion   = dockPanelStruct.DockLeftPortion;
                dockPanel.DockRightPortion  = dockPanelStruct.DockRightPortion;
                dockPanel.DockTopPortion    = dockPanelStruct.DockTopPortion;
                dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;

                // Set DockWindow ZOrders
                int prevMaxDockWindowZOrder = int.MaxValue;

                for (int i = 0; i < dockWindows.Length; i++)
                {
                    int maxDockWindowZOrder = -1;
                    int index = -1;
                    for (int j = 0; j < dockWindows.Length; j++)
                    {
                        if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
                        {
                            maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
                            index = j;
                        }
                    }

                    dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
                    prevMaxDockWindowZOrder = maxDockWindowZOrder;
                }

                // Create Contents
                for (int i = 0; i < contents.Length; i++)
                {
                    IDockContent content = deserializeContent(contents[i].PersistString);
                    if (content == null)
                    {
                        content = new DummyContent();
                    }
                    content.DockHandler.DockPanel       = dockPanel;
                    content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
                    // "avoiding flickering" will cause "exception" at DockPane.cs:153 that I screened
                    // and global failure of LoadXml()
                    //content.DockHandler.IsHidden = true;
                    content.DockHandler.IsHidden = false;
                    content.DockHandler.IsFloat  = contents[i].IsFloat;
                }

                // Create panes
                for (int i = 0; i < panes.Length; i++)
                {
                    DockPane   pane       = null;
                    PaneStruct paneStruct = panes[i];
                    for (int j = 0; j < paneStruct.IndexContents.Length; j++)
                    {
                        try {
                            int          idx     = paneStruct.IndexContents[j];
                            IDockContent content = dockPanel.Contents[idx];
                            if (content == null || content.DockHandler == null)
                            {
                                string msg = "avoiding exception";
                                continue;
                            }
                            if (j == 0)
                            {
                                pane = dockPanel.DockPaneFactory.CreateDockPane(content, paneStruct.DockState, false);
                            }
                            else if (paneStruct.DockState == DockState.Float)
                            {
                                content.DockHandler.FloatPane = pane;
                            }
                            else
                            {
                                content.DockHandler.PanelPane = pane;
                            }
                        } catch (Exception e) {
                            continue;
                        }
                    }
                }

                // Assign Panes to DockWindows
                for (int i = 0; i < dockWindows.Length; i++)
                {
                    for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++)
                    {
                        DockWindow    dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                        int           indexPane     = dockWindows[i].NestedPanes[j].IndexPane;
                        DockPane      pane          = dockPanel.Panes[indexPane];
                        int           indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
                        DockPane      prevPane      = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
                        DockAlignment alignment     = dockWindows[i].NestedPanes[j].Alignment;
                        double        proportion    = dockWindows[i].NestedPanes[j].Proportion;
                        pane.DockTo(dw, prevPane, alignment, proportion);
                        if (panes[indexPane].DockState == dw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
                        }
                    }
                }

                // Create float windows
                for (int i = 0; i < floatWindows.Length; i++)
                {
                    FloatWindow fw = null;
                    for (int j = 0; j < floatWindows[i].NestedPanes.Length; j++)
                    {
                        int      indexPane = floatWindows[i].NestedPanes[j].IndexPane;
                        DockPane pane      = dockPanel.Panes[indexPane];
                        if (j == 0)
                        {
                            fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
                        }
                        else
                        {
                            int           indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
                            DockPane      prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                            DockAlignment alignment     = floatWindows[i].NestedPanes[j].Alignment;
                            double        proportion    = floatWindows[i].NestedPanes[j].Proportion;
                            pane.DockTo(fw, prevPane, alignment, proportion);
                        }

                        if (panes[indexPane].DockState == fw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
                        }
                    }
                }

                // sort IDockContent by its Pane's ZOrder
                int[] sortedContents = null;
                if (contents.Length > 0)
                {
                    sortedContents = new int[contents.Length];
                    for (int i = 0; i < contents.Length; i++)
                    {
                        sortedContents[i] = i;
                    }

                    int lastDocument = contents.Length;
                    for (int i = 0; i < contents.Length - 1; i++)
                    {
                        int sorted_i = sortedContents[i];
                        for (int j = i + 1; j < contents.Length; j++)
                        {
                            int sorted_j = sortedContents[j];
                            try {
                                if (sorted_i >= dockPanel.Contents.Count)
                                {
                                    string msg = "slow pointer went beyond the array length";
                                }
                                if (sorted_j >= dockPanel.Contents.Count)
                                {
                                    string msg = "fast pointer went beyond the array length";
                                }
                                if (dockPanel.Contents[sorted_j].DockHandler == null)
                                {
                                    string msg = "where is my handler?...";
                                }
                                DockPane pane1        = dockPanel.Contents[sorted_i].DockHandler.Pane;
                                int      ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
                                DockPane pane2        = dockPanel.Contents[sorted_j].DockHandler.Pane;
                                int      ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
                                if (ZOrderIndex1 > ZOrderIndex2)
                                {
                                    int temp = sorted_i;
                                    sortedContents[i] = sorted_j;
                                    sortedContents[j] = temp;
                                }
                            } catch (Exception ex) {
                                continue;
                            }
                        }
                    }
                }

                // show non-document IDockContent first to avoid screen flickers
                for (int i = 0; i < contents.Length; i++)
                {
                    int sorted_i = sortedContents[i];
                    if (sorted_i >= dockPanel.Contents.Count)
                    {
                        string msg = "Huston we have a problem";
                    }
                    IDockContent content = dockPanel.Contents[sorted_i];
                    if (content.DockHandler.Pane != null &&
                        content.DockHandler.Pane.DockState != DockState.Document)
                    {
                        // floating windows should not be marked IsHidden in Layout.xml...
                        //if they are, that will cause "ActiveContent must be one of the visible contents""
                        content.DockHandler.IsHidden = contents[sorted_i].IsHidden;
                        //content.DockHandler.IsHidden = false;
                    }
                }

                // after all non-document IDockContent, show document IDockContent
                for (int i = 0; i < contents.Length; i++)
                {
                    int          sorted_i = sortedContents[i];
                    IDockContent content  = dockPanel.Contents[sorted_i];
                    if (content.DockHandler.Pane != null &&
                        content.DockHandler.Pane.DockState == DockState.Document)
                    {
                        // but here I don't want to hide panes which are unserialized as hidden!!
                        // minimized ExceptionForm will disappear and that will make hidden: ChartForm and corresponding EditorForm
                        // hm it looks okay, I don't know what healed ExceptionForm...
                        content.DockHandler.IsHidden = contents[sorted_i].IsHidden;
                        //content.DockHandler.IsHidden = false;
                    }
                }

                for (int i = 0; i < panes.Length; i++)
                {
                    PaneStruct pane_i                 = panes[i];
                    DockPane   destination            = dockPanel.Panes[i];
                    int        paneActiveContentIndex = pane_i.IndexActiveContent;
                    //try {
                    //	destination.ActiveContent = paneActiveContentIndex == -1
                    //		? null : dockPanel.Contents[paneActiveContentIndex];
                    //} catch (Exception ex) {
                    //	int a = 1;
                    //}
                    if (paneActiveContentIndex != -1)
                    {
                        destination.ActiveContent = dockPanel.Contents[paneActiveContentIndex];
                    }
                }

                if (dockPanelStruct.IndexActiveDocumentPane != -1)
                {
                    dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
                }

                if (dockPanelStruct.IndexActivePane != -1)
                {
                    dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
                }

                for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
                {
                    if (dockPanel.Contents[i] is DummyContent)
                    {
                        dockPanel.Contents[i].DockHandler.Form.Close();
                    }
                }

                dockPanel.ResumeLayout(true, true);
            }
Exemple #45
0
        public void WorkspaceLoad(string workspaceToLoad)
        {
            try {
                if (Assembler.InstanceInitialized.AssemblerDataSnapshot.CurrentWorkspaceName != workspaceToLoad)
                {
                    Assembler.InstanceInitialized.AssemblerDataSnapshot.CurrentWorkspaceName = workspaceToLoad;
                    Assembler.InstanceInitialized.AssemblerDataSnapshotSerializer.Serialize();
                }
                bool createdNewFile = this.GuiDataSnapshotSerializer.Initialize(Assembler.InstanceInitialized.AppDataPath,
                                                                                "Sq1.Gui.GuiDataSnapshot.json", "Workspaces",
                                                                                Assembler.InstanceInitialized.AssemblerDataSnapshot.CurrentWorkspaceName);

                this.GuiDataSnapshot = this.GuiDataSnapshotSerializer.Deserialize();
                if (createdNewFile)
                {
                    this.mainForm_LocationChanged(this, null);
                    this.mainForm_ResizeEnd(this, null);
                    this.GuiDataSnapshotSerializer.Serialize();

                    // re-reading Workspaces\ since I just created one, and before it was empty; copy-paste from initializeWorkspacesManagerTrampoline()
                    Assembler.InstanceInitialized.WorkspacesRepository.ScanFolders();
                    this.WorkspacesManager = new MainFormWorkspacesManager(this);
                    this.CtxWorkspaces.Items.AddRange(this.WorkspacesManager.WorkspaceMenuItemsWithHandlers);
                }
                //this.DataSnapshot.RebuildDeserializedChartFormsManagers(this);

                //foreach (Form each in this.OwnedForms) each.Close();
                foreach (IDockContent each in this.DockPanel.Documents)
                {
                    var form = each as DockContent;
                    form.Close();
                }
                foreach (FloatWindow each in this.DockPanel.FloatWindows)
                {
                    each.Close();
                }
                foreach (DockWindow each in this.DockPanel.DockWindows)
                {
                    //each.Close();
                }

                string file = this.LayoutXml;
                if (File.Exists(file) == false)
                {
                    file = this.LayoutXmlInitial;
                }
                if (File.Exists(file))
                {
                    DeserializeDockContent deserializeDockContent = new DeserializeDockContent(this.PersistStringInstantiator);
                    this.DockPanel.LoadFromXml(LayoutXml, deserializeDockContent);
                }
                Assembler.InstanceInitialized.MainFormDockFormsFullyDeserializedLayoutComplete = true;

//				this.mniExceptions.Checked = !ExceptionsForm.Instance.IsHidden;
//				this.mniSymbols.Checked = !DataSourcesForm.Instance.IsHidden;
//				this.mniSliders.Checked = !SlidersForm.Instance.IsHidden;
//				this.mniStrategies.Checked = !StrategiesForm.Instance.IsHidden;
//				this.mniSymbolManager.Checked = !SymbolManagerForm.Instance.IsHidden;
//				this.mniExecution.Checked = !ExecutionForm.Instance.IsHidden;
//				this.mniCsvImporter.Checked = !CsvImporterForm.Instance.IsHidden;

                this.initializeMainFromDeserializedDataSnapshot();
                this.mainFormEventManagerInitializeAfterDockingDeserialized();

                //this.PropagateSelectorsForCurrentChart();
                //WHY???this.MainFormEventManager.DockPanel_ActiveDocumentChanged(this, EventArgs.Empty);

                this.WorkspacesManager.SelectWorkspaceLoaded(workspaceToLoad);

                if (ExceptionsForm.Instance.ExceptionControl.Exceptions.Count > 0)
                {
                    ExceptionsForm.Instance.Show(this.DockPanel);
                    ExceptionsForm.Instance.ExceptionControl.PopulateDataSnapshotInitializeSplittersAfterDockContentDeserialized();
                }
            } catch (Exception ex) {
                                #if DEBUG
                Debugger.Break();
                                #endif
                this.PopupException(ex);
            }
        }
Exemple #46
0
        private void FormImageView3_Load(object sender, EventArgs e)
        {
            if (m_bClose)
            {
                this.Close();
                return;
            }
            this.Text = "RoadCare ImageView:Loading...";
            m_formSolutionExplorer = new FormImageViewSolutionExplorer();
            m_formOutputWindow     = new FormOutputWindow();
            m_formNavigation       = new FormNavigation();

            OutputWindow.Output = m_formOutputWindow;
            FormManager.AddOutputWindow(m_formOutputWindow);

            m_formOutputWindow.CloseButton = false;

            String strMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            strMyDocumentsFolder += "\\RoadCare Projects\\ImageView\\Temp";
            Settings.Default.IMAGEVIEW_FILEPATH = strMyDocumentsFolder;

            // Add the explution soLOLar and the output window to the main dock panel if we do not have a previous settings file.
            String strFile = strMyDocumentsFolder + "\\TAB_SETTINGS.xml";

            if (!File.Exists(strFile))
            {
                m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);

                int nWidth    = m_formSolutionExplorer.Width;
                int nAppWidth = this.Width;


                m_formNavigation.Show(dockPanelMain, new Rectangle(nWidth, 40, nAppWidth - nWidth, 80));
            }
            else
            {
                // Load the tab settings (and other user settings?) from the XML file
                try
                {
                    DeserializeDockContent deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanelMain.LoadFromXml(strFile, deserializeDockContent);

                    if (!m_formSolutionExplorer.Visible)
                    {
                        m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                    }
                }
                catch (Exception exc)
                {
                    m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                    m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);
                    OutputWindow.WriteOutput("Error: Problem processing TAB_SETTINGS.xml file. " + exc.Message);
                }
            }
            OutputWindow.DockPanel      = dockPanelMain;
            m_formNavigation.Navigation = new NavigationObject(ImageViewManager.Networks);

            if (String.IsNullOrEmpty(m_formNavigation.Navigation.ImagePath))
            {
                String strImagePath = Settings.Default.IMAGEPATH;
                if (String.IsNullOrEmpty(strImagePath))
                {
                    if (folderBrowserDialogImagePath.ShowDialog() == DialogResult.OK)
                    {
                        strImagePath = folderBrowserDialogImagePath.SelectedPath;
                        Settings.Default.IMAGEPATH = strImagePath;
                    }
                }
                m_formNavigation.Navigation.ImagePath = strImagePath;
            }

            this.Text = "RoadCare ImageView:" + DBMgr.GetNativeConnection().Database;
        }
Exemple #47
0
 public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
 {
     Persistor.LoadFromXml(this, stream, deserializeContent, closeStream);
 }
Exemple #48
0
 public frmMain()
 {
     InitializeComponent();
     m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
     CommonHelper.FormMain    = this;
 }
Exemple #49
0
        public static void LoadFromXml(DockContainer dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
        {
            if (dockPanel.Contents.Count != 0)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPanel.LoadFromXml.AlreadyInitialized"));
            }

            EnumConverter      dockStateConverter     = new EnumConverter(typeof(DockState));
            EnumConverter      dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
            RectangleConverter rectConverter          = new RectangleConverter();

            XmlTextReader xmlIn = new XmlTextReader(stream);

            xmlIn.WhitespaceHandling = WhitespaceHandling.None;
            xmlIn.MoveToContent();

            while (!xmlIn.Name.Equals("DockPanel"))
            {
                if (!MoveToNextElement(xmlIn))
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
            }

            string formatVersion = xmlIn.GetAttribute("FormatVersion");

            if (!IsFormatVersionValid(formatVersion))
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidFormatVersion"));
            }

            DockPanelStruct dockPanelStruct = new DockPanelStruct();

            dockPanelStruct.DockLeftPortion         = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockRightPortion        = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockTopPortion          = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockBottomPortion       = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"));
            dockPanelStruct.IndexActivePane         = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"));

            // Load Contents
            MoveToNextElement(xmlIn);
            if (xmlIn.Name != "Contents")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            ContentStruct[] contents = new ContentStruct[countOfContents];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfContents; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "Content" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                contents[i].PersistString   = xmlIn.GetAttribute("PersistString");
                contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture);
                contents[i].IsHidden        = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"));
                contents[i].IsFloat         = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"));
                MoveToNextElement(xmlIn);
            }

            // Load Panes
            if (xmlIn.Name != "Panes")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            PaneStruct[] panes = new PaneStruct[countOfPanes];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfPanes; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "Pane" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                panes[i].DockState          = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
                panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"));
                panes[i].ZOrderIndex        = -1;

                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "Contents")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                panes[i].IndexContents = new int[countOfPaneContents];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfPaneContents; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Content" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }

                    panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    MoveToNextElement(xmlIn);
                }
            }

            // Load DockWindows
            if (xmlIn.Name != "DockWindows")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfDockWindows = dockPanel.DockWindows.Count;

            DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfDockWindows; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "DockWindow" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                dockWindows[i].DockState   = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
                dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"));
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "DockList")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfDockList = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                dockWindows[i].DockList = new DockListItem[countOfDockList];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfDockList; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Pane" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }
                    dockWindows[i].DockList[j].IndexPane     = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    dockWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"));
                    dockWindows[i].DockList[j].Alignment     = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
                    dockWindows[i].DockList[j].Proportion    = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
                    MoveToNextElement(xmlIn);
                }
            }

            // Load FloatWindows
            if (xmlIn.Name != "FloatWindows")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfFloatWindows; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "FloatWindow" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                floatWindows[i].Bounds         = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds"));
                floatWindows[i].AllowRedocking = Convert.ToBoolean(xmlIn.GetAttribute("AllowRedocking"));
                floatWindows[i].ZOrderIndex    = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"));
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "DockList")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfDockList = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                floatWindows[i].DockList = new DockListItem[countOfDockList];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfDockList; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Pane" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }
                    floatWindows[i].DockList[j].IndexPane     = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    floatWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"));
                    floatWindows[i].DockList[j].Alignment     = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
                    floatWindows[i].DockList[j].Proportion    = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
                    MoveToNextElement(xmlIn);
                }
            }

            if (closeStream)
            {
                xmlIn.Close();
            }

            dockPanel.DockLeftPortion   = dockPanelStruct.DockLeftPortion;
            dockPanel.DockRightPortion  = dockPanelStruct.DockRightPortion;
            dockPanel.DockTopPortion    = dockPanelStruct.DockTopPortion;
            dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;

            // Set DockWindow ZOrders
            int prevMaxDockWindowZOrder = int.MaxValue;

            for (int i = 0; i < dockWindows.Length; i++)
            {
                int maxDockWindowZOrder = -1;
                int index = -1;
                for (int j = 0; j < dockWindows.Length; j++)
                {
                    if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
                    {
                        maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
                        index = j;
                    }
                }

                dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
                prevMaxDockWindowZOrder = maxDockWindowZOrder;
            }

            // Create Contents
            for (int i = 0; i < contents.Length; i++)
            {
                IDockableWindow content = deserializeContent(contents[i].PersistString);
                if (content == null)
                {
                    content = new DummyContent();
                }
                content.DockHandler.DockPanel       = dockPanel;
                content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
                content.DockHandler.IsHidden        = true;
                content.DockHandler.IsFloat         = contents[i].IsFloat;
            }

            // Create panes
            for (int i = 0; i < panes.Length; i++)
            {
                DockPane pane = null;
                for (int j = 0; j < panes[i].IndexContents.Length; j++)
                {
                    IDockableWindow content = dockPanel.Contents[panes[i].IndexContents[j]];
                    if (j == 0)
                    {
                        pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
                    }
                    else if (panes[i].DockState == DockState.Float)
                    {
                        content.DockHandler.FloatPane = pane;
                    }
                    else
                    {
                        content.DockHandler.PanelPane = pane;
                    }
                }
            }

            // Assign Panes to DockWindows
            for (int i = 0; i < dockWindows.Length; i++)
            {
                for (int j = 0; j < dockWindows[i].DockList.Length; j++)
                {
                    DockWindow    dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                    int           indexPane     = dockWindows[i].DockList[j].IndexPane;
                    DockPane      pane          = dockPanel.Panes[indexPane];
                    int           indexPrevPane = dockWindows[i].DockList[j].IndexPrevPane;
                    DockPane      prevPane      = (indexPrevPane == -1) ? dw.DockList.GetDefaultPrevPane(pane) : dockPanel.Panes[indexPrevPane];
                    DockAlignment alignment     = dockWindows[i].DockList[j].Alignment;
                    double        proportion    = dockWindows[i].DockList[j].Proportion;
                    pane.AddToDockList(dw, prevPane, alignment, proportion);
                    if (panes[indexPane].DockState == dw.DockState)
                    {
                        panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
                    }
                }
            }

            // Create float windows
            for (int i = 0; i < floatWindows.Length; i++)
            {
                FloatWindow fw = null;
                for (int j = 0; j < floatWindows[i].DockList.Length; j++)
                {
                    int      indexPane = floatWindows[i].DockList[j].IndexPane;
                    DockPane pane      = dockPanel.Panes[indexPane];
                    if (j == 0)
                    {
                        fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
                    }
                    else
                    {
                        int           indexPrevPane = floatWindows[i].DockList[j].IndexPrevPane;
                        DockPane      prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                        DockAlignment alignment     = floatWindows[i].DockList[j].Alignment;
                        double        proportion    = floatWindows[i].DockList[j].Proportion;
                        pane.AddToDockList(fw, prevPane, alignment, proportion);
                        if (panes[indexPane].DockState == fw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
                        }
                    }
                }
            }

            // sort IDockContent by its Pane's ZOrder
            int[] sortedContents = null;
            if (contents.Length > 0)
            {
                sortedContents = new int[contents.Length];
                for (int i = 0; i < contents.Length; i++)
                {
                    sortedContents[i] = i;
                }

                int lastDocument = contents.Length;
                for (int i = 0; i < contents.Length - 1; i++)
                {
                    for (int j = i + 1; j < contents.Length; j++)
                    {
                        DockPane pane1        = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
                        int      ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
                        DockPane pane2        = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
                        int      ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
                        if (ZOrderIndex1 > ZOrderIndex2)
                        {
                            int temp = sortedContents[i];
                            sortedContents[i] = sortedContents[j];
                            sortedContents[j] = temp;
                        }
                    }
                }
            }

            // show non-document IDockContent first to avoid screen flickers
            for (int i = 0; i < contents.Length; i++)
            {
                IDockableWindow content = dockPanel.Contents[sortedContents[i]];
                if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
                {
                    content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                }
            }

            // after all non-document IDockContent, show document IDockContent
            for (int i = 0; i < contents.Length; i++)
            {
                IDockableWindow content = dockPanel.Contents[sortedContents[i]];
                if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
                {
                    content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                }
            }

            for (int i = 0; i < panes.Length; i++)
            {
                dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent];
            }

            if (dockPanelStruct.IndexActiveDocumentPane != -1)
            {
                dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
            }

            if (dockPanelStruct.IndexActivePane != -1)
            {
                dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
            }

            for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
            {
                if (dockPanel.Contents[i] is DummyContent)
                {
                    dockPanel.Contents[i].DockHandler.Form.Close();
                }
            }
        }
Exemple #50
0
 public LEDockManager()
 {
     _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
 }
Exemple #51
0
            public static void LoadFromXml(DockPanel dockPanel, Stream stream,
                                           DeserializeDockContent deserializeContent, bool closeStream)
            {
                if (dockPanel.Contents.Count != 0)
                {
                    throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
                }

                DockPanelStruct dockPanelStruct;

                ContentStruct[]     contents;
                PaneStruct[]        panes;
                DockWindowStruct[]  dockWindows;
                FloatWindowStruct[] floatWindows;
                using (var xmlIn = new XmlTextReader(stream)
                {
                    WhitespaceHandling = WhitespaceHandling.None
                })
                {
                    xmlIn.MoveToContent();

                    while (!xmlIn.Name.Equals("DockPanel"))
                    {
                        if (!MoveToNextElement(xmlIn))
                        {
                            throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                        }
                    }

                    var formatVersion = xmlIn.GetAttribute("FormatVersion");
                    if (!IsFormatVersionValid(formatVersion))
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
                    }

                    dockPanelStruct = new DockPanelStruct();
                    dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"),
                                                                       CultureInfo.InvariantCulture);
                    dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"),
                                                                        CultureInfo.InvariantCulture);
                    dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"),
                                                                      CultureInfo.InvariantCulture);
                    dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"),
                                                                         CultureInfo.InvariantCulture);
                    dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"),
                                                                              CultureInfo.InvariantCulture);
                    dockPanelStruct.IndexActivePane =
                        Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);

                    // Load Contents
                    MoveToNextElement(xmlIn);
                    if (xmlIn.Name != "Contents")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    contents = LoadContents(xmlIn);

                    // Load Panes
                    if (xmlIn.Name != "Panes")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    panes = LoadPanes(xmlIn);

                    // Load DockWindows
                    if (xmlIn.Name != "DockWindows")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    dockWindows = LoadDockWindows(xmlIn, dockPanel);

                    // Load FloatWindows
                    if (xmlIn.Name != "FloatWindows")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    floatWindows = LoadFloatWindows(xmlIn);

                    if (closeStream)
                    {
                        xmlIn.Close();
                    }
                }

                dockPanel.SuspendLayout(true);

                dockPanel.DockLeftPortion   = dockPanelStruct.DockLeftPortion;
                dockPanel.DockRightPortion  = dockPanelStruct.DockRightPortion;
                dockPanel.DockTopPortion    = dockPanelStruct.DockTopPortion;
                dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;

                // Set DockWindow ZOrders
                var prevMaxDockWindowZOrder = int.MaxValue;

                for (var i = 0; i < dockWindows.Length; i++)
                {
                    var maxDockWindowZOrder = -1;
                    var index = -1;
                    for (var j = 0; j < dockWindows.Length; j++)
                    {
                        if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder &&
                            dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
                        {
                            maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
                            index = j;
                        }
                    }

                    dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
                    prevMaxDockWindowZOrder = maxDockWindowZOrder;
                }

                // Create Contents
                for (var i = 0; i < contents.Length; i++)
                {
                    var content = deserializeContent(contents[i].PersistString);
                    if (content == null)
                    {
                        content = new DummyContent();
                    }
                    content.DockHandler.DockPanel       = dockPanel;
                    content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
                    content.DockHandler.IsHidden        = true;
                    content.DockHandler.IsFloat         = contents[i].IsFloat;
                }

                // Create panes
                for (var i = 0; i < panes.Length; i++)
                {
                    DockPane pane = null;
                    for (var j = 0; j < panes[i].IndexContents.Length; j++)
                    {
                        var content = dockPanel.Contents[panes[i].IndexContents[j]];
                        if (j == 0)
                        {
                            pane = dockPanel.Theme.Extender.DockPaneFactory.CreateDockPane(content, panes[i].DockState,
                                                                                           false);
                        }
                        else if (panes[i].DockState == DockState.Float)
                        {
                            content.DockHandler.FloatPane = pane;
                        }
                        else
                        {
                            content.DockHandler.PanelPane = pane;
                        }
                    }
                }

                // Assign Panes to DockWindows
                for (var i = 0; i < dockWindows.Length; i++)
                {
                    for (var j = 0; j < dockWindows[i].NestedPanes.Length; j++)
                    {
                        var dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                        var indexPane     = dockWindows[i].NestedPanes[j].IndexPane;
                        var pane          = dockPanel.Panes[indexPane];
                        var indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
                        var prevPane      = indexPrevPane == -1
                        ? dw.NestedPanes.GetDefaultPreviousPane(pane)
                        : dockPanel.Panes[indexPrevPane];
                        var alignment  = dockWindows[i].NestedPanes[j].Alignment;
                        var proportion = dockWindows[i].NestedPanes[j].Proportion;
                        pane.DockTo(dw, prevPane, alignment, proportion);
                        if (panes[indexPane].DockState == dw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
                        }
                    }
                }

                // Create float windows
                for (var i = 0; i < floatWindows.Length; i++)
                {
                    FloatWindow fw = null;
                    for (var j = 0; j < floatWindows[i].NestedPanes.Length; j++)
                    {
                        var indexPane = floatWindows[i].NestedPanes[j].IndexPane;
                        var pane      = dockPanel.Panes[indexPane];
                        if (j == 0)
                        {
                            fw = dockPanel.Theme.Extender.FloatWindowFactory.CreateFloatWindow(dockPanel, pane,
                                                                                               floatWindows[i].Bounds);
                        }
                        else
                        {
                            var indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
                            var prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                            var alignment     = floatWindows[i].NestedPanes[j].Alignment;
                            var proportion    = floatWindows[i].NestedPanes[j].Proportion;
                            pane.DockTo(fw, prevPane, alignment, proportion);
                        }

                        if (panes[indexPane].DockState == fw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
                        }
                    }
                }

                // sort IDockContent by its Pane's ZOrder
                int[] sortedContents = null;
                if (contents.Length > 0)
                {
                    sortedContents = new int[contents.Length];
                    for (var i = 0; i < contents.Length; i++)
                    {
                        sortedContents[i] = i;
                    }

                    var lastDocument = contents.Length;
                    for (var i = 0; i < contents.Length - 1; i++)
                    {
                        for (var j = i + 1; j < contents.Length; j++)
                        {
                            var pane1        = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
                            var ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
                            var pane2        = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
                            var ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
                            if (ZOrderIndex1 > ZOrderIndex2)
                            {
                                var temp = sortedContents[i];
                                sortedContents[i] = sortedContents[j];
                                sortedContents[j] = temp;
                            }
                        }
                    }
                }

                // show non-document IDockContent first to avoid screen flickers
                for (var i = 0; i < contents.Length; i++)
                {
                    var content = dockPanel.Contents[sortedContents[i]];
                    if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
                    {
                        content.DockHandler.SuspendAutoHidePortionUpdates = true;
                        content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                        content.DockHandler.SuspendAutoHidePortionUpdates = false;
                    }
                }

                // after all non-document IDockContent, show document IDockContent
                for (var i = 0; i < contents.Length; i++)
                {
                    var content = dockPanel.Contents[sortedContents[i]];
                    if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
                    {
                        content.DockHandler.SuspendAutoHidePortionUpdates = true;
                        content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                        content.DockHandler.SuspendAutoHidePortionUpdates = false;
                    }
                }

                for (var i = 0; i < panes.Length; i++)
                {
                    dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1
                        ? null
                        : dockPanel.Contents[panes[i].IndexActiveContent];
                }

                if (dockPanelStruct.IndexActiveDocumentPane >= 0 &&
                    dockPanel.Panes.Count > dockPanelStruct.IndexActiveDocumentPane)
                {
                    dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
                }

                if (dockPanelStruct.IndexActivePane >= 0 && dockPanel.Panes.Count > dockPanelStruct.IndexActivePane)
                {
                    dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
                }

                for (var i = dockPanel.Contents.Count - 1; i >= 0; i--)
                {
                    if (dockPanel.Contents[i] is DummyContent)
                    {
                        dockPanel.Contents[i].DockHandler.Form.Close();
                    }
                }

                dockPanel.ResumeLayout(true, true);
            }
Exemple #52
0
        public OperationForm(TestExecutionCollection collection)
        {
            InitializeComponent();
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            Top    = collection.OperatorFormTop;
            Left   = collection.OperatorFormLeft;
            Width  = collection.OperatorFormWidth;
            Height = collection.OperatorFormHeight;

            mTestSequence = collection.TestSequence;
            mProject      = mTestSequence.project();

            dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow;
            bigImageForm            = new ImageBigViewForm(this);

            //            propForm = new OperationPropertiesForm();
            favSettingsForm = new FavoriteSettingsForm(this);
            favValuesForm   = new FavoriteValuesForm(this);
            logForm         = new OperationLogForm(this);
            //studyChartForm = new AnalysisForm(this);
            activeLogForm = new ActiveTestLogForm(this);
            reportForm    = new OperationReportForm(this);
            //treeForm = new OperationSequenceTreeForm(this);

            if (File.Exists(mTestSequence.OperatorViewLayoutFile))
            {
                dockPanel.LoadFromXml(mTestSequence.OperatorViewLayoutFile, m_deserializeDockContent);
            }

            /*
             * else if (File.Exists(mTestSequence.Project().DefaultOperatorViewLayoutFile))
             * {
             *  dockPanel.LoadFromXml(mTestSequence.Project().DefaultOperatorViewLayoutFile, m_deserializeDockContent);
             * }
             * else if (File.Exists("UnnamedView.config"))
             * {
             *  dockPanel.LoadFromXml("UnnamedView.config", m_deserializeDockContent);
             * }*/
            else
            {
                /*
                 * propForm.Show(dockPanel);
                 * propForm.ShowHint = DockState.DockRightAutoHide;
                 */
                bigImageForm.Dock = DockStyle.Fill;
                bigImageForm.Show(dockPanel, DockState.Document);

                favSettingsForm.Show(bigImageForm.Pane, DockAlignment.Top, 0.25);

                logForm.Show(favSettingsForm.Pane, DockAlignment.Right, 0.5);

                favValuesForm.Show(favSettingsForm.Pane, DockAlignment.Right, 0.5);

                reportForm.Show(logForm.Pane, logForm);

                //treeForm.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);
            }

            CurrentTestCollection = collection;

            favSettingsForm.propertyGrid.SelectedObject = mTestSequence.mFavoriteSettings;
            favValuesForm.propertyGrid.SelectedObject   = mTestSequence.mFavoriteValues;

            int formNdx = 0;
            ImageHistoryForm imageForm;

            foreach (string imageTabDef in mTestSequence.mImageForms)
            {
                if (formNdx >= mImageForms.Count)
                {
                    AddNewImageForm();
                }
                imageForm = mImageForms[formNdx];
                imageForm.DeserializeDef(imageTabDef);
                formNdx++;
            }

            /*
             * if (formNdx < mImageForms.Count - 1)
             * {
             *  mImageForms.RemoveRange(formNdx, (mImageForms.Count - 1) - formNdx);
             * }
             */
            FormClosing += new FormClosingEventHandler(OperationForm_FormClosing);

            // find all of the control definer definitions in the test sequence
            foreach (OperatorControlDefinition operatorControlDefiner in mTestSequence.mOperatorControlDefiners)
            {
                // get and add all of the controls within each definer to the toolstrip
                int numControls = operatorControlDefiner.numberOfControls();
                for (int x = 0; x < numControls; x++)
                {
                    ToolStripItem newControl = operatorControlDefiner.createControlInstance(x);
                    toolStrip_Operator.Items.Add(newControl);

                    // let the definer know that there is a new operator form...so the active test execution (running in a separate thread) can register as a listener
                    operatorControlDefiner.RegisterNewOperatorForm(this);
                }
            }
        }
Exemple #53
0
        public frmImageGather()
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;
            this.p_Main.Dock = DockStyle.Fill;
            GatherCallBack gtb = new GatherCallBack(GetCallBack);

            gather                   = new Gather(gtb);
            gather.parentHwnd        = this.Handle;
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            this.msComm              = new MSComm(this.axMSComm1);
            this.msComm.onCommGather = new SIS.ImgGather.MSComm.OnCommGather(GatherMultimedia);
            // UsbjoyStick.joySetCapture(this.Handle, UsbjoyStick.JOYSTICKID1, 100, false);//测试USE手柄
            if (gather.OpenCard())
            {
                gather.initCard();
                if (GetConfig.COS_IsUse)
                {
                    if (!this.msComm.OpenCom())
                    {
                        MessageBoxEx.Show("串行端口打开失败!请检查设置参数是否正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    if (GetConfig.COS_CommMode == "2")
                    {
                        UsbjoyStick.joySetCapture(this.Handle, UsbjoyStick.JOYSTICKID1, 100, false);
                    }
                }
            }
            else
            {
                MessageBoxEx.Show("采集卡打开失败!请确保正确安装上采集卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            //this.axHYImage1.OnEventCallback += new EventHandler(axHYImage1_OnEventCallback);
            //if (this.OpenCard())
            //{
            //    this.InitCard();
            //    if (GetConfig.COS_IsUse)
            //        if (!this.msComm.OpenCom())
            //            MessageBoxEx.Show("串行端口打开失败!请检查设置参数是否正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
            //else
            //    MessageBoxEx.Show("采集卡打开失败!请确保正确安装上采集卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            string configFile = Application.StartupPath + "\\Config\\ImgGatDockPanel.config";

            if (!dockPanel.LoadFromXml(configFile, m_deserializeDockContent))
            {
                backImages           = new frmBackImages(this.p_Main);
                preferImages         = new frmPreferImages(this.p_Main);
                backImages.dbClick   = new frmBackImages.DbClick(PtbCtlDbClick);
                preferImages.dbClick = new frmPreferImages.DbClick(PtbCtlDbClick);
                backImages.Show(this.dockPanel, BaseControls.Docking.DockState.DockRight);
                preferImages.Show(this.dockPanel, BaseControls.Docking.DockState.DockRight);
                if (GetConfig.IsQuickReg)
                {
                    frmQuickReg = new frmQuickReg(this.p_Main);
                    frmQuickReg.Show(this.dockPanel, BaseControls.Docking.DockState.DockRight);
                }
            }
        }
Exemple #54
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            bool layoutLoadedSuccessfully = true;

            //AppSettings.Default.MySqlConnection = new MySqlConnection();
            //AppSettings.Default.MySqlConnection.OnConnectionStateChangedEvent += MySqlConn__OnConnectionStateChangedEvent;
            //AppSettings.Default.MySqlConnection.OnInfoMessage += mySqlConn__OnInfoMessage;

            Assembly        assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            this.Text = string.Format("{0} - {1}", this.Text, fvi.FileVersion);

            // Docking Windows

            this.DatabaseBrowserDockForm     = new DatabaseBrowserDockForm(ref mySqlServer1);
            this.SqlServerPropertiesDockForm = new SqlServerPropertiesDockForm(ref mySqlServer1);
            this.PropertiesDockForm          = new PropertiesDockForm();
            this.ChildrenSummaryDockForm     = new ChildrenSummaryDockForm();
            this.DataPreviewDockForm         = new DataPreviewDockForm(ref mySqlServer1);
            this.ObjectDefinitionDockForm    = new ObjectDefinitionDockForm(ref mySqlServer1);
            this.OutputDockForm     = new OutputDockForm();
            this.TopObjectsDockForm = new TopObjectsDockForm(ref mySqlServer1);


            var mf = this;

            this.StartDockForm = new StartDockForm(ref mf);

            try
            {
                // Load saved layout
                var xml = TempFolder.GetPath("DockPanelLayout", "xml", false);
                DeserializeDockContent ddc = GetContentFromPersistString;
                this.dockPanel.LoadFromXml(xml, ddc);
            }
            catch { layoutLoadedSuccessfully = false; }

            if (!this.dockPanel.Contains(this.DatabaseBrowserDockForm))
            {
                this.DatabaseBrowserDockForm.Show(this.dockPanel, DockState.DockLeft);
            }

            if (!this.dockPanel.Contains(this.SqlServerPropertiesDockForm))
            {
                this.SqlServerPropertiesDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.PropertiesDockForm))
            {
                this.PropertiesDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.ChildrenSummaryDockForm))
            {
                this.ChildrenSummaryDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.DataPreviewDockForm))
            {
                this.DataPreviewDockForm.Show(this.dockPanel, DockState.DockRight);
            }

            if (!this.dockPanel.Contains(this.ObjectDefinitionDockForm))
            {
                this.ObjectDefinitionDockForm.Show(this.dockPanel, DockState.DockBottom);
            }

            if (!this.dockPanel.Contains(this.OutputDockForm))
            {
                this.OutputDockForm.Show(this.dockPanel, DockState.DockBottom);
            }

            if (!this.dockPanel.Contains(this.TopObjectsDockForm))
            {
                this.TopObjectsDockForm.Show(this.dockPanel, DockState.DockBottom);
            }


            this.StartDockForm.Show(this.dockPanel, DockState.Document);

            if (!layoutLoadedSuccessfully)
            {
                PropertiesDockForm.Show();
                OutputDockForm.Show();
            }

            MyOutput.Initialize(ref this.OutputDockForm);
            MyOutput.NewMessage(EOutputMessageType.INFORMATION, "Application started.");
        }
Exemple #55
0
 public MainForm()
 {
     InitializeComponent();
     _deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
     SetMenu( );
 }
        internal override object Restore(DockPanel dockPanel, DeserializeDockContent deserializeDockContent)
        {
            var result = state.Restore(dockPanel, deserializeDockContent);

            return(result);
        }
Exemple #57
0
        public void InitializeDocking()
        {
            Controls.Remove(mapSplitter);
            Controls.Remove(SplitContainer);
            Controls.Remove(layerTileSplit);
            Controls.Remove(EditorTabs);

            _mapContent = new DockContent();
            _mapContent.Controls.Add(MapToolContainer);
            _mapContent.Text      = @"Map Editor";
            _mapContent.DockAreas = DockAreas.DockBottom | DockAreas.Document | DockAreas.DockTop;
            _mapContent.DockHandler.CloseButtonVisible = false;

            _drawContent = new DockContent();
            _drawContent.Controls.Add(TileDrawer);
            _drawContent.Text      = @"Tile Image Editor";
            _drawContent.DockAreas = DockAreas.DockBottom | DockAreas.DockTop | DockAreas.Document;
            _drawContent.DockHandler.CloseButtonVisible = false;

            _tilesetContent = new DockContent();
            _tilesetContent.Controls.Add(TilesetPanel);
            TilesetControl.Width      = TilesetPanel.Width - 2;
            _tilesetContent.Text      = @"Tileset";
            _tilesetContent.DockAreas = DockAreas.DockRight | DockAreas.DockLeft;
            _tilesetContent.DockHandler.CloseButtonVisible = false;
            _tilesetContent.AutoScroll = true;

            _entityContent = new DockContent();
            _entityContent.Controls.Add(EntitiesControl);
            _entityContent.Text      = @"Entity List";
            _entityContent.DockAreas = DockAreas.DockRight | DockAreas.DockLeft | DockAreas.DockBottom;
            _entityContent.DockHandler.CloseButtonVisible = false;

            _tileContent = new DockContent();
            _tileContent.Controls.Add(TileEditor);
            _tileContent.Text      = @"Tile Properties";
            _tileContent.DockAreas = DockAreas.DockBottom | DockAreas.DockTop | DockAreas.Document;
            _tileContent.DockHandler.CloseButtonVisible = false;

            _layerContent = new DockContent();
            _layerContent.Controls.Add(LayerEditor);
            LayerEditor.Layers.LayerChanged           += Layers_LayerChanged;
            LayerEditor.Layers.LayerSelected          += Layers_LayerSelected;
            LayerEditor.Layers.LayerVisibilityChanged += Layers_LayerVisibilityChanged;
            _layerContent.Text      = @"Map Layers";
            _layerContent.DockAreas = DockAreas.DockLeft | DockAreas.DockRight;
            _layerContent.DockHandler.CloseButtonVisible = false;

            _mainPanel = new DockPanel {
                Dock = DockStyle.Fill, DocumentStyle = DocumentStyle.DockingWindow
            };
            if (System.IO.File.Exists("MapEditor.xml"))
            {
                DeserializeDockContent dc = GetContent;
                _mainPanel.LoadFromXml("MapEditor.xml", dc);
            }
            else
            {
                _mapContent.Show(_mainPanel, DockState.Document);
                _tileContent.Show(_mapContent.Pane, DockAlignment.Bottom, 0.40);
                _drawContent.Show(_tileContent.PanelPane, _tileContent);
                _entityContent.Show(_mainPanel, DockState.DockRight);
                _layerContent.Show(_entityContent.Pane, _entityContent);
                _tilesetContent.Show(_layerContent.Pane, DockAlignment.Bottom, 0.66);
            }

            Controls.Add(_mainPanel);
        }
Exemple #58
0
 public Workbench()
 {
     InitializeComponent();
     m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
 }
 public void LoadFromXml(Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
 {
     Persistor.LoadFromXml(this, stream, deserializeContent, closeStream);
 }
Exemple #60
0
        public MainForm()
        {
            InitializeComponent();

            _saveHandler = new SaveHandler();
            _saveHandler.Register(new PTSaveFile());
            _saveHandler.Register(new TQSaveFile());
            _saveHandler.Register(new BMESaveFile());

            _loadHandler = new LoadHandler();
            _loadHandler.Register(new PTOpenFile());
            _loadHandler.Register(new TQOpenFile());

            var editor = m_editorForm.Editor;

            var audioList = this.m_audioList = new AudioListForm();

            audioList.OnPlayPressed       += this.AudioList_onPlayPressed;
            audioList.OnStopPressed       += this.AudioList_onStopPressed;
            audioList.OnInstrumentChanged += this.AudioList_onInstrumentChanged;

            Logs.OnLogWrite += this.Logs_OnWrite;

            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);

            m_notes = new NoteSelectForm(editor.EventsRenderer);

            editor.OnSelectItem += Editor_OnSelectItem;

            m_notes.OnSelectDataEvent += NoteSelect_OnSelectData;

            editor.OnRequestEvent += Editor_OnRequestEvent;

            m_audioList.List.SelectionChanged += AudioList_selectionChanged;

            editor.OnUndoRedo += UndoManager_OnUndoRedo;

            var eventsThemeList = editor.EventsThemeList;
            var currentTheme    = editor.CurrentEventsTheme;

            foreach (var theme in eventsThemeList)
            {
                ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(theme.GetName());
                ThemeDropDownButton.DropDownItems.Add(toolStripMenuItem);
                if (null != toolStripMenuItem && currentTheme == theme)
                {
                    toolStripMenuItem.Checked = true;
                    ApplyEventsTheme(theme);
                }
            }

            var zonesThemeList   = editor.ZonesThemeList;
            var currentZoneTheme = editor.CurrentZonesTheme;

            foreach (var theme in zonesThemeList)
            {
                ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(theme.GetName());
                zoneRendererToolStripDropDownButton.DropDownItems.Add(toolStripMenuItem);

                if (currentZoneTheme != theme)
                {
                    continue;
                }

                toolStripMenuItem.Checked = true;
                ApplyZonesTheme(theme);
            }

            var eventDisplayModes = GetAll <EventDisplayMode>();

            var currentEventDisplayMode = editor.EventDisplayMode;

            foreach (var eventDisplayMode in eventDisplayModes)
            {
                var toolStripMenuItem = new ToolStripMenuItem(eventDisplayMode.Value);
                eventDisplayModeToolStripDropDownButton.DropDownItems.Add(toolStripMenuItem);

                if (eventDisplayMode.Key != (int)currentEventDisplayMode)
                {
                    continue;
                }
                toolStripMenuItem.Checked = true;
                eventDisplayModeToolStripDropDownButton.Text = eventDisplayMode.Value;
            }

            AllowDrop = true;
        }