コード例 #1
0
        public static bool DeSerirlizeStyles(string stylepath)
        {
            WizardCustomStylesCollection styles = null;

            if (File.Exists(stylepath))
            {
                System.IO.FileStream stream = System.IO.File.Open(stylepath, System.IO.FileMode.Open);

                try
                {
                    styles = Webb.Utilities.Serializer.DeserializeObject(stream) as WizardCustomStylesCollection;

                    stream.Close();

                    _AvailbleWizardStyles = styles;

                    return(true);
                }
                catch (Exception ex)
                {
                    stream.Close();

                    Webb.Utilities.MessageBoxEx.ShowError("Failed to read style files!\n" + ex.Message);

                    return(false);
                }
            }
            return(false);
        }
コード例 #2
0
        public static void DeSerirlizeStyles(TemplateType templateType)
        {
            string stylepath = GetStylePath(templateType.ToString());

            if (File.Exists(stylepath))
            {
                System.IO.FileStream stream = System.IO.File.Open(stylepath, System.IO.FileMode.Open);

                try
                {
                    _AvailbleWizardStyles = Webb.Utilities.Serializer.DeserializeObject(stream) as  WizardCustomStylesCollection;
                }
                catch (Exception ex)
                {
                    Webb.Utilities.MessageBoxEx.ShowError("Failed to read style files!\n" + ex.Message);

                    Environment.Exit(-1);
                }
                finally
                {
                    stream.Close();
                }
            }
            else
            {
                _AvailbleWizardStyles = new WizardCustomStylesCollection();

                _AvailbleWizardStyles.TemplateType = templateType;
            }
        }