예제 #1
0
        /// <summary>
        /// Return new addin object
        /// </summary>
        /// <param name="addinType"></param>
        /// <returns></returns>
        public override IWAddIn GetAddin(string addinType)
        {
            ClockAddIn objClockAddIn = null;

            try
            {
                objClockAddIn             = new ClockAddIn();
                objClockAddIn.Provider    = Provider;
                objClockAddIn.Engine      = Engine;
                objClockAddIn.SceneGraph  = m_ObjSceneGraph;
                objClockAddIn.TableName   = "Clock";
                objClockAddIn.Index       = 0;
                objClockAddIn.RowsPerPage = 1;
                if (m_WService != null)
                {
                    objClockAddIn.Service = m_WService;
                }
                if (m_lstAddins != null)
                {
                    m_lstAddins.Add(objClockAddIn);
                }

                return(objClockAddIn);
            }
            finally
            {
                objClockAddIn = null;
            }
        }
예제 #2
0
        }//end (ExecuteMethod)

        /// <summary>
        /// Return the object of Add-IN to engine.
        /// </summary>
        /// <param name="sName"></param>
        /// <returns></returns>
        public object GetObject(string sName)
        {
            ClockAddIn objClockAddIn = new ClockAddIn();

            if (m_ObjEngine != null)
            {
                objClockAddIn.SetEngine(m_ObjEngine);
            }
            if (m_objHost != null)
            {
                INameCreationService objINameCreationService = m_objHost.GetService(DesignerService.INameCreationService) as INameCreationService;
                if (objINameCreationService != null)
                {
                    objClockAddIn.SetEngine(m_ObjEngine);
                    objClockAddIn.ObjectName = objINameCreationService.GetName(this.Name);
                    return(objClockAddIn);
                }
            }
            return(objClockAddIn);
        }//end (GetObject)
예제 #3
0
        /// <summary>
        /// On Scenegraph opened load is called
        /// Read xml and craete addin objects
        /// </summary>
        /// <param name="sgKey"></param>
        /// <param name="data"></param>
        public override void Load(string sgKey, string data)
        {
            IEnumerable <XElement> xeAddins = null;
            ClockAddIn             objAddin = null;
            XDocument xdocAddinDetail       = null;

            try
            {
                if (!string.IsNullOrEmpty(data))
                {
                    xdocAddinDetail = XDocument.Parse(data);
                    if (xdocAddinDetail != null)
                    {
                        if (m_lstAddins != null)
                        {
                            xeAddins = xdocAddinDetail.XPathSelectElements("data//addins/addin");
                            if (xeAddins != null && xeAddins.Count() > 0)
                            {
                                foreach (XElement objxem in xeAddins)
                                {
                                    objAddin             = new ClockAddIn();
                                    objAddin.Provider    = Provider;
                                    objAddin.Engine      = Engine;
                                    objAddin.SceneGraph  = m_ObjSceneGraph;
                                    objAddin.TableName   = "Clock";
                                    objAddin.Index       = 0;
                                    objAddin.RowsPerPage = 1;

                                    if (objxem.Attribute("addinid") != null &&
                                        objxem.Attribute("addinid").Value != null)
                                    {
                                        objAddin.InstanceId = objxem.Attribute("addinid").Value;
                                    }
                                    if (objxem.Attribute("name") != null &&
                                        objxem.Attribute("name").Value != null)
                                    {
                                        objAddin.Name = objxem.Attribute("name").Value;
                                    }
                                    if (objxem.Attribute("type") != null &&
                                        objxem.Attribute("type").Value != null)
                                    {
                                        objAddin.SetAddinType(objxem.Attribute("type").Value);
                                    }
                                    if (objxem.Value != null)
                                    {
                                        objAddin.Config = objxem.Value;
                                    }
                                    objAddin.StartUp();
                                    m_lstAddins.Add(objAddin);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                xeAddins = null;
                objAddin = null;
            }
        }