コード例 #1
0
        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();
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 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;
 }
コード例 #4
0
 void OnUpdateAllEvent(CSource sender, ESimpleEvent taskevent)
 {
     lock (this)
     {
         TaskState = CheckScheduledTasks();
         if (TaskState == ESimpleEvent.finished)
         {
             AfterUpdateAll(true);
         }
         if (TaskState == ESimpleEvent.failed)
         {
             AfterUpdateAll(false);
         }
     }
 }
コード例 #5
0
 void OnUpdateSourceEvent(CSource sender, ESimpleEvent taskevent)
 {
     OnUpdateAllEvent(sender, taskevent);
 }
コード例 #6
0
        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;
        }
コード例 #7
0
 public int GetSourceNr(CSource source)
 {
     lock (this)
     {
         return Sources.FindIndex(sr => source == sr);
     }
 }
コード例 #8
0
        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;
            }
        }
コード例 #9
0
        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;
        }
コード例 #10
0
 void OnUpdateSourceEvent(CSource sender, ESimpleEvent taskevent)
 {
     OnUpdateAllEvent(sender, taskevent);
 }