private void ReloadPlaylists() { var result = YtManagementClient.GetPlaylists(); if (result.Status != ActionStatus.Success) { this.ShowTooltip(result.Message, ToolTipIcon.Error); return; } this.comboBoxTarget.DataSource = result.Data.Select(o => new { Name = o.Title, Value = o.Title }).ToList(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (!(this.fastObjectListViewRules.SelectedObject is ManagementRule item)) { return; } var result = YtManagementClient.DeleteRule(item.Id); if (result.Status != ActionStatus.Success) { this.ShowTooltip(result.Message, ToolTipIcon.Error); return; } this.ShowTooltip("Success", ToolTipIcon.Info); ReloadRules(); }
private void buttonAdd_Click(object sender, EventArgs e) { var rule = new ManagementRule { Regex = this.checkBoxRegex.Checked, RuleString = this.textBoxRule.Text, Target = this.comboBoxTarget.SelectedValue as string ?? this.comboBoxTarget.Text, IgnoreVideo = this.checkBoxIgnore.Checked, Priority = (int)this.numericUpDownPriority.Value, SearchPosition = (SearchPosition)this.comboBoxSearchPosition.SelectedValue }; var result = YtManagementClient.AddRule(rule); if (result.Status != ActionStatus.Success) { this.ShowTooltip(result.Message, ToolTipIcon.Error); return; } this.ShowTooltip("Success", ToolTipIcon.Info); ReloadRules(); }
private void buttonUpdate_Click(object sender, EventArgs e) { if (!(this.fastObjectListViewRules.SelectedObject is ManagementRule item)) { return; } item.RuleString = this.textBoxRule.Text; item.Target = this.comboBoxTarget.SelectedValue as string ?? this.comboBoxTarget.Text; item.Regex = this.checkBoxRegex.Checked; item.IgnoreVideo = this.checkBoxIgnore.Checked; item.Priority = (int)this.numericUpDownPriority.Value; item.SearchPosition = (SearchPosition)this.comboBoxSearchPosition.SelectedValue; var result = YtManagementClient.UpdateRule(item); if (result.Status != ActionStatus.Success) { this.ShowTooltip(result.Message, ToolTipIcon.Error); return; } this.ShowTooltip("Success", ToolTipIcon.Info); ReloadRules(); }
private void toolStripComboBoxApi_SelectedIndexChanged(object sender, EventArgs e) { YtManagementClient.SetApiUri((string)this.toolStripComboBoxApi.SelectedItem); }