void SelectSource(CSource source) { if (SelectedSource == source) return; SelectedSource = source; if (source == null) { lbAllChanels.Items.Clear(); lbKeepChannels.Items.Clear(); tbName.Text = ""; cbURL.Text = ""; txPrefix.Text = ""; tbAddHours.Text = ""; lbAllChanels.Enabled = false; lbKeepChannels.Enabled = false; lbKeepChannels.Enabled = false; //sourceToolStripMenuItem.Enabled = false; return; } lbAllChanels.Enabled = true; lbKeepChannels.Enabled = true; lbKeepChannels.Enabled = true; //sourceToolStripMenuItem.Enabled = true; RefreshSelectSource(); }
public void AddSource(CSourceConfigData sourceConfigData) { lock (this) { CSource source; if (SourcesByName.TryGetValue(sourceConfigData.Name, out source)) { DoError("Duplicate source names"); return; } source = new CSource(); source.SetConfigData(sourceConfigData); Sources.Add(source); SourcesByName[sourceConfigData.Name] = source; source.SourceEventListener += OnSourceEvent; ConfigHasChenged = true; } }
void ClearForm() { Enabled = false; SelectedSource = null; lbAllChanels.Items.Clear(); lbKeepChannels.Items.Clear(); lbTvSources.Items.Clear(); txPrefix.Text = ""; tbName.Text = ""; cbURL.Text = ""; tbRName.Text = ""; tbAddHours.Text = ""; Enabled = true; }
void OnUpdateAllEvent(CSource sender, ESimpleEvent taskevent) { lock (this) { TaskState = CheckScheduledTasks(); if (TaskState == ESimpleEvent.finished) { AfterUpdateAll(true); } if (TaskState == ESimpleEvent.failed) { AfterUpdateAll(false); } } }
void OnUpdateSourceEvent(CSource sender, ESimpleEvent taskevent) { OnUpdateAllEvent(sender, taskevent); }
public bool Rename(CSource source, string name) { lock (this) { if (name == source.Name) return true; if (SourcesByName.ContainsKey(name)) return false; SourcesByName.Remove(source.Name); source.Name = name; SourcesByName[name] = source; ConfigHasChenged = true; } return true; }
public int GetSourceNr(CSource source) { lock (this) { return Sources.FindIndex(sr => source == sr); } }
public CSource CreateSource(string name) { lock (this) { CSource source; if (SourcesByName.TryGetValue(name, out source)) { DoError("Duplicate source names"); return null; } source = new CSource(); CSourceConfigData sourceConfigData = new CSourceConfigData(); sourceConfigData.Name = name; source.SetConfigData(sourceConfigData); Sources.Add(source); SourcesByName[sourceConfigData.Name] = source; source.SourceEventListener += OnSourceEvent; ConfigHasChenged = true; return source; } }
private void UpdateData(CSource source, string msg) { int i; if (TopManager.St.SourcesByName.Count != SourceNamesInList.Count) UpdateData(); //throw new Exception("wrong state"); SourceTextInList[source.GetSourceNr()] = msg; }