diff --git a/Remontor/.vs/Remontor/FileContentIndex/138f625a-d295-4670-b82c-68b7dd7fd890.vsidx b/Remontor/.vs/Remontor/FileContentIndex/138f625a-d295-4670-b82c-68b7dd7fd890.vsidx new file mode 100644 index 0000000..d3f5643 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/138f625a-d295-4670-b82c-68b7dd7fd890.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/2299c033-dc8c-436c-8ce6-aaef6c7684c8.vsidx b/Remontor/.vs/Remontor/FileContentIndex/2299c033-dc8c-436c-8ce6-aaef6c7684c8.vsidx new file mode 100644 index 0000000..6ad1917 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/2299c033-dc8c-436c-8ce6-aaef6c7684c8.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/2fb1c700-b583-4d86-b997-4736d2c363e3.vsidx b/Remontor/.vs/Remontor/FileContentIndex/2fb1c700-b583-4d86-b997-4736d2c363e3.vsidx new file mode 100644 index 0000000..ac598c1 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/2fb1c700-b583-4d86-b997-4736d2c363e3.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/db0c9419-0778-49f6-a942-a8bdbc9a6904.vsidx b/Remontor/.vs/Remontor/FileContentIndex/db0c9419-0778-49f6-a942-a8bdbc9a6904.vsidx new file mode 100644 index 0000000..54a81c3 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/db0c9419-0778-49f6-a942-a8bdbc9a6904.vsidx differ diff --git a/Remontor/.vs/Remontor/v17/.suo b/Remontor/.vs/Remontor/v17/.suo index fc4576a..986a0b8 100644 Binary files a/Remontor/.vs/Remontor/v17/.suo and b/Remontor/.vs/Remontor/v17/.suo differ diff --git a/Remontor/BarButtonControl.cs b/Remontor/BarButtonControl.cs index a887a0a..25c74b2 100644 --- a/Remontor/BarButtonControl.cs +++ b/Remontor/BarButtonControl.cs @@ -51,6 +51,7 @@ namespace Remontor private void CloseBtn_Click(object sender, EventArgs e) { SConnector.DeleteConnect(connect); + connect.Delete(); } } } diff --git a/Remontor/BarSessionControl.Designer.cs b/Remontor/BarSessionControl.Designer.cs index b6bcbcd..f12ae07 100644 --- a/Remontor/BarSessionControl.Designer.cs +++ b/Remontor/BarSessionControl.Designer.cs @@ -33,10 +33,10 @@ this.label1 = new System.Windows.Forms.Label(); this.button7 = new System.Windows.Forms.Button(); this.ShowWords = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); + this.OneMonBt = new System.Windows.Forms.Button(); + this.DobleMonOneBt = new System.Windows.Forms.Button(); + this.DobleMonTwoBt = new System.Windows.Forms.Button(); + this.DobleMonFull = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.ShowBar = new System.Windows.Forms.Button(); this.FlowButton.SuspendLayout(); @@ -45,7 +45,7 @@ // FlowButton // this.FlowButton.Controls.Add(this.NewBtn); - this.FlowButton.Location = new System.Drawing.Point(0, 0); + this.FlowButton.Location = new System.Drawing.Point(0, 20); this.FlowButton.Margin = new System.Windows.Forms.Padding(0); this.FlowButton.Name = "FlowButton"; this.FlowButton.Size = new System.Drawing.Size(687, 20); @@ -69,7 +69,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(489, 22); + this.label1.Location = new System.Drawing.Point(492, 4); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(195, 13); this.label1.TabIndex = 15; @@ -102,65 +102,69 @@ this.ShowWords.UseVisualStyleBackColor = true; this.ShowWords.Click += new System.EventHandler(this.ShowWords_Click); // - // button4 + // OneMonBt // - this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button4.BackColor = System.Drawing.SystemColors.Control; - this.button4.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz24; - this.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.button4.FlatAppearance.BorderSize = 0; - this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button4.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.button4.Location = new System.Drawing.Point(750, 0); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(40, 40); - this.button4.TabIndex = 12; - this.button4.UseVisualStyleBackColor = false; + this.OneMonBt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.OneMonBt.BackColor = System.Drawing.SystemColors.Control; + this.OneMonBt.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz24; + this.OneMonBt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.OneMonBt.FlatAppearance.BorderSize = 0; + this.OneMonBt.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.OneMonBt.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.OneMonBt.Location = new System.Drawing.Point(750, 0); + this.OneMonBt.Name = "OneMonBt"; + this.OneMonBt.Size = new System.Drawing.Size(40, 40); + this.OneMonBt.TabIndex = 12; + this.OneMonBt.UseVisualStyleBackColor = false; + this.OneMonBt.Click += new System.EventHandler(this.OneMonBt_Click); // - // button3 + // DobleMonOneBt // - this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button3.BackColor = System.Drawing.SystemColors.Control; - this.button3.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz2411; - this.button3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.button3.FlatAppearance.BorderSize = 0; - this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.button3.Location = new System.Drawing.Point(796, -1); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(40, 40); - this.button3.TabIndex = 11; - this.button3.UseVisualStyleBackColor = false; + this.DobleMonOneBt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.DobleMonOneBt.BackColor = System.Drawing.SystemColors.Control; + this.DobleMonOneBt.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz2411; + this.DobleMonOneBt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.DobleMonOneBt.FlatAppearance.BorderSize = 0; + this.DobleMonOneBt.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.DobleMonOneBt.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.DobleMonOneBt.Location = new System.Drawing.Point(796, -1); + this.DobleMonOneBt.Name = "DobleMonOneBt"; + this.DobleMonOneBt.Size = new System.Drawing.Size(40, 40); + this.DobleMonOneBt.TabIndex = 11; + this.DobleMonOneBt.UseVisualStyleBackColor = false; + this.DobleMonOneBt.Click += new System.EventHandler(this.DobleMonOneBt_Click); // - // button2 + // DobleMonTwoBt // - this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button2.BackColor = System.Drawing.SystemColors.Control; - this.button2.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz242; - this.button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.button2.FlatAppearance.BorderSize = 0; - this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.button2.Location = new System.Drawing.Point(841, -1); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(40, 40); - this.button2.TabIndex = 10; - this.button2.UseVisualStyleBackColor = false; + this.DobleMonTwoBt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.DobleMonTwoBt.BackColor = System.Drawing.SystemColors.Control; + this.DobleMonTwoBt.BackgroundImage = global::Remontor.Properties.Resources.tv_24dp_48752C_FILL0_wght400_GRAD0_opsz242; + this.DobleMonTwoBt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.DobleMonTwoBt.FlatAppearance.BorderSize = 0; + this.DobleMonTwoBt.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.DobleMonTwoBt.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.DobleMonTwoBt.Location = new System.Drawing.Point(841, -1); + this.DobleMonTwoBt.Name = "DobleMonTwoBt"; + this.DobleMonTwoBt.Size = new System.Drawing.Size(40, 40); + this.DobleMonTwoBt.TabIndex = 10; + this.DobleMonTwoBt.UseVisualStyleBackColor = false; + this.DobleMonTwoBt.Click += new System.EventHandler(this.DobleMonTwoBt_Click); // - // button1 + // DobleMonFull // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.BackColor = System.Drawing.SystemColors.Control; - this.button1.BackgroundImage = global::Remontor.Properties.Resources.developer_mode_tv_24dp_48752C_FILL0_wght400_GRAD0_opsz24; - this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; - this.button1.FlatAppearance.BorderSize = 0; - this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.button1.Location = new System.Drawing.Point(887, 1); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(40, 40); - this.button1.TabIndex = 9; - this.button1.UseVisualStyleBackColor = false; + this.DobleMonFull.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.DobleMonFull.BackColor = System.Drawing.SystemColors.Control; + this.DobleMonFull.BackgroundImage = global::Remontor.Properties.Resources.developer_mode_tv_24dp_48752C_FILL0_wght400_GRAD0_opsz24; + this.DobleMonFull.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.DobleMonFull.FlatAppearance.BorderSize = 0; + this.DobleMonFull.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.DobleMonFull.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.DobleMonFull.Location = new System.Drawing.Point(887, 1); + this.DobleMonFull.Name = "DobleMonFull"; + this.DobleMonFull.Size = new System.Drawing.Size(40, 40); + this.DobleMonFull.TabIndex = 9; + this.DobleMonFull.UseVisualStyleBackColor = false; + this.DobleMonFull.Click += new System.EventHandler(this.DobleMonFull_Click); // // button5 // @@ -195,13 +199,13 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.label1); this.Controls.Add(this.button7); + this.Controls.Add(this.label1); this.Controls.Add(this.ShowWords); - this.Controls.Add(this.button4); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); + this.Controls.Add(this.OneMonBt); + this.Controls.Add(this.DobleMonOneBt); + this.Controls.Add(this.DobleMonTwoBt); + this.Controls.Add(this.DobleMonFull); this.Controls.Add(this.FlowButton); this.Controls.Add(this.button5); this.Controls.Add(this.ShowBar); @@ -220,10 +224,10 @@ private System.Windows.Forms.Button ShowBar; private System.Windows.Forms.Button button5; private System.Windows.Forms.FlowLayoutPanel FlowButton; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button DobleMonFull; + private System.Windows.Forms.Button DobleMonTwoBt; + private System.Windows.Forms.Button DobleMonOneBt; + private System.Windows.Forms.Button OneMonBt; private System.Windows.Forms.Button ShowWords; private System.Windows.Forms.Button button7; private System.Windows.Forms.Label label1; diff --git a/Remontor/BarSessionControl.cs b/Remontor/BarSessionControl.cs index 0ad49ef..66f5a42 100644 --- a/Remontor/BarSessionControl.cs +++ b/Remontor/BarSessionControl.cs @@ -32,14 +32,15 @@ namespace Remontor { InitializeComponent(); SConnector.Update += UpdateBar; + SConnector.UpdateMode += SetModeMonitor; buttons = new List(); } public void UpdateBar(List connects) { bool GreyBackground = false; - buttons.Clear(); - FlowButton.Controls.Clear(); + buttons.Clear(); + FlowButton.Controls.Clear(); foreach (var item in connects) { BarButtonControl button = new BarButtonControl(item, GreyBackground); @@ -112,5 +113,37 @@ namespace Remontor } hideHistory(barShow); } + + public void SetModeMonitor(IModeMon mode) + { + if (mode is OneMon) { this.OneMonBt.BackColor = SystemColors.ActiveCaption; } + else { this.OneMonBt.BackColor = SystemColors.Control; } + if (mode is DobleMonOne) { this.DobleMonOneBt.BackColor = SystemColors.ActiveCaption; } + else { this.DobleMonOneBt.BackColor = SystemColors.Control; } + if (mode is DobleMonTwo) { this.DobleMonTwoBt.BackColor = SystemColors.ActiveCaption; } + else { this.DobleMonTwoBt.BackColor = SystemColors.Control; } + if (mode is DobleMonFull) { this.DobleMonFull.BackColor = SystemColors.ActiveCaption; } + else { this.DobleMonFull.BackColor = SystemColors.Control; } + } + + private void OneMonBt_Click(object sender, EventArgs e) + { + SConnector.SetModeMon(new OneMon()); + } + + private void DobleMonOneBt_Click(object sender, EventArgs e) + { + SConnector.SetModeMon(new DobleMonOne()); + } + + private void DobleMonTwoBt_Click(object sender, EventArgs e) + { + SConnector.SetModeMon(new DobleMonTwo()); + } + + private void DobleMonFull_Click(object sender, EventArgs e) + { + SConnector.SetModeMon(new DobleMonFull()); + } } } diff --git a/Remontor/Connector/Connect.cs b/Remontor/Connector/Connect.cs index 954237b..02727be 100644 --- a/Remontor/Connector/Connect.cs +++ b/Remontor/Connector/Connect.cs @@ -32,17 +32,17 @@ namespace Remontor.Connector static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); - [DllImport("user32.dll")] - static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); - + + private IModeMon ModeMonitor; private Process Proc; private bool Active = false; private IComp Comp; private string Login = ""; public delegate void UpdateConnect(); public event UpdateConnect Update; + public Control View; public Connect(IComp comp) { Comp = comp; @@ -57,23 +57,50 @@ namespace Remontor.Connector public void ConnectSCCM(Control panel) { - //Proc = Process.Start("notepad"); - ////Thread.Sleep(500); // Allow the process to open it's window - //Proc.WaitForInputIdle(); - //SetParent(Proc.MainWindowHandle, panel.Handle); - //SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE); - //MoveWindow(Proc.MainWindowHandle, panel.Bounds.X, panel.Bounds.Y, panel.Bounds.Width, panel.Bounds.Height, true); + View = new Panel(); + View.Dock = DockStyle.Fill; + panel.Controls.Add(View); + ModeMonitor = new OneMon(); + //Proc = Process.Start(@"CmRcViewer.exe", Comp.GetNetNameStr()); + Proc = Process.Start("notepad"); + //Thread.Sleep(500); // Allow the process to open it's window + Proc.WaitForInputIdle(); + SetParent(Proc.MainWindowHandle, View.Handle); + SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE); + ModeMonitor.Resize(Proc, View); } public void Activ(bool act) { this.Active = act; + View.Visible = act; + if(act)Resize(); + ModeMonitor.Resize(Proc, View); Update(); } public bool ActiveOn { get { return this.Active; } + + } + + public void Resize() + { + ModeMonitor.Resize(Proc, View); + } + + public IModeMon GetModeMon() + { + return ModeMonitor; + } + + public IModeMon SetModeMon(IModeMon Mode) + { + + ModeMonitor = ModeMonitor.Change(Mode); + ModeMonitor.Resize(Proc, View); + return ModeMonitor; } public IComp GetComp @@ -88,5 +115,12 @@ namespace Remontor.Connector } return Login + "(" + Comp.GetNetNameStr() + ")"; } + + public void Delete() + { + Proc.CloseMainWindow(); + SConnector.Panel.Controls.Remove(View); + Proc.Close(); + } } } diff --git a/Remontor/Connector/DobleMonFull.cs b/Remontor/Connector/DobleMonFull.cs new file mode 100644 index 0000000..84746cb --- /dev/null +++ b/Remontor/Connector/DobleMonFull.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Remontor.Connector +{ + internal class DobleMonFull : IModeMon + { + [DllImport("user32.dll")] + static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); + + private bool Chanded = false; + public int OldWidth, OldHeight; + public Point OldPoint; + public FormWindowState OldState; + public DobleMonFull() + { + OldWidth = SConnector.FormMain.Bounds.Width; + OldHeight = SConnector.FormMain.Height; + OldState = SConnector.FormMain.WindowState; + OldPoint = SConnector.FormMain.Location; + } + public override void Resize(Process Proc, Control View) + { + if (Chanded) return; + SConnector.FormMain.WindowState = FormWindowState.Normal; + SConnector.FormMain.Width = 3840; + SConnector.FormMain.Height = 1040; + SConnector.FormMain.Location = new System.Drawing.Point(0, 0); + MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y - 4, View.Bounds.Width, View.Bounds.Height, true); + } + + public override IModeMon Change(IModeMon Mode) + { + + if (!(Mode is DobleMonFull)) + { + Chanded = true; + SConnector.FormMain.WindowState = OldState; + SConnector.FormMain.Width = OldWidth; + SConnector.FormMain.Height = OldHeight; + SConnector.FormMain.Location = OldPoint; + Chanded = false; + } + else + { + return this; + } + return Mode; + } + } +} diff --git a/Remontor/Connector/DobleMonOne.cs b/Remontor/Connector/DobleMonOne.cs new file mode 100644 index 0000000..6d9ccae --- /dev/null +++ b/Remontor/Connector/DobleMonOne.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Remontor.Connector +{ + internal class DobleMonOne : IModeMon + { + [DllImport("user32.dll")] + static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); + public DobleMonOne() { } + public override void Resize(Process Proc, Control View) + { + MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y - 4, View.Bounds.Width * 2, View.Bounds.Height, true); + } + public override IModeMon Change(IModeMon Mode) + { + if (Mode == this) return this; + return Mode; + } + } +} diff --git a/Remontor/Connector/DobleMonTwo.cs b/Remontor/Connector/DobleMonTwo.cs new file mode 100644 index 0000000..3ba8674 --- /dev/null +++ b/Remontor/Connector/DobleMonTwo.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Remontor.Connector +{ + internal class DobleMonTwo : IModeMon + { + [DllImport("user32.dll")] + static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); + public DobleMonTwo() { } + public override void Resize(Process Proc, Control View) + { + MoveWindow(Proc.MainWindowHandle, View.Bounds.X - View.Bounds.Width, View.Bounds.Y - 4, View.Bounds.Width * 2, View.Bounds.Height, true); + } + public override IModeMon Change(IModeMon Mode) + { + if (Mode == this) return this; + return Mode; + } + } +} diff --git a/Remontor/Connector/IModeMon.cs b/Remontor/Connector/IModeMon.cs new file mode 100644 index 0000000..b61e7f0 --- /dev/null +++ b/Remontor/Connector/IModeMon.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Remontor.Connector +{ + + abstract class IModeMon + { + public abstract void Resize(Process Proc, Control View); + public abstract IModeMon Change(IModeMon Mode); + } +} diff --git a/Remontor/Connector/OneMon.cs b/Remontor/Connector/OneMon.cs new file mode 100644 index 0000000..c428001 --- /dev/null +++ b/Remontor/Connector/OneMon.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Remontor.Connector +{ + internal class OneMon : IModeMon + { + [DllImport("user32.dll")] + static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); + public OneMon() { } + public override void Resize(Process Proc, Control View) + { + MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y - 4, View.Bounds.Width, View.Bounds.Height, true); + } + public override IModeMon Change(IModeMon Mode) + { + if (Mode == this) return this; + return Mode; + } + } +} diff --git a/Remontor/Connector/SConnector.cs b/Remontor/Connector/SConnector.cs index 1d77c61..b0588c1 100644 --- a/Remontor/Connector/SConnector.cs +++ b/Remontor/Connector/SConnector.cs @@ -13,32 +13,57 @@ namespace Remontor.Connector { public delegate void UpdateConnect(List connects); public static event UpdateConnect Update; + public delegate void UpdateModeMon(IModeMon Mode); + public static event UpdateModeMon UpdateMode; private static List Connects = new List(); public static Control Panel; + public static Form FormMain; + public static Connect ActionConnect = null; public static void NewConnect(IComp comp) { Connect con = new Connect(comp); Connects.Add(con); Update(Connects); - Activ(con); con.ConnectSCCM(Panel); + Activ(con); HistoryList.Add(con); } public static void Activ(Connect actConnect) { - actConnect.Activ(true); + ActionConnect = actConnect; + foreach (var connect in Connects) { if (connect != actConnect) connect.Activ(false); } + actConnect.Activ(true); + UpdateMode(actConnect.GetModeMon()); + } public static void DeleteConnect(Connect Connect) { Connects.Remove(Connect); Update(Connects); } + + public static void SetModeMon(IModeMon Mode) + { + if(ActionConnect != null) + { + ActionConnect.SetModeMon(Mode); + UpdateMode(Mode); + } + } + + public static void ResizeActiv() + { + if(ActionConnect != null) + { + ActionConnect.Resize(); + } + } } } diff --git a/Remontor/Form1.Designer.cs b/Remontor/Form1.Designer.cs index c569f37..29c74bd 100644 --- a/Remontor/Form1.Designer.cs +++ b/Remontor/Form1.Designer.cs @@ -44,7 +44,7 @@ this.panel3.Controls.Add(this.label1); this.panel3.Location = new System.Drawing.Point(0, 25); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(1082, 693); + this.panel3.Size = new System.Drawing.Size(1094, 693); this.panel3.TabIndex = 1; this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint); // @@ -65,10 +65,12 @@ this.flowContainerWords1.BackColor = System.Drawing.SystemColors.Control; this.flowContainerWords1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.flowContainerWords1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flowContainerWords1.Location = new System.Drawing.Point(762, 43); + this.flowContainerWords1.Location = new System.Drawing.Point(774, 40); + this.flowContainerWords1.Margin = new System.Windows.Forms.Padding(0); this.flowContainerWords1.Name = "flowContainerWords1"; this.flowContainerWords1.Size = new System.Drawing.Size(330, 675); this.flowContainerWords1.TabIndex = 1; + this.flowContainerWords1.Visible = false; // // barSessionControl1 // @@ -76,7 +78,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.barSessionControl1.Location = new System.Drawing.Point(0, 0); this.barSessionControl1.Name = "barSessionControl1"; - this.barSessionControl1.Size = new System.Drawing.Size(1082, 40); + this.barSessionControl1.Size = new System.Drawing.Size(1094, 40); this.barSessionControl1.TabIndex = 1; this.barSessionControl1.Load += new System.EventHandler(this.barSessionControl1_Load); // @@ -87,7 +89,7 @@ this.flowContainer1.BackColor = System.Drawing.Color.Transparent; this.flowContainer1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.flowContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flowContainer1.Location = new System.Drawing.Point(762, 43); + this.flowContainer1.Location = new System.Drawing.Point(774, 40); this.flowContainer1.Name = "flowContainer1"; this.flowContainer1.Size = new System.Drawing.Size(330, 675); this.flowContainer1.TabIndex = 1; @@ -97,8 +99,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(1082, 718); + this.ClientSize = new System.Drawing.Size(1094, 718); this.Controls.Add(this.flowContainerWords1); this.Controls.Add(this.barSessionControl1); this.Controls.Add(this.flowContainer1); diff --git a/Remontor/Form1.cs b/Remontor/Form1.cs index 2ebf96a..18b15ff 100644 --- a/Remontor/Form1.cs +++ b/Remontor/Form1.cs @@ -41,6 +41,7 @@ namespace Remontor barSessionControl1.hideHistory = flowContainer1.HideBar; barSessionControl1.hideWors = flowContainerWords1.HideBar; SConnector.Panel = this.panel3; + SConnector.FormMain = this; //p1 = Process.Start("notepad"); @@ -78,6 +79,7 @@ namespace Remontor private void tabControl1_SizeChanged(object sender, EventArgs e) { + SConnector.ResizeActiv(); //MoveWindow(p1.MainWindowHandle, panel1.Bounds.X, panel1.Bounds.Y - 24, panel1.Bounds.Width, panel1.Bounds.Height, true); //MoveWindow(p.MainWindowHandle, panel3.Bounds.X, panel3.Bounds.Y, panel3.Bounds.Width, panel3.Bounds.Height, true); } diff --git a/Remontor/Remontor.csproj b/Remontor/Remontor.csproj index fb8c5ca..c742e66 100644 --- a/Remontor/Remontor.csproj +++ b/Remontor/Remontor.csproj @@ -60,7 +60,12 @@ + + + + + Form diff --git a/Remontor/bin/Debug/1ma001234.txt b/Remontor/bin/Debug/1ma001234.txt new file mode 100644 index 0000000..e69de29 diff --git a/Remontor/bin/Debug/Remontor.exe b/Remontor/bin/Debug/Remontor.exe index 31ae2b9..9f3d22a 100644 Binary files a/Remontor/bin/Debug/Remontor.exe and b/Remontor/bin/Debug/Remontor.exe differ diff --git a/Remontor/bin/Debug/Remontor.pdb b/Remontor/bin/Debug/Remontor.pdb index 507a42e..8087e7d 100644 Binary files a/Remontor/bin/Debug/Remontor.pdb and b/Remontor/bin/Debug/Remontor.pdb differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 1ffcc71..723287d 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index e0fbbce..69f0ddb 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Remontor/obj/Debug/Remontor.csproj.AssemblyReference.cache b/Remontor/obj/Debug/Remontor.csproj.AssemblyReference.cache index 8e22a1a..2981e7b 100644 Binary files a/Remontor/obj/Debug/Remontor.csproj.AssemblyReference.cache and b/Remontor/obj/Debug/Remontor.csproj.AssemblyReference.cache differ diff --git a/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache b/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache index 434d273..1d413ab 100644 --- a/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache +++ b/Remontor/obj/Debug/Remontor.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -b1e05729df70b7421776d42c13cb1f68767c0276 +cd7e56343d8cc5fabfeb6d74b09d975ecd26a392 diff --git a/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt b/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt index 57fe493..fa16c37 100644 --- a/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt +++ b/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt @@ -48,3 +48,5 @@ C:\Users\klavi\Source\Repos\Remontor\Remontor\obj\Debug\Remontor.exe C:\Users\klavi\Source\Repos\Remontor\Remontor\obj\Debug\Remontor.pdb C:\Users\klavi\Source\Repos\Remontor\Remontor\obj\Debug\Remontor.History.HistoryControl.resources C:\Users\klavi\Source\Repos\Remontor\Remontor\obj\Debug\Remontor.FlowContainerWords.resources +C:\Users\Владимир\source\repos\Remontor\Remontor\obj\Debug\Remontor.FlowContainerWords.resources +C:\Users\Владимир\source\repos\Remontor\Remontor\obj\Debug\Remontor.History.HistoryControl.resources diff --git a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache index 7cc4c73..4f70ba9 100644 Binary files a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache and b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache differ diff --git a/Remontor/obj/Debug/Remontor.exe b/Remontor/obj/Debug/Remontor.exe index 31ae2b9..9f3d22a 100644 Binary files a/Remontor/obj/Debug/Remontor.exe and b/Remontor/obj/Debug/Remontor.exe differ diff --git a/Remontor/obj/Debug/Remontor.pdb b/Remontor/obj/Debug/Remontor.pdb index 507a42e..8087e7d 100644 Binary files a/Remontor/obj/Debug/Remontor.pdb and b/Remontor/obj/Debug/Remontor.pdb differ