Exemplo n.º 1
0
        public static List<Variable> GetInputParameters(InstalledWidget InstalledWidget)
        {
            List<Variable> UIProperties = new List<Variable>();

            StreamReader reader = File.OpenText(InstalledWidget.WidgetXMLPath);

            string Code = reader.ReadToEnd();

            Interpreter App = new Interpreter();
            DateTime Start = DateTime.Now;

            XmlDocument ApplicationXML = new XmlDocument();

            Code = RegexXMLFormat.Modify(Code);

            Code = "<widget>" + Code + "</widget>";

            try
            {
                ApplicationXML.LoadXml(Code);
                UIProperties = App.GetInputParameters(Code, InstalledWidget);
            }
            catch (XmlException ex)
            {
                throw ex;
            }

            return UIProperties;
        }
Exemplo n.º 2
0
        public void SaveInputParameters(int InstalledWidgetID, Object[] InputParams)
        {
            user = (YoGomeeUser)Session["User"];

            InstalledWidget widget = new InstalledWidget(InstalledWidgetID);
            Interpreter.RunWidget.SaveInputParameters(widget, InputParams);
        }
Exemplo n.º 3
0
        public void UpdateWidget(int InstalledWidgetID)
        {
            user = (YoGomeeUser)Session["User"];

            InstalledWidget iWidget = new InstalledWidget(InstalledWidgetID);

            iWidget.OriginalWidget.UpdateInstallWidget(user);
        }
Exemplo n.º 4
0
        public void DisableInstalledWidget(int InstalledWidgetID, bool Enable)
        {
            user = (YoGomeeUser)Context.Session["User"];

            InstalledWidget iw = new InstalledWidget(InstalledWidgetID);
            iw.Enabled = Enable;
            iw.Save();
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(WidgetSettings));

            InstalledWidgetID = Request.Params["instw"];
            int intInstalledWidgetID = Int32.Parse(InstalledWidgetID);
            InstalledWidget = new InstalledWidget(intInstalledWidgetID);
            WidgetName = InstalledWidget.OriginalWidget.Name;

            List<Variable> UIFieldVariables = RunWidget.GetInputParameters(InstalledWidget);

            for (int i = 0; i < UIFieldVariables.Count; i++)
            {
                UIFieldsHTML += String.Format("<p>{0} <input class='widgetField' type='text' value='{1}'></p>", UIFieldVariables[i].Name, UIFieldVariables[i].Value.ToString());
            }
        }
Exemplo n.º 6
0
        public static void SaveInputParameters(InstalledWidget InstalledWidget, object[] InputParameters)
        {
            StreamReader reader = File.OpenText(InstalledWidget.WidgetXMLPath);
            string Code = reader.ReadToEnd();

            Interpreter App = new Interpreter();

            XmlDocument ApplicationXML = new XmlDocument();

            Code = RegexXMLFormat.Modify(Code);

            Code = "<widget>" + Code + "</widget>";

            try
            {
                ApplicationXML.LoadXml(Code);
                App.SaveInputParameters(Code, InputParameters, InstalledWidget);
            }
            catch (XmlException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        public List<Variable> GetInputParameters(string xml,InstalledWidget InstalledWidget)
        {
            Instance.ApplicationVariables = Variable.OpenApplicationState();

            GetInputParameterTags(xml);

            var IParamsInterator = from v in Instance.ApplicationVariables where v.VariableType == VariableType.InputParameter select v;

            List<Variable> IParams = (List<Variable>)IParamsInterator.ToList();

            XmlDocument XmlDoc = new XmlDocument();
            try
            {
                XmlDoc.Load(InstalledWidget.InputParameterXmlpath);

                XmlNodeList Nodes = XmlDoc.GetElementsByTagName("inputparameter");

                for (int i = 0; i < IParams.Count(); i++)
                {
                    string InputParameterName = IParams[i].Name;

                    for (int j = 0; j < Nodes.Count; j++)
                    {
                        string InputName = "";
                        string InputValue = "";

                        for (int k = 0; k < Nodes[i].Attributes.Count; k++)
                        {
                            string AttributeName = Nodes[i].Attributes[k].Name;

                            if (AttributeName == "name")
                            {
                                InputName = Nodes[i].Attributes[k].Value;

                                if (InputName == InputParameterName)
                                {
                                    IParams[i].Value = Nodes[i].InnerText;
                                    //IParams[i].Label = "";
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }

            return IParams.ToList();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Takes an array organised linearly mapped in order of the InputParameter tags
        /// </summary>
        /// <param name="xml"></param>
        public void SaveInputParameters(string xml,object[] InputParameters ,InstalledWidget InstalledWidget)
        {
            List<Variable> InputParameterTags = GetInputParameters(xml, InstalledWidget);

            string Xml = "";

            for (int i = 0; i < InputParameters.Length; i++)
            {
                Xml += String.Format(@"<inputparameter name=""{0}"">{1}</inputparameter>" + Environment.NewLine, InputParameterTags[i].Name, InputParameters[i]);
            }

            FileInfo f = new FileInfo(InstalledWidget.InputParameterXmlpath);
            StreamWriter writer = f.CreateText();

            writer.Write("<parameters>" + Xml + "</parameters>");
            writer.Flush();
            writer.Close();
        }