private void MainForm2_Load(object sender, EventArgs e) { var version = Assembly.GetEntryAssembly().GetName().Version; var name = Assembly.GetEntryAssembly().GetName().Name; #if DEBUG name += " - DEBUG"; #elif BETA name += " - BETA"; #endif name += $" v{version}"; _logger = Logger.Instance.GetLogger <MainForm2>(); LogUpdateTimer.Start(); var screenMaxSize = new Point(SystemInformation.VirtualScreen.Width, SystemInformation.VirtualScreen.Height); if (!CommandLineArgs.SafeMode) { // Set window location if (Settings.Default.WindowLocation != Point.Empty) { if (Settings.Default.WindowLocation.X <= screenMaxSize.X && Settings.Default.WindowLocation.Y <= screenMaxSize.Y && Settings.Default.WindowLocation.Y >= 0 && Settings.Default.WindowLocation.Y >= 0) { Location = Settings.Default.WindowLocation; } } // Set window size if (Settings.Default.WindowSize.Width >= 0 && Settings.Default.WindowSize.Height >= 0 && Settings.Default.WindowSize.Width <= screenMaxSize.X && Settings.Default.WindowSize.Height <= screenMaxSize.Y) { Size = Settings.Default.WindowSize; } splitContainer1.SplitterDistance = Settings.Default.SplitterDistance; } Resize += MainForm2_Resize; Text = name; _logger.Information($"{name} started", version); #if DEBUG _logger.Information("This is a DEBUG build of YetAnotherRelogger. This is meant for private use, do not share!"); _logger.Information("This build may have bugs. Use at your own risk!"); #elif BETA _logger.Information("This is a BETA build of Demonbuddy. This is not meant for general usage. Please report any issues you may have in the beta thread on our forums."); _logger.Information("This build may have bugs. Use at your own risk!"); #endif // Check if we are run as admin if (!Program.IsRunAsAdmin) { _logger.Warning("WE DON'T HAVE ADMIN RIGHTS!!"); } // Check if current application path is the same as last saved path // this is used for Windows autostart in a sutation where user moved/renamed the relogger if (Settings.Default.StartWithWindows && !Settings.Default.Location.Equals(Application.ExecutablePath)) { _logger.Information("Application current path does not match last saved path. Updating registy key."); // Update to current location Settings.Default.Location = Application.ExecutablePath; // Update Regkey RegistryClass.WindowsAutoStartAdd(); } // Set stuff for list of bots botGrid.DoubleBuffered(true); botGrid.AllowUserToAddRows = false; botGrid.MultiSelect = false; botGrid.MouseUp += dataGridView1_MouseUp; botGrid.CellValueChanged += dataGridView1_CellValueChanged; UpdateGridView(); // OnClose Closing += MainForm2_Closing; // TrayIcon ToggleIcon(); TrayIcon.Icon = Icon; TrayIcon.DoubleClick += TrayIcon_DoubleClick; _menu = new ContextMenu(); _menu.MenuItems.Add(0, new MenuItem("Show", Show_Click)); _menu.MenuItems.Add(1, new MenuItem("Hide", Hide_Click)); _menu.MenuItems.Add(2, new MenuItem("Exit", Exit_Click)); TrayIcon.ContextMenu = _menu; // Minimize on start if (Settings.Default.MinimizeOnStart) { WindowState = FormWindowState.Minimized; if (Settings.Default.MinimizeToTray) { HideMe(); ToggleIcon(); ShowNotification("Yet Another Relogger", "Minimize on start"); } } // Load global hotkeys GlobalHotkeys.Instance.Load(); }
public TransactionsForm() { InitializeComponent(); LogUpdateTimer.Start(); }