コード例 #1
0
        public Models.ApplicationType GetAllApplicationTypes()
        {
            try
            {
                // Create Root
                Models.ApplicationType root = new Models.ApplicationType();
                root.ID       = Guid.NewGuid().ToString();
                root.Name     = null;
                root.Label    = "Root";
                root.Start    = false;
                root.Children = new List <Models.ApplicationType>();

                foreach (ViewModel.Manager.ControlTypes.ApplicationType apptype in this.Session.ApplicationTypes)
                {
                    Models.ApplicationType parent       = this.Child(root, apptype.Path);
                    Models.ApplicationType modelapptype = new Models.ApplicationType();
                    modelapptype.ID    = Guid.NewGuid().ToString();
                    modelapptype.Name  = apptype.Name;
                    modelapptype.Label = apptype.Label;
                    modelapptype.Icon  = apptype.Icon;
                    modelapptype.Start = apptype.Start;
                    parent.Children.Add(modelapptype);
                }

                return(root);
            }
            catch (Exception e)
            {
                throw this.ProcessException(e);
            }
        }
コード例 #2
0
        private Models.ApplicationType Child(Models.ApplicationType Parent, String Path)
        {
            if (Path != null)
            {
                String thispath      = null;
                String remainingpath = null;
                Int32  seppos        = Path.IndexOf('/');

                if (seppos > 0)
                {
                    thispath      = Path.Substring(0, seppos);
                    remainingpath = Path.Substring(seppos + 1, Path.Length - seppos - 1);
                }
                else
                {
                    thispath      = Path;
                    remainingpath = null;
                }

                Models.ApplicationType thischild = null;

                foreach (Models.ApplicationType child in Parent.Children)
                {
                    if (child.Label.Equals(thispath))
                    {
                        thischild = child;
                        break;
                    }
                }

                if (thischild == null)
                {
                    thischild          = new Models.ApplicationType();
                    thischild.ID       = Guid.NewGuid().ToString();
                    thischild.Name     = null;
                    thischild.Label    = thispath;
                    thischild.Start    = false;
                    thischild.Children = new List <Models.ApplicationType>();
                    Parent.Children.Add(thischild);
                }

                if (remainingpath == null)
                {
                    return(thischild);
                }
                else
                {
                    return(this.Child(thischild, remainingpath));
                }
            }
            else
            {
                return(Parent);
            }
        }
コード例 #3
0
        public Models.Responses.Control GetApplication(Models.ApplicationType ApplicationType)
        {
            try
            {
                // Get Application Type
                Manager.ControlTypes.ApplicationType apptype = this.Session.ApplicationType(ApplicationType.Name);

                // Get Application Control
                ViewModel.Containers.Application applicationcontrol = this.Session.Application(apptype);

                return(new Models.Responses.Control(this.Session, applicationcontrol));
            }
            catch (Exception e)
            {
                throw this.ProcessException(e);
            }
        }