private void SetText(string text, bool newLine = true) { if (TB_LogConsole.InvokeRequired) { var handler = new MessageEventHandler(SetText); Invoke(handler, new object[] { text, newLine }); } else { if (newLine) { TB_LogConsole.AppendText(Environment.NewLine + text); } else { TB_LogConsole.AppendText(text); } } }
private void MainWindow_ResizeEnd(object sender, EventArgs e) { if (Width < MinimalWindowWidth) { Width = MinimalWindowWidth; } if (Height < MinimalWindowHeight) { Height = MinimalWindowHeight; } var widthDelta = Width - InitialWindowWidth; var heightDelta = Height - InitialWindowHeight; var widthOffset = widthDelta / 4; var heightOffset = heightDelta / 4; L_Projects.AdjustLocation(widthOffset / 2, 0); LB_AllProjects.Width += widthOffset; LB_AllProjects.Height += heightDelta; B_Start.AdjustLocation(0, heightDelta); L_SelectedProjects.AdjustLocation(widthOffset + widthOffset / 2, 0); LB_SelectedProjects.AdjustLocation(widthOffset, 0); LB_SelectedProjects.Width += widthOffset; LB_SelectedProjects.Height += heightDelta; L_Services.AdjustLocation(widthOffset * 2 + widthOffset / 2, 0); LB_Services.AdjustLocation(widthOffset * 2, 0); LB_Services.Width += widthOffset; LB_Services.Height += heightDelta; L_Console.AdjustLocation(widthOffset * 3 + widthOffset / 2, 0); TB_LogConsole.AdjustLocation(widthOffset * 3, 0); TB_LogConsole.Width += widthDelta - widthOffset * 3; TB_LogConsole.Height += heightDelta; B_StartStopService.AdjustLocation(widthDelta, heightDelta); B_OpenDeployDirectory.AdjustLocation(widthDelta, heightDelta); B_AttachToProcess.AdjustLocation(widthDelta, heightDelta); }
private void B_Start_Click(object sender, EventArgs e) { try { if (Worker.IsAttached) { SetText("Debugger is attached, stopping..."); Worker.Detach(); } TB_LogConsole.Clear(); SetText("Starting operation...", false); WorkerProcess = new Task(Worker.StartOperation); WorkerProcess.Start(); ChangeControlsState(false); } catch (Exception ex) { MessageBox.Show($"Error on execution: {ex.Message}", "Exception", MessageBoxButtons.OK); } }