Ejemplo n.º 1
0
 private void listBoxServiceList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxServiceList.SelectedIndex >= 0)
     {
         if (this.m_CurrentServiceEntity == listBoxServiceList.SelectedItem)
         {
             return;
         }
         this.Cursor = Cursors.WaitCursor;
         try
         {
             this.serviceInfoPanelMain.SetServiceInfo(listBoxServiceList.SelectedItem as ServiceEntity);
             this.LoadAssemblyInfo(listBoxServiceList.SelectedItem as ServiceEntity);
             this.toolStripButtonRun.Enabled = true;
             m_CurrentServiceEntity          = listBoxServiceList.SelectedItem as ServiceEntity;
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.Message, "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         }
         finally
         {
             this.Cursor = Cursors.Default;
         }
     }
 }
Ejemplo n.º 2
0
 public void SetServiceInfo(ServiceEntity se)
 {
     this.textBoxKey.Text  = se.Key;
     this.textBoxType.Text = se.Type;
     this.textBoxDesc.Text = se.Description;
     this.textBoxPath.Text = se.AssemblyPath;
 }
Ejemplo n.º 3
0
        private static ServiceEntity Node2ServiceEntity(XmlNode node)
        {
            ServiceEntity entity = new ServiceEntity();

            entity.m_AssemblyPath = node.Attributes["AssemblyPath"].Value;
            entity.m_Type         = node.Attributes["Type"].Value;
            entity.m_Key          = node.Attributes["Key"].Value;
            entity.m_Description  = node.Attributes["Description"].Value;
            return(entity);
        }
Ejemplo n.º 4
0
        private void LoadAssemblyInfo(ServiceEntity se)
        {
            if (se == null)
            {
                return;
            }

            m_CurrentServiceAssembly = Assembly.LoadFrom(se.AssemblyPath);
            m_CurrentServiceType     = m_CurrentServiceAssembly.GetType(se.Type);
            using (ICommand command = (ICommand)Activator.CreateInstance(m_CurrentServiceType))
            {
                this.propertyGridArguments.SelectedObject = command.GetArguments();
            }
        }
Ejemplo n.º 5
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List <ServiceEntity> serviceEntityes = new List <ServiceEntity>();

            try
            {
                XmlElement element = null;
                element         = (XmlElement)section;
                serviceEntityes = ServiceEntity.ServiceEntities(element);
            }
            catch
            {
                throw new System.Configuration.ConfigurationErrorsException("Invalid service entity configuration");
            }
            return(serviceEntityes);
        }
Ejemplo n.º 6
0
        internal static List <ServiceEntity> ServiceEntities(XmlElement element)
        {
            List <ServiceEntity> list       = new List <ServiceEntity>();
            XmlNodeList          entityList = element.GetElementsByTagName("ServiceEntity");

            foreach (XmlNode node in entityList)
            {
                ServiceEntity entity = Node2ServiceEntity(node);
                if (list.Find(new Predicate <ServiceEntity>(delegate(ServiceEntity se){
                    if (string.Compare(se.Key, entity.Key, true) == 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                })) == null)
                {
                    list.Add(entity);
                }
            }
            return(list);
        }