From c251d61efb3fae475d410a535d8784afc78bd16f Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 27 Sep 2017 12:56:14 -0400 Subject: [PATCH] Remove async server page stuff --- TGControlPanel/Main.Designer.cs | 74 ++++++--------- TGControlPanel/Main.resx | 9 -- TGControlPanel/ServerPage.cs | 160 ++++++++++++-------------------- 3 files changed, 86 insertions(+), 157 deletions(-) diff --git a/TGControlPanel/Main.Designer.cs b/TGControlPanel/Main.Designer.cs index 9aa3dacae2..acd77ebb86 100644 --- a/TGControlPanel/Main.Designer.cs +++ b/TGControlPanel/Main.Designer.cs @@ -28,12 +28,8 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); this.RepoBGW = new System.ComponentModel.BackgroundWorker(); - this.ServerTimer = new System.Windows.Forms.Timer(this.components); - this.WorldStatusChecker = new System.ComponentModel.BackgroundWorker(); - this.WorldStatusTimer = new System.Windows.Forms.Timer(this.components); this.FullUpdateWorker = new System.ComponentModel.BackgroundWorker(); this.ServerStartBGW = new System.ComponentModel.BackgroundWorker(); this.ChatPanel = new System.Windows.Forms.TabPage(); @@ -74,6 +70,7 @@ this.AdminModeSpecial = new System.Windows.Forms.RadioButton(); this.AdminModeNormal = new System.Windows.Forms.RadioButton(); this.ServerPanel = new System.Windows.Forms.TabPage(); + this.ServerPageRefreshButton = new System.Windows.Forms.Button(); this.AutostartCheckbox = new System.Windows.Forms.CheckBox(); this.WebclientCheckBox = new System.Windows.Forms.CheckBox(); this.WorldAnnounceButton = new System.Windows.Forms.Button(); @@ -104,10 +101,10 @@ this.CompilerLabel = new System.Windows.Forms.Label(); this.compileButton = new System.Windows.Forms.Button(); this.initializeButton = new System.Windows.Forms.Button(); - this.compilerProgressBar = new System.Windows.Forms.ProgressBar(); this.ServerStatusLabel = new System.Windows.Forms.Label(); this.ServerStatusTitle = new System.Windows.Forms.Label(); this.BYONDPanel = new System.Windows.Forms.TabPage(); + this.BYONDRefreshButton = new System.Windows.Forms.Button(); this.LatestVersionLabel = new System.Windows.Forms.Label(); this.LatestVersionTitle = new System.Windows.Forms.Label(); this.StagedVersionLabel = new System.Windows.Forms.Label(); @@ -157,7 +154,6 @@ this.StaticFileCreateButton = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); this.StaticFileListBox = new System.Windows.Forms.ListBox(); - this.BYONDRefreshButton = new System.Windows.Forms.Button(); this.ChatPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ChatPortSelector)).BeginInit(); this.ChatProviderSelectorPanel.SuspendLayout(); @@ -179,22 +175,6 @@ this.RepoBGW.WorkerReportsProgress = true; this.RepoBGW.WorkerSupportsCancellation = true; // - // ServerTimer - // - this.ServerTimer.Interval = 10000; - this.ServerTimer.Tick += new System.EventHandler(this.ServerTimer_Tick); - // - // WorldStatusChecker - // - this.WorldStatusChecker.WorkerReportsProgress = true; - this.WorldStatusChecker.WorkerSupportsCancellation = true; - this.WorldStatusChecker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.WorldStatusChecker_DoWork); - // - // WorldStatusTimer - // - this.WorldStatusTimer.Interval = 10000; - this.WorldStatusTimer.Tick += new System.EventHandler(this.WorldStatusTimer_Tick); - // // FullUpdateWorker // this.FullUpdateWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.FullUpdateWorker_DoWork); @@ -650,6 +630,7 @@ // ServerPanel // this.ServerPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(40)))), ((int)(((byte)(34))))); + this.ServerPanel.Controls.Add(this.ServerPageRefreshButton); this.ServerPanel.Controls.Add(this.AutostartCheckbox); this.ServerPanel.Controls.Add(this.WebclientCheckBox); this.ServerPanel.Controls.Add(this.WorldAnnounceButton); @@ -680,7 +661,6 @@ this.ServerPanel.Controls.Add(this.CompilerLabel); this.ServerPanel.Controls.Add(this.compileButton); this.ServerPanel.Controls.Add(this.initializeButton); - this.ServerPanel.Controls.Add(this.compilerProgressBar); this.ServerPanel.Controls.Add(this.ServerStatusLabel); this.ServerPanel.Controls.Add(this.ServerStatusTitle); this.ServerPanel.Location = new System.Drawing.Point(4, 22); @@ -690,6 +670,17 @@ this.ServerPanel.TabIndex = 2; this.ServerPanel.Text = "Server"; // + // ServerPageRefreshButton + // + this.ServerPageRefreshButton.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.ServerPageRefreshButton.Location = new System.Drawing.Point(626, 13); + this.ServerPageRefreshButton.Name = "ServerPageRefreshButton"; + this.ServerPageRefreshButton.Size = new System.Drawing.Size(118, 28); + this.ServerPageRefreshButton.TabIndex = 43; + this.ServerPageRefreshButton.Text = "Refresh"; + this.ServerPageRefreshButton.UseVisualStyleBackColor = true; + this.ServerPageRefreshButton.Click += new System.EventHandler(this.ServerPageRefreshButton_Click); + // // AutostartCheckbox // this.AutostartCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -820,7 +811,7 @@ // this.CompileCancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CompileCancelButton.Enabled = false; - this.CompileCancelButton.Location = new System.Drawing.Point(737, 302); + this.CompileCancelButton.Location = new System.Drawing.Point(382, 302); this.CompileCancelButton.Name = "CompileCancelButton"; this.CompileCancelButton.Size = new System.Drawing.Size(69, 31); this.CompileCancelButton.TabIndex = 31; @@ -1054,16 +1045,6 @@ this.initializeButton.UseVisualStyleBackColor = true; this.initializeButton.Click += new System.EventHandler(this.InitializeButton_Click); // - // compilerProgressBar - // - this.compilerProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.compilerProgressBar.Location = new System.Drawing.Point(110, 302); - this.compilerProgressBar.MarqueeAnimationSpeed = 50; - this.compilerProgressBar.Name = "compilerProgressBar"; - this.compilerProgressBar.Size = new System.Drawing.Size(618, 31); - this.compilerProgressBar.TabIndex = 10; - // // ServerStatusLabel // this.ServerStatusLabel.AutoSize = true; @@ -1110,6 +1091,16 @@ this.BYONDPanel.TabIndex = 1; this.BYONDPanel.Text = "BYOND"; // + // BYONDRefreshButton + // + this.BYONDRefreshButton.Location = new System.Drawing.Point(462, 252); + this.BYONDRefreshButton.Name = "BYONDRefreshButton"; + this.BYONDRefreshButton.Size = new System.Drawing.Size(118, 28); + this.BYONDRefreshButton.TabIndex = 14; + this.BYONDRefreshButton.Text = "Refresh"; + this.BYONDRefreshButton.UseVisualStyleBackColor = true; + this.BYONDRefreshButton.Click += new System.EventHandler(this.BYONDRefreshButton_Click); + // // LatestVersionLabel // this.LatestVersionLabel.AutoSize = true; @@ -1734,16 +1725,6 @@ this.StaticFileListBox.TabIndex = 0; this.StaticFileListBox.SelectedIndexChanged += new System.EventHandler(this.StaticFileListBox_SelectedIndexChanged); // - // BYONDRefreshButton - // - this.BYONDRefreshButton.Location = new System.Drawing.Point(462, 252); - this.BYONDRefreshButton.Name = "BYONDRefreshButton"; - this.BYONDRefreshButton.Size = new System.Drawing.Size(118, 28); - this.BYONDRefreshButton.TabIndex = 14; - this.BYONDRefreshButton.Text = "Refresh"; - this.BYONDRefreshButton.UseVisualStyleBackColor = true; - this.BYONDRefreshButton.Click += new System.EventHandler(this.BYONDRefreshButton_Click); - // // Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1782,9 +1763,6 @@ #endregion private System.ComponentModel.BackgroundWorker RepoBGW; - private System.Windows.Forms.Timer ServerTimer; - private System.ComponentModel.BackgroundWorker WorldStatusChecker; - private System.Windows.Forms.Timer WorldStatusTimer; private System.ComponentModel.BackgroundWorker FullUpdateWorker; private System.ComponentModel.BackgroundWorker ServerStartBGW; private System.Windows.Forms.TabPage ChatPanel; @@ -1855,7 +1833,6 @@ private System.Windows.Forms.Label CompilerLabel; private System.Windows.Forms.Button compileButton; private System.Windows.Forms.Button initializeButton; - private System.Windows.Forms.ProgressBar compilerProgressBar; private System.Windows.Forms.Label ServerStatusLabel; private System.Windows.Forms.Label ServerStatusTitle; private System.Windows.Forms.TabPage BYONDPanel; @@ -1909,5 +1886,6 @@ private System.Windows.Forms.Button StaticFileDownloadButton; private System.Windows.Forms.Button TGSJsonUpdate; private System.Windows.Forms.Button BYONDRefreshButton; + private System.Windows.Forms.Button ServerPageRefreshButton; } } diff --git a/TGControlPanel/Main.resx b/TGControlPanel/Main.resx index 2573caca6b..02c5de84c9 100644 --- a/TGControlPanel/Main.resx +++ b/TGControlPanel/Main.resx @@ -120,15 +120,6 @@ 17, 17 - - 416, 18 - - - 532, 18 - - - 694, 18 - 843, 18 diff --git a/TGControlPanel/ServerPage.cs b/TGControlPanel/ServerPage.cs index fd7928595a..c4cf091de4 100644 --- a/TGControlPanel/ServerPage.cs +++ b/TGControlPanel/ServerPage.cs @@ -25,9 +25,6 @@ namespace TGControlPanel void InitServerPage() { LoadServerPage(); - ServerTimer.Start(); - WorldStatusChecker.RunWorkerAsync(); - WorldStatusChecker.RunWorkerCompleted += WorldStatusChecker_RunWorkerCompleted; FullUpdateWorker.RunWorkerCompleted += FullUpdateWorker_RunWorkerCompleted; ServerPathTextbox.LostFocus += ServerPathTextbox_LostFocus; ServerPathTextbox.KeyDown += ServerPathTextbox_KeyDown; @@ -63,14 +60,6 @@ namespace TGControlPanel TestmergeButton.Enabled = true; UpdateTestmergeButton.Enabled = true; LoadServerPage(); - ServerTimer.Start(); - } - - private void WorldStatusChecker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) - { - if (DDStatusString != "Topic recieve error!" || ServerStatusLabel.Text == "OFFLINE") - ServerStatusLabel.Text = DDStatusString; - WorldStatusTimer.Start(); } private void CompileCancelButton_Click(object sender, EventArgs e) @@ -110,7 +99,6 @@ namespace TGControlPanel WebclientCheckBox.Visible = RepoExists; PortSelector.Visible = RepoExists; projectNameText.Visible = RepoExists; - compilerProgressBar.Visible = RepoExists; CompilerStatusLabel.Visible = RepoExists; CompileCancelButton.Visible = RepoExists; CompilerLabel.Visible = RepoExists; @@ -171,35 +159,30 @@ namespace TGControlPanel { case TGCompilerStatus.Compiling: CompilerStatusLabel.Text = "Compiling..."; - compilerProgressBar.Style = ProgressBarStyle.Marquee; compileButton.Enabled = false; initializeButton.Enabled = false; CompileCancelButton.Enabled = true; break; case TGCompilerStatus.Initializing: CompilerStatusLabel.Text = "Initializing..."; - compilerProgressBar.Style = ProgressBarStyle.Marquee; compileButton.Enabled = false; initializeButton.Enabled = false; CompileCancelButton.Enabled = false; break; case TGCompilerStatus.Initialized: CompilerStatusLabel.Text = "Idle"; - compilerProgressBar.Style = ProgressBarStyle.Blocks; initializeButton.Enabled = true; compileButton.Enabled = true; CompileCancelButton.Enabled = false; break; case TGCompilerStatus.Uninitialized: CompilerStatusLabel.Text = "Uninitialized"; - compilerProgressBar.Style = ProgressBarStyle.Blocks; compileButton.Enabled = false; initializeButton.Enabled = true; CompileCancelButton.Enabled = false; break; default: CompilerStatusLabel.Text = "Unknown!"; - compilerProgressBar.Style = ProgressBarStyle.Blocks; initializeButton.Enabled = true; compileButton.Enabled = true; CompileCancelButton.Enabled = true; @@ -214,19 +197,7 @@ namespace TGControlPanel updatingFields = false; } } - - private void ServerTimer_Tick(object sender, System.EventArgs e) - { - try - { - LoadServerPage(); - } - catch (Exception ex) - { - ServerTimer.Stop(); - Program.ServiceDisconnectException(ex); - } - } + private void ProjectNameText_LostFocus(object sender, EventArgs e) { UpdateProjectName(); @@ -256,7 +227,6 @@ namespace TGControlPanel UpdateMergeButton.Enabled = false; TestmergeButton.Enabled = false; UpdateTestmergeButton.Enabled = false; - compilerProgressBar.Style = ProgressBarStyle.Marquee; switch (fuAction) { case FullUpdateAction.Testmerge: @@ -272,10 +242,14 @@ namespace TGControlPanel CompilerStatusLabel.Text = String.Format("Updating and testmerging pull request #{0}...", testmergePR); break; } - ServerTimer.Stop(); FullUpdateWorker.RunWorkerAsync(); } + private void ServerPageRefreshButton_Click(object sender, EventArgs e) + { + LoadServerPage(); + } + private void InitializeButton_Click(object sender, EventArgs e) { if (!Server.GetComponent().Initialize()) @@ -288,27 +262,6 @@ namespace TGControlPanel MessageBox.Show("Unable to start compilation!"); LoadServerPage(); } - //because of lol byond this can take some time... - private void WorldStatusChecker_DoWork(object sender, DoWorkEventArgs e) - { - try - { - if (!Server.GetComponent().Exists()) - DDStatusString = "NOT INSTALLED"; - else - DDStatusString = Server.GetComponent().StatusString(true); - } - catch - { - DDStatusString = "ERROR"; - } - } - - private void WorldStatusTimer_Tick(object sender, System.EventArgs e) - { - WorldStatusTimer.Stop(); - WorldStatusChecker.RunWorkerAsync(); - } private void AutostartCheckbox_CheckedChanged(object sender, System.EventArgs e) { @@ -375,61 +328,68 @@ namespace TGControlPanel private void FullUpdateWorker_DoWork(object sender, DoWorkEventArgs e) { - var Repo = Server.GetComponent(); - var DM = Server.GetComponent(); - switch (fuAction) + try { - case FullUpdateAction.Testmerge: - updateError = Repo.MergePullRequest(testmergePR); - if (updateError == null) - { - Repo.GenerateChangelog(out updateError); - updateError = DM.Compile(true) ? updateError : "Compilation failed!"; - } - break; - case FullUpdateAction.UpdateHard: - updateError = Repo.Update(true); - if (updateError == null) - { - Repo.GenerateChangelog(out updateError); - if (updateError == null) - updateError = Repo.PushChangelog(); - updateError = DM.Compile(true) ? updateError : "Compilation failed!"; - } - break; - case FullUpdateAction.UpdateHardTestmerge: - updateError = Repo.Update(true); - if (updateError == null) - { - Repo.GenerateChangelog(out updateError); - if (updateError == null) - updateError = Repo.PushChangelog(); + var Repo = Server.GetComponent(); + var DM = Server.GetComponent(); + switch (fuAction) + { + case FullUpdateAction.Testmerge: updateError = Repo.MergePullRequest(testmergePR); if (updateError == null) { Repo.GenerateChangelog(out updateError); updateError = DM.Compile(true) ? updateError : "Compilation failed!"; } - } - break; - case FullUpdateAction.UpdateMerge: - updateError = Repo.Update(false); - if (updateError == null) - { - Repo.GenerateChangelog(out updateError); + break; + case FullUpdateAction.UpdateHard: + updateError = Repo.Update(true); if (updateError == null) - Repo.PushChangelog(); //not an error 99% of the time if this fails, just a dirty tree - updateError = DM.Compile(true) ? updateError : "Compilation failed!"; - } - break; - case FullUpdateAction.Reset: - updateError = Repo.Reset(true); - if (updateError == null) - { - Repo.GenerateChangelog(out updateError); - updateError = DM.Compile(true) ? updateError : "Compilation failed!"; - } - break; + { + Repo.GenerateChangelog(out updateError); + if (updateError == null) + updateError = Repo.PushChangelog(); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; + } + break; + case FullUpdateAction.UpdateHardTestmerge: + updateError = Repo.Update(true); + if (updateError == null) + { + Repo.GenerateChangelog(out updateError); + if (updateError == null) + updateError = Repo.PushChangelog(); + updateError = Repo.MergePullRequest(testmergePR); + if (updateError == null) + { + Repo.GenerateChangelog(out updateError); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; + } + } + break; + case FullUpdateAction.UpdateMerge: + updateError = Repo.Update(false); + if (updateError == null) + { + Repo.GenerateChangelog(out updateError); + if (updateError == null) + Repo.PushChangelog(); //not an error 99% of the time if this fails, just a dirty tree + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; + } + break; + case FullUpdateAction.Reset: + updateError = Repo.Reset(true); + if (updateError == null) + { + Repo.GenerateChangelog(out updateError); + updateError = DM.Compile(true) ? updateError : "Compilation failed!"; + } + break; + } + } + catch (Exception ex) + { + Program.ServiceDisconnectException(ex); } } private void ResetTestmerge_Click(object sender, EventArgs e)