예제 #1
0
        public static WorkflowTheme Load(IDesignerSerializationManager serializationManager, string themeFilePath)
        {
            if (serializationManager == null)
            {
                throw new ArgumentNullException("serializationManager");
            }
            WorkflowTheme theme = null;

            if ((themeFilePath != null) && File.Exists(themeFilePath))
            {
                XmlReader reader = XmlReader.Create(themeFilePath);
                ThemeSerializationProvider provider = new ThemeSerializationProvider();
                try
                {
                    serializationManager.AddSerializationProvider(provider);
                    WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();
                    theme = serializer.Deserialize(serializationManager, reader) as WorkflowTheme;
                }
                finally
                {
                    serializationManager.RemoveSerializationProvider(provider);
                    reader.Close();
                }
                if (theme != null)
                {
                    theme.filePath = themeFilePath;
                }
            }
            return(theme);
        }