using Voile.Common.Logging; using Voile.DockContents; using Voile.Tasks; using WeifenLuo.WinFormsUI.Docking; namespace Voile { public partial class Form1 : Form { private static VoileLogger logger; public Form1() { InitializeComponent(); if (logger == null) { logger = VoileLogManager.GetLogger(this.GetType()); } dockPanel1.Theme = vS2003Theme1; logger.Info("Main Form initalized."); DockLog = new DockContents.DockLog(); SetDockDefault(DockLog, "Log"); DockLog.Show(dockPanel1, DockState.DockBottom); DockLog.InitalizeLogging(); logger.Info("Attached dockable Logger."); DockTaskList = new DockContents.DockTaskList(); SetDockDefault(DockTaskList, "Tasks"); DockTaskList.Show(DockLog.Pane, DockAlignment.Right, 0.5); DockWorldView = new DockContents.DockWorldView(); SetDockDefault(DockWorldView, "Database"); DockWorldView.Show(dockPanel1, DockState.DockLeft); } private void SetDockDefault(DockContent dock, string text) { dock.Text = text; dock.CloseButtonVisible = false; dock.FormClosing += new FormClosingEventHandler(defaultDock_FormClosing); } private void defaultDock_FormClosing(object? sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; } } private void stopAllAndExitToolStripMenuItem_Click(object sender, EventArgs e) { this.Close(); } public DockLog DockLog { get; private set; } public DockTaskList DockTaskList { get; private set; } public DockWorldView DockWorldView { get; private set; } private void Form1_Shown(object sender, EventArgs e) { VoileTask task = DockTaskList.AddTask("Initialize Database engine"); task.ImageIndex = 1; StartupInitializeDatabase initializeDatabase = new StartupInitializeDatabase(); initializeDatabase.Form1 = this; initializeDatabase.Run(); DockTaskList.listView1.Items.Remove(task); } } }