using Remontor.Connector; using Remontor.History; using Remontor.Setting; using Remontor.Words; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using static Remontor.Setting.SettingWordsControl; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Remontor { internal partial class Form1 : Form { public bool CloseOn = false; public bool ShowOn = false; private FormWindowState lastWindowsState = FormWindowState.Minimized; public MenuStripCommand MenuStripCommand; public Form1() { SGlobalSetting.LoadSetting(); WordsList.MainCategory = SGlobalSetting.LoadWords(); InitializeComponent(); barSessionControl1.hideTabHistory += flowContainer1.HideBar; barSessionControl1.hideTabWords += flowContainerWords1.HideBar; barSessionControl1.hideTabSetting += flowConteinerSetting1.HideBar; SConnector.Panel = this.panel3; SConnector.FormMain = this; MenuStripCommand = new MenuStripCommand(); MenuStripCommand.UpdateTree += flowContainerWords1.UpdateTree; flowConteinerSetting1.settingWordsControl1.UpdateTree += flowContainerWords1.UpdateTree; flowConteinerSetting1.UpdateTree += flowContainerWords1.UpdateTree; flowConteinerSetting1.Save += flowContainerWords1.Save; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); } private void tabControl1_SizeChanged(object sender, EventArgs e) { SConnector.ResizeActiv(); if (this.WindowState != lastWindowsState) { lastWindowsState = this.WindowState; SConnector.StateChangeActiv(); } } protected override void WndProc(ref Message m) { if ((m.Msg == 0x210 && m.WParam.ToInt32() == 513) || m.Msg == 0x201) { Point clickPoint = this.PointToClient(Cursor.Position); if (!flowContainerWords1.Bounds.Contains(clickPoint)) { barSessionControl1.ShowBarSet(BarShow.HideBar); } } base.WndProc(ref m); } private void Form1_Load(object sender, EventArgs e) { SConnector.x = this.Bounds.X; SConnector.y = this.Bounds.Y; SConnector.Width = this.Bounds.Width; SConnector.Height = this.Bounds.Height; } private void barSessionControl1_Load(object sender, EventArgs e) { } private void Form1_Deactivate(object sender, EventArgs e) { barSessionControl1.ShowBarSet(BarShow.HideBar); if (SConnector.ActionConnect != null) SConnector.ActionConnect.Resize(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if(SConnector.ActivConnect() > 0) { DialogResult result = MessageBox.Show("Не все активные сессии закрыты. Все равно закрыть приложение?","Завершение приложения", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if(result == DialogResult.No) { e.Cancel = true; return; } } SConnector.CloseAllSession(); CloseOn = true; flowContainerWords1.Save(); SGlobalSetting.SaveSettig(); } private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { } private void Form1_Shown(object sender, EventArgs e) { if (SGlobalSetting.settingApp.StartMode) { Finder.Finder finder = new Finder.Finder(); finder.ShowDialog(); } } } }