diff --git a/src/Witcher/Notify/Manager/Management.Designer.cs b/src/Witcher/Notify/Manager/Management.Designer.cs index 47a9d7e..c40a91d 100644 --- a/src/Witcher/Notify/Manager/Management.Designer.cs +++ b/src/Witcher/Notify/Manager/Management.Designer.cs @@ -30,7 +30,6 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WitcherManagement)); this.Control = new System.Windows.Forms.Timer(this.components); this.Notification = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); @@ -61,6 +60,7 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Witcher Management"; + this.TopMost = true; this.TransparencyKey = System.Drawing.Color.White; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Management_FormClosing); this.ResumeLayout(false); diff --git a/src/Witcher/Notify/Manager/Management.cs b/src/Witcher/Notify/Manager/Management.cs index 548a89a..9dd8306 100644 --- a/src/Witcher/Notify/Manager/Management.cs +++ b/src/Witcher/Notify/Manager/Management.cs @@ -1,4 +1,6 @@ -using System; +#region Imports + +using System; using System.Drawing; using System.Linq; using System.Windows.Forms; @@ -7,8 +9,12 @@ using static Taskbar.Enum.Enums; using static Witcher.Witcher.Property; +#endregion + namespace Witcher.Notify.Manager { + #region Management + public partial class WitcherManagement : Form { public WitcherManagement() @@ -22,61 +28,78 @@ private void Control_Tick(object sender, EventArgs e) foreach (Form OpenForm in Application.OpenForms) { - if (OpenForm.Text.Contains(Values.Form)) + if (OpenForm.Text.StartsWith(Values.StandardForm)) { - int ID1 = Convert.ToInt32(OpenForm.Text.Replace(Values.Form, "")); - - if (ID1 >= 1) + if (Standard_Control(OpenForm)) { - bool State = true; + break; + } + } + } - foreach (Form CheckForm in Application.OpenForms) - { - if (CheckForm.Text.Contains(Values.Form)) - { - int ID2 = ID1 - 1; - if (CheckForm.Text == Values.Form + ID2) - { - State = false; - break; - } - } - } + Control.Start(); + } + + private static bool Standard_Control(Form OpenForm) + { + int ID1 = Convert.ToInt32(OpenForm.Text.Replace(Values.StandardForm, "")); + + if (ID1 >= 1) + { + bool State = true; - if (State) + foreach (Form CheckForm in Application.OpenForms) + { + if (CheckForm.Text.StartsWith(Values.StandardForm)) + { + int ID2 = ID1 - 1; + if (CheckForm.Text == Values.StandardForm + ID2) { - if (Values.Data.Location == EdgeLocationType.BotRight || Values.Data.Location == EdgeLocationType.BotLeft) - { - OpenForm.Location = new Point(OpenForm.Location.X, OpenForm.Location.Y + OpenForm.Height); - } - else - { - OpenForm.Location = new Point(OpenForm.Location.X, OpenForm.Location.Y - OpenForm.Height); - } - - OpenForm.Text = Values.Form + (ID1 - 1); + State = false; break; } } } + + if (State) + { + if (Values.Location == EdgeLocationType.BotRight || Values.Location == EdgeLocationType.BotCenter || Values.Location == EdgeLocationType.BotLeft || Values.Location == EdgeLocationType.LeftCenter || Values.Location == EdgeLocationType.FullCenter) + { + OpenForm.Location = new Point(OpenForm.Location.X, OpenForm.Location.Y + OpenForm.Height); + } + else + { + OpenForm.Location = new Point(OpenForm.Location.X, OpenForm.Location.Y - OpenForm.Height); + } + + OpenForm.Text = Values.StandardForm + (ID1 - 1); + return true; + } } - Control.Start(); + return false; } private void Notification_Tick(object sender, EventArgs e) { Notification.Stop(); - if (Values.Datas.Any() && ActiveOpen < MaxOpen) + try { - foreach (Structs.Data Data in Values.Datas) + if (Values.Datas.Any() && ActiveOpen < MaxOpen) { - Witcher.Notify.Show(Data); - Values.Datas.Remove(Data); - break; + foreach (Structs.Data Data in Values.Datas) + { + Witcher.Notify.Show(Data); + Values.Datas.Remove(Data); + break; + } } } + catch + { + //throw; + } Notification.Start(); } @@ -86,4 +109,6 @@ private void Management_FormClosing(object sender, FormClosingEventArgs e) e.Cancel = true; } } + + #endregion } \ No newline at end of file diff --git a/src/Witcher/Notify/Manager/Management.resx b/src/Witcher/Notify/Manager/Management.resx index 28b7365..34637f2 100644 --- a/src/Witcher/Notify/Manager/Management.resx +++ b/src/Witcher/Notify/Manager/Management.resx @@ -117,11 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + 17, 17 - - + + 104, 17 - + \ No newline at end of file diff --git a/src/Witcher/Notify/Standard/NYB.Designer.cs b/src/Witcher/Notify/Standard/Standard.Designer.cs similarity index 96% rename from src/Witcher/Notify/Standard/NYB.Designer.cs rename to src/Witcher/Notify/Standard/Standard.Designer.cs index 6efa919..5edc877 100644 --- a/src/Witcher/Notify/Standard/NYB.Designer.cs +++ b/src/Witcher/Notify/Standard/Standard.Designer.cs @@ -1,6 +1,6 @@ namespace Witcher.Notify.Standard { - partial class NYB + partial class WitcherStandard { /// /// Required designer variable. @@ -114,7 +114,7 @@ private void InitializeComponent() this.General.Interval = 25; this.General.Tick += new System.EventHandler(this.General_Tick); // - // NYB + // WitcherStandard // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -128,15 +128,15 @@ private void InitializeComponent() this.Icon = global::Witcher.Properties.Resources.ICO; this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "NYB"; + this.Name = "WitcherStandard"; this.Opacity = 0D; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "NYB"; + this.Text = "Witcher Standard"; this.TopMost = true; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NYB_FormClosed); - this.Load += new System.EventHandler(this.NYB_Load); - this.LocationChanged += new System.EventHandler(this.NYB_LocationChanged); + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Standard_FormClosed); + this.Load += new System.EventHandler(this.Standard_Load); + this.LocationChanged += new System.EventHandler(this.Standard_LocationChanged); this.LEFT.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.CLOSE)).EndInit(); this.ResumeLayout(false); diff --git a/src/Witcher/Notify/Standard/NYB.cs b/src/Witcher/Notify/Standard/Standard.cs similarity index 69% rename from src/Witcher/Notify/Standard/NYB.cs rename to src/Witcher/Notify/Standard/Standard.cs index 7b593c4..d21b9f3 100644 --- a/src/Witcher/Notify/Standard/NYB.cs +++ b/src/Witcher/Notify/Standard/Standard.cs @@ -1,4 +1,6 @@ -using System; +#region Imports + +using System; using System.Drawing; using System.Windows.Forms; using Witcher.Struct; @@ -8,24 +10,33 @@ using static Witcher.Enum.Enums; using static Witcher.Witcher.Property; +#endregion + namespace Witcher.Notify.Standard { - public partial class NYB : Form + #region Standard + + /// + /// + /// + public partial class WitcherStandard : Form { private Structs.Data Local = Values.Data; private StateType Stage = StateType.Show; private int Time = 0; - public NYB(Structs.Data Data) + public WitcherStandard(Structs.Data Data) { InitializeComponent(); - Text = Values.Form; + Text = Values.StandardForm; Local = Data; - if (Data.Theme == ThemaType.Dark) + TopMost = Local.Top; + + if (Local.Theme == ThemaType.Dark) { BackColor = Color.FromArgb(38, 38, 38); TEXT.ForeColor = Color.Gainsboro; @@ -36,10 +47,10 @@ public NYB(Structs.Data Data) TEXT.ForeColor = Color.FromArgb(38, 38, 38); } - TEXT.Text = Data.Text; - TEXT.Font = Data.Font; + TEXT.Text = Local.Text; + TEXT.Font = Local.Font; - switch (Data.Alert) + switch (Local.Alert) { case AlertType.Success: LEFT.BackColor = Color.SeaGreen; @@ -58,33 +69,57 @@ public NYB(Structs.Data Data) BAR.ProgressColor = LEFT.BackColor; } - private void NYB_Load(object sender, EventArgs e) + private void Standard_Load(object sender, EventArgs e) { Location = SingleLocation(Local.Location, Width, Height, (ActiveOpen * Height) + Local.Distance); if (Local.Location == EdgeLocationType.BotRight) { - LEFT.Dock = DockStyle.Right; - Location = new Point(Location.X + (ActiveOpen * Height), Location.Y + Local.Distance); + Location = new Point(Location.X + (ActiveOpen * Height), Location.Y - Local.Distance); + } + else if (Local.Location == EdgeLocationType.BotCenter) + { + Location = new Point(Location.X, Location.Y - Local.Distance); } else if (Local.Location == EdgeLocationType.BotLeft) { - Location = new Point(Location.X - (ActiveOpen * Height), Location.Y + Local.Distance); + Location = new Point(Location.X - (ActiveOpen * Height), Location.Y - Local.Distance); } else if (Local.Location == EdgeLocationType.TopRight) { - LEFT.Dock = DockStyle.Right; - Location = new Point(Location.X + (ActiveOpen * Height), Location.Y - Local.Distance); + Location = new Point(Location.X + (ActiveOpen * Height), Location.Y + Local.Distance); BAR.Dock = DockStyle.Top; } - else + else if (Local.Location == EdgeLocationType.TopCenter) { - Location = new Point(Location.X - (ActiveOpen * Height), Location.Y - Local.Distance); + Location = new Point(Location.X, Location.Y + Local.Distance); + BAR.Dock = DockStyle.Top; + } + else if (Local.Location == EdgeLocationType.TopLeft) + { + Location = new Point(Location.X - (ActiveOpen * Height), Location.Y + Local.Distance); + BAR.Dock = DockStyle.Top; + } + else if (Local.Location == EdgeLocationType.LeftCenter) + { + Location = new Point(Location.X - (ActiveOpen * Height), Location.Y - (ActiveOpen * Height)); + BAR.Dock = DockStyle.Top; + } + else if (Local.Location == EdgeLocationType.RightCenter) + { + Location = new Point(Location.X + (ActiveOpen * Height), Location.Y + (ActiveOpen * Height)); + } + else if (Local.Location == EdgeLocationType.CalcCenter) + { + Location = new Point(Location.X, Location.Y + (ActiveOpen * Height)); + } + else if (Local.Location == EdgeLocationType.FullCenter) + { + Location = new Point(Location.X, Location.Y - (ActiveOpen * Height)); BAR.Dock = DockStyle.Top; } - Text += ActiveOpen; - ActiveOpen++; + Text += ActiveOpen++; } private void CLOSE_MouseEnter(object sender, EventArgs e) @@ -123,13 +158,13 @@ private void General_Tick(object sender, EventArgs e) if (Local.Distance > 0) { Local.Distance -= 2; - if (Local.Location == EdgeLocationType.BotRight || Local.Location == EdgeLocationType.BotLeft) + if (Local.Location == EdgeLocationType.BotRight || Local.Location == EdgeLocationType.BotCenter || Local.Location == EdgeLocationType.BotLeft || Local.Location == EdgeLocationType.LeftCenter || Local.Location == EdgeLocationType.FullCenter) { - Location = new Point(Location.X, Location.Y - 2); + Location = new Point(Location.X, Location.Y + 2); } else { - Location = new Point(Location.X, Location.Y + 2); + Location = new Point(Location.X, Location.Y - 2); } } else @@ -138,7 +173,7 @@ private void General_Tick(object sender, EventArgs e) } break; case StateType.Close: - if (Text == Values.Form + "0") + if (Text == Values.StandardForm + "0") { if (Time <= Local.Time) { @@ -166,14 +201,14 @@ private void General_Tick(object sender, EventArgs e) } else { - NYB_FormClosed(sender, e); + Standard_FormClosed(sender, e); Dispose(); } break; } } - private void NYB_LocationChanged(object sender, EventArgs e) + private void Standard_LocationChanged(object sender, EventArgs e) { if (General.Enabled && Stage == StateType.Close) { @@ -182,9 +217,11 @@ private void NYB_LocationChanged(object sender, EventArgs e) } } - private void NYB_FormClosed(object sender, EventArgs e) + private void Standard_FormClosed(object sender, EventArgs e) { ActiveOpen--; } } + + #endregion } \ No newline at end of file diff --git a/src/Witcher/Notify/Standard/NYB.resx b/src/Witcher/Notify/Standard/Standard.resx similarity index 100% rename from src/Witcher/Notify/Standard/NYB.resx rename to src/Witcher/Notify/Standard/Standard.resx diff --git a/src/Witcher/Struct/Structs.cs b/src/Witcher/Struct/Structs.cs index bc8eb8f..1f2931c 100644 --- a/src/Witcher/Struct/Structs.cs +++ b/src/Witcher/Struct/Structs.cs @@ -26,8 +26,10 @@ public struct Data public Enums.AlertType Alert; public Enums.ThemaType Theme; public int Distance; + public string Title; public string Text; public Font Font; + public bool Top; public int Time; } #endregion diff --git a/src/Witcher/Value/Values.cs b/src/Witcher/Value/Values.cs index 5c7a275..ba67500 100644 --- a/src/Witcher/Value/Values.cs +++ b/src/Witcher/Value/Values.cs @@ -29,7 +29,17 @@ public class Values /// /// /// - internal static string Form = "WNM"; + internal static string StandardForm = "WNM"; + + /// + /// + /// + internal static Enums.NotifyType Type; + + /// + /// + /// + internal static EdgeLocationType Location; /// /// @@ -41,8 +51,10 @@ public class Values Alert = Enums.AlertType.Success, Theme = Enums.ThemaType.Dark, Distance = 32, + Title = "Witcher Test Title", Text = "Witcher Test Notify!", Font = new Font("Raleway SemiBold", 12F, FontStyle.Bold, GraphicsUnit.Point, 162), + Top = true, Time = 5000 }; diff --git a/src/Witcher/Witcher.cs b/src/Witcher/Witcher.cs index 2a5ac00..ccf6522 100644 --- a/src/Witcher/Witcher.cs +++ b/src/Witcher/Witcher.cs @@ -81,20 +81,42 @@ static Notify() M.Show(); } + public static void Clear() + { + try + { + Values.Datas.Clear(); + + foreach (Form OpenForm in Application.OpenForms) + { + if (OpenForm.Text.StartsWith(Values.StandardForm)) + { + OpenForm.Close(); + OpenForm.Dispose(); + } + } + } + catch + { + Clear(); + } + } + /// /// /// /// public static void Show(Structs.Data Data) { - Values.Data.Location = Data.Location; - - if (Property.ActiveOpen < Property.MaxOpen) + if (Property.ActiveOpen <= 0 || (Property.ActiveOpen < Property.MaxOpen && Values.Type == Data.Type && Values.Location == Data.Location)) { + Values.Type = Data.Type; + Values.Location = Data.Location; + switch (Data.Type) { default: - Show(new NYB(Data)); + Show(new WitcherStandard(Data)); break; } } diff --git a/src/Witcher/Witcher.csproj b/src/Witcher/Witcher.csproj index 662e60a..9111711 100644 --- a/src/Witcher/Witcher.csproj +++ b/src/Witcher/Witcher.csproj @@ -1,10 +1,10 @@ - net48 + - + net40;net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netcoreapp3.1-windows;net5.0-windows;net6.0-windows true Resources\ICO.ico 1.0.0.1 diff --git a/src/Witcher_CR/Main.Designer.cs b/src/Witcher_CR/Main.Designer.cs index 042e643..e418b04 100644 --- a/src/Witcher_CR/Main.Designer.cs +++ b/src/Witcher_CR/Main.Designer.cs @@ -47,6 +47,9 @@ private void InitializeComponent() this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel(); this.Status = new System.Windows.Forms.Timer(this.components); + this.button5 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button6 = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -203,11 +206,11 @@ private void InitializeComponent() // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(108, 99); + this.textBox1.Location = new System.Drawing.Point(12, 181); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(120, 20); + this.textBox1.Size = new System.Drawing.Size(216, 20); this.textBox1.TabIndex = 11; - this.textBox1.Text = "Witcher_CR Test Notify!"; + this.textBox1.Text = "My Name Is Soferity Witcher Sweetheart!"; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.textBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged); // @@ -217,9 +220,11 @@ private void InitializeComponent() this.toolStripStatusLabel1, this.toolStripStatusLabel2, this.toolStripStatusLabel3}); - this.statusStrip1.Location = new System.Drawing.Point(0, 133); + this.statusStrip1.Location = new System.Drawing.Point(0, 231); this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.ShowItemToolTips = true; this.statusStrip1.Size = new System.Drawing.Size(240, 22); + this.statusStrip1.SizingGrip = false; this.statusStrip1.TabIndex = 12; this.statusStrip1.Text = "statusStrip1"; // @@ -246,11 +251,48 @@ private void InitializeComponent() this.Status.Enabled = true; this.Status.Tick += new System.EventHandler(this.Status_Tick); // + // button5 + // + this.button5.Cursor = System.Windows.Forms.Cursors.Hand; + this.button5.Location = new System.Drawing.Point(153, 98); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(75, 23); + this.button5.TabIndex = 13; + this.button5.TabStop = false; + this.button5.Text = "Clear"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.Button5_Click); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(12, 155); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(216, 20); + this.textBox2.TabIndex = 14; + this.textBox2.Text = "Soferity Witcher"; + this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.textBox2.TextChanged += new System.EventHandler(this.TextBox2_TextChanged); + // + // button6 + // + this.button6.Cursor = System.Windows.Forms.Cursors.Hand; + this.button6.Location = new System.Drawing.Point(12, 126); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(216, 23); + this.button6.TabIndex = 15; + this.button6.TabStop = false; + this.button6.Text = "Select Font"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.Button6_Click); + // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(240, 155); + this.ClientSize = new System.Drawing.Size(240, 253); + this.Controls.Add(this.button6); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.button5); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.textBox1); this.Controls.Add(this.maskedTextBox3); @@ -298,5 +340,8 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3; private System.Windows.Forms.Timer Status; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button6; } } \ No newline at end of file diff --git a/src/Witcher_CR/Main.cs b/src/Witcher_CR/Main.cs index 86a42d9..758cbad 100644 --- a/src/Witcher_CR/Main.cs +++ b/src/Witcher_CR/Main.cs @@ -22,8 +22,10 @@ public partial class Main : Form Alert = AlertType.Success, Theme = ThemaType.Dark, Distance = 32, - Text = "Witcher_CR Test Notify!", + Title = "Soferity Witcher", + Text = "My Name Is Soferity Witcher Sweetheart!", Font = new Font("Raleway SemiBold", 12F, FontStyle.Bold, GraphicsUnit.Point, 162), + Top = true, Time = 5000 }; @@ -38,7 +40,7 @@ private void TextBox1_TextChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { - Data.Text = "Witcher_CR Test Notify!"; + Data.Text = "My Name Is Soferity Witcher Sweetheart!"; } else { @@ -46,6 +48,18 @@ private void TextBox1_TextChanged(object sender, EventArgs e) } } + private void TextBox2_TextChanged(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBox2.Text)) + { + Data.Title = "Soferity Witcher"; + } + else + { + Data.Title = textBox2.Text; + } + } + private void MaskedTextBox1_TextChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBox1.Text) || string.IsNullOrWhiteSpace(maskedTextBox1.Text)) @@ -124,11 +138,30 @@ private void Show_Click(object sender, EventArgs e) Notify.Show(Data); } + private void Button5_Click(object sender, EventArgs e) + { + Notify.Clear(); + } + private void Status_Tick(object sender, EventArgs e) { toolStripStatusLabel1.Text = "Active: " + ActiveOpen; toolStripStatusLabel2.Text = "Deactive: " + DeactiveOpen; toolStripStatusLabel3.Text = "Total: " + TotalOpen; } + + private void Button6_Click(object sender, EventArgs e) + { + FontDialog FD = new(); + + FD.Font = new Font("Raleway SemiBold", 12F, FontStyle.Bold, GraphicsUnit.Point, 162); + FD.MaxSize = 40; + FD.MinSize = 4; + + if (FD.ShowDialog() == DialogResult.OK) + { + Data.Font = FD.Font; + } + } } } \ No newline at end of file diff --git a/src/Witcher_CR/Witcher_CR.csproj b/src/Witcher_CR/Witcher_CR.csproj index 76f034c..ab78e80 100644 --- a/src/Witcher_CR/Witcher_CR.csproj +++ b/src/Witcher_CR/Witcher_CR.csproj @@ -1,8 +1,8 @@  - net48 + - + net48;netcoreapp3.1-windows;net5.0-windows;net6.0-windows WinExe false true