Exemplo n.º 1
0
        public bool WriteWidgetFile(string fileName)
        {
            try
            {
                var widget = new WidgetContent
                {
                    Parameters    = Parameters,
                    Placeholders  = Placeholders,
                    ConfigContent = ConfigContent,
                    HtmlContent   = HtmlContent,
                    ScriptContent = ScriptContent,
                    StyleContent  = StyleContent
                };
                var ser = JsonConvert.SerializeObject(widget);

                using (var w = new StreamWriter(fileName))
                {
                    w.Write(ser);
                    w.Flush();
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        private void StoreWidgetParametersAndContent(WidgetContent contentParameters)
        {
            Parameters.Name      = contentParameters.Parameters.Name;
            Parameters.Author    = contentParameters.Parameters.Author;
            Parameters.Version   = contentParameters.Parameters.Version;
            Parameters.Type      = contentParameters.Parameters.Type;
            Parameters.Locked    = contentParameters.Parameters.Locked;
            Parameters.Encrypted = contentParameters.Parameters.Encrypted;
            Parameters.Key       = contentParameters.Parameters.Key;

            StyleContent  = contentParameters.StyleContent;
            HtmlContent   = contentParameters.HtmlContent;
            ScriptContent = contentParameters.ScriptContent;
            ConfigContent = contentParameters.ConfigContent;
        }