diff --git a/.gitignore b/.gitignore index 8d579c8..6a4b3aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .git .vs +*.user ServiceMonitor/obj/* -*.user \ No newline at end of file +ServiceMonitor/bin/* diff --git a/ServiceMonitor/ApplicationDescriptor.cs b/ServiceMonitor/ApplicationDescriptor.cs index 2b594dd..3dec5d0 100644 --- a/ServiceMonitor/ApplicationDescriptor.cs +++ b/ServiceMonitor/ApplicationDescriptor.cs @@ -57,4 +57,9 @@ public sealed class ApplicationDescriptor public ApplicationRealm Realm { get; } public ApplicationType Type { get; } + + public override string ToString() + { + return string.Format("{0}-{1}", Realm.Name.ToLower(), Type.ToString().ToLower()); + } } diff --git a/ServiceMonitor/MainForm.cs b/ServiceMonitor/MainForm.cs index 6d32010..7abd72c 100644 --- a/ServiceMonitor/MainForm.cs +++ b/ServiceMonitor/MainForm.cs @@ -1,14 +1,21 @@ using WeifenLuo.WinFormsUI.Docking; -namespace ServiceMonitor -{ - public partial class MainForm : Form - { - public MainForm() - { - InitializeComponent(); +namespace ServiceMonitor; - _dockPanel.Theme = new VS2015BlueTheme(); - } +public partial class MainForm : Form +{ + public MainForm() + { + InitializeComponent(); + + _dockPanel.Theme = new VS2015BlueTheme(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + ProcessDockContent content = new ProcessDockContent(ApplicationDescriptor.CzechWorker); + content.Show(_dockPanel, DockState.Document); } } diff --git a/ServiceMonitor/ProcessDockContent.Designer.cs b/ServiceMonitor/ProcessDockContent.Designer.cs new file mode 100644 index 0000000..0ae904b --- /dev/null +++ b/ServiceMonitor/ProcessDockContent.Designer.cs @@ -0,0 +1,37 @@ +namespace ServiceMonitor +{ + partial class ProcessDockContent + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/ServiceMonitor/ProcessDockContent.cs b/ServiceMonitor/ProcessDockContent.cs new file mode 100644 index 0000000..5e9a9b1 --- /dev/null +++ b/ServiceMonitor/ProcessDockContent.cs @@ -0,0 +1,28 @@ +using WeifenLuo.WinFormsUI.Docking; + +namespace ServiceMonitor; + +public partial class ProcessDockContent : DockContent +{ + public ProcessDockContent() + { + if (!DesignMode) + { + throw new Exception("Only for design mode"); + } + + InitializeComponent(); + + Descriptor = null!; + } + + public ProcessDockContent(ApplicationDescriptor descriptor) + { + Descriptor = descriptor; + + Text = descriptor.ToString(); + CloseButtonVisible = true; + } + + public ApplicationDescriptor Descriptor { get; } +} diff --git a/ServiceMonitor/Program.cs b/ServiceMonitor/Program.cs index ff3635a..9d4a6e8 100644 --- a/ServiceMonitor/Program.cs +++ b/ServiceMonitor/Program.cs @@ -1,17 +1,16 @@ -namespace ServiceMonitor +namespace ServiceMonitor; + +internal static class Program { - internal static class Program + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new MainForm()); - } + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new MainForm()); } } \ No newline at end of file diff --git a/ServiceMonitor/ServiceMonitor.csproj b/ServiceMonitor/ServiceMonitor.csproj index 663fdb8..463404a 100644 --- a/ServiceMonitor/ServiceMonitor.csproj +++ b/ServiceMonitor/ServiceMonitor.csproj @@ -8,4 +8,9 @@ enable + + + + + \ No newline at end of file