Exemple #1
0
 // Factory method
 public static FMSbaseObj CreateFMSObj(string id, string inputunc, string outputunc, string procedureName, int maxProcessThreads,string fmsObjclassname)
 {
   //Get the current assembly object
   Assembly a = typeof(FMSbaseObj).Assembly;
   Type t = a.GetType("CCIFMS."+fmsObjclassname);
   FMSbaseObj o = Activator.CreateInstance(t) as FMSbaseObj;
   o.Initialise(id, inputunc, outputunc, procedureName, maxProcessThreads, fmsObjclassname);
   return o;
 }
Exemple #2
0
 private void addItemToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (fMSObjs == null)
     {
         MessageBox.Show("Please [Load Setting] first!");
         return;
     }
     using (NewItemForm f = new NewItemForm())
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             FMSbaseObj o = FMSbaseObj.CreateFMSObj(f.Id, f.InputUNC, f.OutputUNC, f.StoreProcedure, f.MaxThread, f.FMSClassName);
             fMSObjs.Add(o);
         }
     }
 }
Exemple #3
0
        private ThreadedBindingList <FMSbaseObj> LoadSettingtoList()
        {
            ThreadedBindingList <FMSbaseObj> result = new ThreadedBindingList <FMSbaseObj>();
            XmlDocument doc;
            XmlNode     node;

            try
            {// load config document for current assembly
                doc = LoadConfigDocument();
                // retrieve TMOConfigurations
                node = doc.SelectSingleNode("//TMOConfigurations");
                if (node != null)
                {
                    foreach (XmlElement selectNode in node.SelectNodes("//TMOConfiguration"))
                    {
                        try
                        {
                            var _maxt = 1;
                            if (!int.TryParse(selectNode.GetAttribute("MaxProcessThreads"), out _maxt))
                            {
                                _maxt = 1;
                            }
                            FMSbaseObj o = FMSbaseObj.CreateFMSObj(selectNode.GetAttribute("Id"), selectNode.GetAttribute("InputUNC"),
                                                                   selectNode.GetAttribute("OutputUNC"), selectNode.GetAttribute("StoreProcedure"), _maxt, selectNode.GetAttribute("Classname"));
                            result.Add(o);
                        }
                        catch (Exception ex)
                        {
                            Loghelper.Write(LogLevel.Error, ex.Message);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Loghelper.Write(LogLevel.Error, e.Message);
            }
            finally
            {
                node = null;
                doc  = null;
            }

            return(result);
        }