using BrightIdeasSoftware; using DatenDB; using Deckungsbeitrag.AA_Forms; using Deckungsbeitrag.AA_Klassen; using Deckungsbeitrag.Properties; using Deckungsbeitrag.UserControls; using Npgsql; using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Management.Instrumentation; using System.Reflection; using System.Runtime; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Input; using System.Xml.Serialization; using Timer = System.Windows.Forms.Timer; namespace Deckungsbeitrag { public partial class FormMain : Form { private Benutzer benutzer = null; Meldungen meldung = new Meldungen(); bool open = false; private bool isDragging = false; private Point dragStartPoint; private Point newLocation; private Size _fixedSize; private bool _handlingResize; private readonly UserSettingsManager _settings = new UserSettingsManager(); private bool formloading = false; private Dictionary> auftragliste; private GroupBox draggedBox; private Point dragOffset; private Point dragOffsetButton; private PictureBox ghostImage; private Button draggedButton; private bool isButtonDragging = false; private Timer dragEndTimer; private Timer UserTimeout; private int verbleibendeZeitMs = 5 * 60 * 1000; private bool countdownAktiv = false; private List ArtikellisteProAuftrag; public FormMain() { InitializeComponent(); this.panelMain.AllowDrop = true; this.toolStripMenu.Size = new Size(toolStripButton1.Size.Width + 20, this.Height); } public FormMain(Benutzer benutzer) : this() { this.benutzer = benutzer; ghostImage = new PictureBox { Size = new Size(200, 100), // GroupBox-Größe Visible = false, BackColor = Color.Transparent, SizeMode = PictureBoxSizeMode.StretchImage }; panelMain.Controls.Add(ghostImage); // Zum Panel! } private async void FormMain_Load(object sender, EventArgs e) { formloading = true; _settings.Load(); this.buttonKundeArtikelUpdate.BringToFront(); // Feedback Button wird eingefügt. Location wird in FormMain_Shown berechnet. UCFeedback feedback = new UCFeedback(this.benutzer); this.panelMain.Controls.Add(feedback); this.WindowState = FormWindowState.Maximized; this.MaximizedBounds = Screen.PrimaryScreen.WorkingArea; this.panelMain.Width = this.Width - this.toolStripMenu.Right - 20; this.panelMain.Location = new Point(this.toolStripMenu.Right, 0); this.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.labelKundenDatum.Text = @"N:\TECHNIK\Software\Wirl-Verwaltung\Listen\Kundenstammblatt.csv"; this.labelSoftwareDatum.Text = @"N:\TECHNIK\Software\Wirl-Verwaltung\Setup\SetupVerwaltung*.msi"; this.labelArtikelDatum.Text = @"N:\TECHNIK\Software\Wirl-Verwaltung\Listen\Artikelkurzliste.csv"; GetStatistik(); GetSaison(); if (this.groupBoxContAnz.Visible) { await GetAuftraege(); GetContainerProTag(); } this.Activate(); _fixedSize = this.Size; formloading = false; } private void FormMain_Shown(object sender, EventArgs e) { // Meldung wenn Updates oder Imports erledigt wurden. if (Program.Artikelliste_Importiert | Program.Kundenliste_Importiert | Program.Software_Updated) { string[] updates = new string[3]; updates[0] = Program.Artikelliste_Importiert ? "Artikelliste: ✅" : "Artikelliste: ❌"; updates[1] = Program.Kundenliste_Importiert ? "Kundenliste: ✅" : "Kundenliste: ❌"; updates[2] = Program.Software_Updated ? "Software: ✅" : "Sofware: ❌"; MessageBox.Show($"Folgende Updates wurden heute durchgeführt:\n\n{updates[0]}\n{updates[1]}\n{updates[2]}", "UPDATES DURCHGEFÜHRT", MessageBoxButtons.OK, MessageBoxIcon.Information); } // Location des Feedback Buttons wird berechnet. (Screengröße ist hier klar) UCFeedback fb = this.panelMain.Controls.Find("feedback", false)[0] as UCFeedback; if (fb != null) fb.Location = new Point(panelMain.Width - fb.Width - 10, panelMain.Top + 10); // Controls werde Enabled Enable_Controls(); } private void Enable_Controls() { // BUTTONS ENABLEN foreach (Button button in this.panelMain.Controls.OfType