diff --git a/AnimeCon.Vlc.Starter/Form1.Designer.cs b/AnimeCon.Vlc.Starter/Form1.Designer.cs index 94c8da3..58ddc2a 100644 --- a/AnimeCon.Vlc.Starter/Form1.Designer.cs +++ b/AnimeCon.Vlc.Starter/Form1.Designer.cs @@ -28,110 +28,149 @@ /// private void InitializeComponent() { - this.lbHosts = new System.Windows.Forms.ListBox(); - this.lblName = new System.Windows.Forms.Label(); - this.txtHostname = new System.Windows.Forms.TextBox(); - this.btnAdd = new System.Windows.Forms.Button(); - this.btnRemove = new System.Windows.Forms.Button(); - this.btnPause = new System.Windows.Forms.Button(); - this.lblPassword = new System.Windows.Forms.Label(); - this.txtPassword = new System.Windows.Forms.TextBox(); - this.SuspendLayout(); - // - // lbHosts - // - this.lbHosts.FormattingEnabled = true; - this.lbHosts.Location = new System.Drawing.Point(13, 13); - this.lbHosts.Name = "lbHosts"; - this.lbHosts.Size = new System.Drawing.Size(192, 95); - this.lbHosts.TabIndex = 0; - // - // lblName - // - this.lblName.AutoSize = true; - this.lblName.Location = new System.Drawing.Point(13, 115); - this.lblName.Name = "lblName"; - this.lblName.Size = new System.Drawing.Size(58, 13); - this.lblName.TabIndex = 1; - this.lblName.Text = "Hostname:"; - // - // txtHostname - // - this.txtHostname.Location = new System.Drawing.Point(13, 132); - this.txtHostname.Name = "txtHostname"; - this.txtHostname.Size = new System.Drawing.Size(192, 20); - this.txtHostname.TabIndex = 2; - this.txtHostname.Text = "localhost:8080"; - // - // btnAdd - // - this.btnAdd.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnAdd.Location = new System.Drawing.Point(13, 158); - this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(75, 23); - this.btnAdd.TabIndex = 3; - this.btnAdd.Text = "Add"; - this.btnAdd.UseVisualStyleBackColor = true; - this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); - // - // btnRemove - // - this.btnRemove.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnRemove.Location = new System.Drawing.Point(130, 158); - this.btnRemove.Name = "btnRemove"; - this.btnRemove.Size = new System.Drawing.Size(75, 23); - this.btnRemove.TabIndex = 4; - this.btnRemove.Text = "Remove"; - this.btnRemove.UseVisualStyleBackColor = true; - this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); - // - // btnPause - // - this.btnPause.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnPause.Location = new System.Drawing.Point(13, 266); - this.btnPause.Name = "btnPause"; - this.btnPause.Size = new System.Drawing.Size(192, 23); - this.btnPause.TabIndex = 5; - this.btnPause.Text = "Pause / Unpause"; - this.btnPause.UseVisualStyleBackColor = true; - this.btnPause.Click += new System.EventHandler(this.btnPause_Click); - // - // lblPassword - // - this.lblPassword.AutoSize = true; - this.lblPassword.Location = new System.Drawing.Point(16, 188); - this.lblPassword.Name = "lblPassword"; - this.lblPassword.Size = new System.Drawing.Size(56, 13); - this.lblPassword.TabIndex = 6; - this.lblPassword.Text = "Password:"; - // - // txtPassword - // - this.txtPassword.Location = new System.Drawing.Point(13, 205); - this.txtPassword.Name = "txtPassword"; - this.txtPassword.Size = new System.Drawing.Size(192, 20); - this.txtPassword.TabIndex = 7; - this.txtPassword.Text = "animecon"; - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.SystemColors.ControlText; - this.ClientSize = new System.Drawing.Size(216, 312); - this.Controls.Add(this.txtPassword); - this.Controls.Add(this.lblPassword); - this.Controls.Add(this.btnPause); - this.Controls.Add(this.btnRemove); - this.Controls.Add(this.btnAdd); - this.Controls.Add(this.txtHostname); - this.Controls.Add(this.lblName); - this.Controls.Add(this.lbHosts); - this.ForeColor = System.Drawing.SystemColors.ControlLight; - this.Name = "Form1"; - this.Text = "Starter"; - this.ResumeLayout(false); - this.PerformLayout(); + this.lbHosts = new System.Windows.Forms.ListBox(); + this.lblName = new System.Windows.Forms.Label(); + this.txtHostname = new System.Windows.Forms.TextBox(); + this.btnAdd = new System.Windows.Forms.Button(); + this.btnRemove = new System.Windows.Forms.Button(); + this.btnPause = new System.Windows.Forms.Button(); + this.lblPassword = new System.Windows.Forms.Label(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.btnStop = new System.Windows.Forms.Button(); + this.btnNext = new System.Windows.Forms.Button(); + this.btnPrevious = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lbHosts + // + this.lbHosts.FormattingEnabled = true; + this.lbHosts.Location = new System.Drawing.Point(13, 13); + this.lbHosts.Name = "lbHosts"; + this.lbHosts.Size = new System.Drawing.Size(192, 95); + this.lbHosts.TabIndex = 0; + // + // lblName + // + this.lblName.AutoSize = true; + this.lblName.Location = new System.Drawing.Point(13, 115); + this.lblName.Name = "lblName"; + this.lblName.Size = new System.Drawing.Size(58, 13); + this.lblName.TabIndex = 1; + this.lblName.Text = "Hostname:"; + // + // txtHostname + // + this.txtHostname.Location = new System.Drawing.Point(13, 132); + this.txtHostname.Name = "txtHostname"; + this.txtHostname.Size = new System.Drawing.Size(192, 20); + this.txtHostname.TabIndex = 2; + this.txtHostname.Text = "localhost:8080"; + // + // btnAdd + // + this.btnAdd.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnAdd.Location = new System.Drawing.Point(13, 158); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(75, 23); + this.btnAdd.TabIndex = 3; + this.btnAdd.Text = "Add"; + this.btnAdd.UseVisualStyleBackColor = true; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); + // + // btnRemove + // + this.btnRemove.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnRemove.Location = new System.Drawing.Point(130, 158); + this.btnRemove.Name = "btnRemove"; + this.btnRemove.Size = new System.Drawing.Size(75, 23); + this.btnRemove.TabIndex = 4; + this.btnRemove.Text = "Remove"; + this.btnRemove.UseVisualStyleBackColor = true; + this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); + // + // btnPause + // + this.btnPause.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPause.Location = new System.Drawing.Point(13, 266); + this.btnPause.Name = "btnPause"; + this.btnPause.Size = new System.Drawing.Size(192, 23); + this.btnPause.TabIndex = 5; + this.btnPause.Text = "Pause / Unpause"; + this.btnPause.UseVisualStyleBackColor = true; + this.btnPause.Click += new System.EventHandler(this.btnPause_Click); + // + // lblPassword + // + this.lblPassword.AutoSize = true; + this.lblPassword.Location = new System.Drawing.Point(16, 188); + this.lblPassword.Name = "lblPassword"; + this.lblPassword.Size = new System.Drawing.Size(56, 13); + this.lblPassword.TabIndex = 6; + this.lblPassword.Text = "Password:"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(13, 205); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.Size = new System.Drawing.Size(192, 20); + this.txtPassword.TabIndex = 7; + this.txtPassword.Text = "animecon"; + // + // btnStop + // + this.btnStop.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnStop.Location = new System.Drawing.Point(12, 291); + this.btnStop.Name = "btnStop"; + this.btnStop.Size = new System.Drawing.Size(192, 23); + this.btnStop.TabIndex = 8; + this.btnStop.Text = "Stop"; + this.btnStop.UseVisualStyleBackColor = true; + this.btnStop.Click += new System.EventHandler(this.btnStop_Click); + // + // btnNext + // + this.btnNext.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnNext.Location = new System.Drawing.Point(109, 237); + this.btnNext.Name = "btnNext"; + this.btnNext.Size = new System.Drawing.Size(96, 23); + this.btnNext.TabIndex = 9; + this.btnNext.Text = "Next"; + this.btnNext.UseVisualStyleBackColor = true; + this.btnNext.Click += new System.EventHandler(this.btnNext_Click); + // + // btnPrevious + // + this.btnPrevious.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPrevious.Location = new System.Drawing.Point(12, 237); + this.btnPrevious.Name = "btnPrevious"; + this.btnPrevious.Size = new System.Drawing.Size(96, 23); + this.btnPrevious.TabIndex = 10; + this.btnPrevious.Text = "Previous"; + this.btnPrevious.UseVisualStyleBackColor = true; + this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlText; + this.ClientSize = new System.Drawing.Size(216, 326); + this.Controls.Add(this.btnPrevious); + this.Controls.Add(this.btnNext); + this.Controls.Add(this.btnStop); + this.Controls.Add(this.txtPassword); + this.Controls.Add(this.lblPassword); + this.Controls.Add(this.btnPause); + this.Controls.Add(this.btnRemove); + this.Controls.Add(this.btnAdd); + this.Controls.Add(this.txtHostname); + this.Controls.Add(this.lblName); + this.Controls.Add(this.lbHosts); + this.ForeColor = System.Drawing.SystemColors.ControlLight; + this.Name = "Form1"; + this.Text = "Starter"; + this.ResumeLayout(false); + this.PerformLayout(); } @@ -145,6 +184,9 @@ private System.Windows.Forms.Button btnPause; private System.Windows.Forms.Label lblPassword; private System.Windows.Forms.TextBox txtPassword; - } + private System.Windows.Forms.Button btnStop; + private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Button btnPrevious; + } } diff --git a/AnimeCon.Vlc.Starter/Form1.cs b/AnimeCon.Vlc.Starter/Form1.cs index 9982e78..909492c 100644 --- a/AnimeCon.Vlc.Starter/Form1.cs +++ b/AnimeCon.Vlc.Starter/Form1.cs @@ -33,11 +33,35 @@ namespace AnimeCon.Vlc.Starter { foreach (var item in lbHosts.Items) { - DoWebRequestAsync(item.ToString()); + DoWebRequestAsync(item.ToString(), "pl_pause"); } - } + } - private async Task DoWebRequestAsync(string hostname) + private void btnStop_Click(object sender, EventArgs e) + { + foreach (var item in lbHosts.Items) + { + DoWebRequestAsync(item.ToString(), "pl_stop"); + } + } + + private void btnPrevious_Click(object sender, EventArgs e) + { + foreach (var item in lbHosts.Items) + { + DoWebRequestAsync(item.ToString(), "pl_previous"); + } + } + + private void btnNext_Click(object sender, EventArgs e) + { + foreach (var item in lbHosts.Items) + { + DoWebRequestAsync(item.ToString(), "pl_next"); + } + } + + private async Task DoWebRequestAsync(string hostname, string command) { using (HttpClient httpClient = new HttpClient()) { @@ -50,7 +74,7 @@ namespace AnimeCon.Vlc.Starter try { // Make a GET request to the remote XML file - HttpResponseMessage response = await httpClient.GetAsync($"http://{hostname}/requests/status.xml?command=pl_pause"); + HttpResponseMessage response = await httpClient.GetAsync($"http://{hostname}/requests/status.xml?command={command}"); // Ensure the request was successful response.EnsureSuccessStatusCode(); @@ -65,5 +89,5 @@ namespace AnimeCon.Vlc.Starter } } } - } + } }