Exemplo n.º 1
0
        void LoadSources()
        {
            UseWaitCursor = true;
            Application.DoEvents();
            LockUpdate(true);
            try
            {
                lvSource.Services = null;

                ServiceItemsDataCollection services = new ServiceItemsDataCollection();

                Language     from         = (cbFrom.SelectedItem as LanguageDataContainer).Language;
                Language     to           = (cbTo.SelectedItem as LanguageDataContainer).Language;
                LanguagePair languagePair = new LanguagePair(from, to);
                string       subject      = (cbSubject.SelectedItem as SubjectContainer).Subject;


                foreach (KeyValuePair <LanguagePair, ServiceItemsCollection> kvp in Manager.LanguagePairServiceItems)
                {
                    if (
                        (kvp.Key.From == languagePair.From || languagePair.From == Language.Any) &&
                        (kvp.Key.To == languagePair.To || languagePair.To == Language.Any)
                        )
                    {
                        foreach (ServiceItem si in kvp.Value)
                        {
                            if (subject != SubjectConstants.Any)
                            {
                                if (si.SupportedSubjects.Contains(subject))
                                {
                                    ServiceItemData sid = new ServiceItemData(si, kvp.Key, subject);
                                    if (!profile.Services.Contains(sid))
                                    {
                                        services.Add(sid);
                                    }
                                }
                            }
                            else
                            {
                                foreach (string siSubject in si.SupportedSubjects)
                                {
                                    ServiceItemData sid = new ServiceItemData(si, kvp.Key, siSubject);
                                    if (!profile.Services.Contains(sid))
                                    {
                                        services.Add(sid);
                                    }
                                }
                            }
                        }
                    }
                }
                lvSource.Services = services;
            }
            finally
            {
                UseWaitCursor = false;
                LockUpdate(false);
            }
        }
Exemplo n.º 2
0
        public override bool Equals(Object obj)
        {
            ServiceItemData arg = obj as ServiceItemData;

            if (arg == null)
            {
                return(false);
            }
            return(Name.Equals(arg.Name) && Subject.Equals(arg.Subject) && languagePair.Equals(arg.languagePair));
        }
Exemplo n.º 3
0
        public virtual void EnableService(string name, LanguagePair languagePair, string subject, bool enable)
        {
            ServiceItemData sid = new ServiceItemData(name, languagePair, subject);

            if (enable)
            {
                disabledServiceItems.Remove(sid);
            }
            else
            {
                if (!disabledServiceItems.Contains(sid))
                {
                    disabledServiceItems.Add(sid);
                }
            }
        }
Exemplo n.º 4
0
 void ShowStatus(ServiceItemData serviceItemData, ServiceStatusControl statusControl)
 {
     if (serviceItemData == null)
     {
         statusControl.Visible = false;
     }
     else
     {
         statusControl.Visible      = true;
         statusControl.ShowLanguage = true;
         ServiceSettingsContainer sc = new ServiceSettingsContainer(
             new ServiceItemSetting(serviceItemData.LanguagePair,
                                    serviceItemData.Subject, serviceItemData.ServiceItem,
                                    null),
             true);
         statusControl.Status = sc;
     }
 }
Exemplo n.º 5
0
 public ServiceItemChangedEventArgs(ServiceItemData serviceItemData)
 {
     this.serviceItemData = serviceItemData;
 }
Exemplo n.º 6
0
 public ServiceItemDataContainer(ServiceItemData serviceItemData)
 {
     this.serviceItemData = serviceItemData;
     GenerateData();
 }
Exemplo n.º 7
0
        public virtual bool IsServiceEnabled(string name, LanguagePair languagePair, string subject)
        {
            ServiceItemData sid = new ServiceItemData(name, languagePair, subject);

            return(!disabledServiceItems.Contains(sid));
        }