Ejemplo n.º 1
0
 /// <summary>
 /// Copies parameters from ThemeModel into the Dockpanel Suite ThemeBase
 /// </summary>
 /// <param name="model">ThemeModel</param>
 public void fromThemeModel(ThemeModel model)
 {
     this.autoHide_dockStripBackgroundColor = stringToColor(model.autoHide_dockStripBackgroundColor);
     this.autoHide_dockStripColor           = stringToColor(model.autoHide_dockStripColor);
     this.autoHide_tabColor                   = stringToColor(model.autoHide_tabColor);
     this.autoHide_tabTextColor               = stringToColor(model.autoHide_tabTextColor);
     this.autoHide_textFont                   = stringToFont(model.autoHide_textFont);
     this.document_activeTabColor             = stringToColor(model.document_activeTabColor);
     this.document_activeTabTextColor         = stringToColor(model.document_activeTabTextColor);
     this.document_dockStripColor             = stringToColor(model.document_dockStripColor);
     this.document_hoverTabColor              = stringToColor(model.document_hoverTabColor);
     this.document_hoverTabTextColor          = stringToColor(model.document_hoverTabTextColor);
     this.document_inactiveTabColor           = stringToColor(model.document_inactiveTabColor);
     this.document_inactiveTabTextColor       = stringToColor(model.document_inactiveTabTextColor);
     this.dockPane_textFont                   = stringToFont(model.dockPane_textFont);
     this.toolWindow_activeCaptionColor       = stringToColor(model.toolWindow_activeCaptionColor);
     this.toolWindow_activeCaptionTextColor   = stringToColor(model.toolWindow_activeCaptionTextColor);
     this.toolWindow_activeTabColor           = stringToColor(model.toolWindow_activeTabColor);
     this.toolWindow_activeTabTextColor       = stringToColor(model.toolWindow_activeTabTextColor);
     this.toolWindow_dockStripColor           = stringToColor(model.toolWindow_dockStripColor);
     this.toolWindow_hoverTabColor            = stringToColor(model.toolWindow_hoverTabColor);
     this.toolWindow_hoverTabTextColor        = stringToColor(model.toolWindow_hoverTabTextColor);
     this.toolWindow_inactiveCaptionColor     = stringToColor(model.toolWindow_inactiveCaptionColor);
     this.toolWindow_inactiveCaptionTextColor = stringToColor(model.toolWindow_inactiveCaptionTextColor);
     this.toolWindow_inactiveTabColor         = stringToColor(model.toolWindow_inactiveTabColor);
     this.toolWindow_inactiveTabTextColor     = stringToColor(model.toolWindow_inactiveTabTextColor);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a simplified ThemeModel from the Dock Panel Suite ThemeBase
        /// </summary>
        /// <returns>ThemeModel</returns>
        public ThemeModel toThemeModel()
        {
            ThemeModel model = new ThemeModel();

            model.autoHide_dockStripBackgroundColor = colorToString(this.autoHide_dockStripBackgroundColor);
            model.autoHide_dockStripColor           = colorToString(this.autoHide_dockStripColor);
            model.autoHide_tabColor                   = colorToString(this.autoHide_tabColor);
            model.autoHide_tabTextColor               = colorToString(this.autoHide_tabTextColor);
            model.autoHide_textFont                   = fontToString(this.autoHide_textFont);
            model.document_activeTabColor             = colorToString(this.document_activeTabColor);
            model.document_activeTabTextColor         = colorToString(this.document_activeTabTextColor);
            model.document_dockStripColor             = colorToString(this.document_dockStripColor);
            model.document_hoverTabColor              = colorToString(this.document_hoverTabColor);
            model.document_hoverTabTextColor          = colorToString(this.document_hoverTabTextColor);
            model.document_inactiveTabColor           = colorToString(this.document_inactiveTabColor);
            model.document_inactiveTabTextColor       = colorToString(this.document_inactiveTabTextColor);
            model.dockPane_textFont                   = fontToString(this.dockPane_textFont);
            model.toolWindow_activeCaptionColor       = colorToString(this.toolWindow_activeCaptionColor);
            model.toolWindow_activeCaptionTextColor   = colorToString(this.toolWindow_activeCaptionTextColor);
            model.toolWindow_activeTabColor           = colorToString(this.toolWindow_activeTabColor);
            model.toolWindow_activeTabTextColor       = colorToString(this.toolWindow_activeTabTextColor);
            model.toolWindow_dockStripColor           = colorToString(this.toolWindow_dockStripColor);
            model.toolWindow_hoverTabColor            = colorToString(this.toolWindow_hoverTabColor);
            model.toolWindow_hoverTabTextColor        = colorToString(this.toolWindow_hoverTabTextColor);
            model.toolWindow_inactiveCaptionColor     = colorToString(this.toolWindow_inactiveCaptionColor);
            model.toolWindow_inactiveCaptionTextColor = colorToString(this.toolWindow_inactiveCaptionTextColor);
            model.toolWindow_inactiveTabColor         = colorToString(this.toolWindow_inactiveTabColor);
            model.toolWindow_inactiveTabTextColor     = colorToString(this.toolWindow_inactiveTabTextColor);
            return(model);
        }
Ejemplo n.º 3
0
        // Save Theme - File Menu Button
        private void saveThemeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog fd = new SaveFileDialog();

            fd.Filter = "XML |*.xml";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            String fileName = Path.GetFullPath(fd.FileName);

            if (!ThemeModel.toFile(null, fileName))
            {
                MessageBox.Show("An exception has occured.\nFile may not have been saved.", "File Not Saved", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create ThemeModel From XML File
 /// </summary>
 /// <param name="fileName">Full path of the file for XML to be read from.</param>
 /// <returns>Theme Model created from the XML file.</returns>
 public static ThemeModel fromFile(String fileName)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(ThemeModel));
         FileStream    fileStream = new FileStream(fileName, FileMode.Open);
         XmlReader     reader     = XmlReader.Create(fileStream);
         ThemeModel    themeModel = (ThemeModel)serializer.Deserialize(reader);
         fileStream.Close();
         return(themeModel);
     }
     catch (System.InvalidOperationException ex)
     {
         return(null);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Serialize ThemeModel to XML File
 /// </summary>
 /// <param name="themeModel">Theme Model to be serialized.</param>
 /// <param name="fileName">Full path of file for XML to be writen to.</param>
 public static bool toFile(ThemeModel themeModel, String fileName)
 {
     try
     {
         if (themeModel == null)
         {
             return(false);
         }
         XmlSerializer serializer = new XmlSerializer(typeof(ThemeModel));
         TextWriter    writer     = new StreamWriter(fileName, false);
         serializer.Serialize(writer, themeModel);
         writer.Close();
         return(true);
     }
     catch (System.Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
        // Load Theme - File Menu Button
        private void loadThemeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "XML |*.xml";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            String fileName = Path.GetFullPath(fd.FileName);

            ThemeModel model = ThemeModel.fromFile(fileName);

            if (model == null)
            {
                MessageBox.Show("File selected is not a valid XML theme file.", "Invalid File", MessageBoxButtons.OK);
                return;
            }
            themeFacade.fromThemeModel(model);

            propertyGrid.Refresh();
            dockPanel1.Hide();
            dockPanel1.Show();
        }