コード例 #1
0
        /// <summary>
        /// Loads the colourz saved
        /// </summary>
        public void load()
        {
            if (!System.IO.Directory.Exists(Constants.CACHE_PATH))
            {
                System.IO.Directory.CreateDirectory(Constants.CACHE_PATH);
            }
            if (!System.IO.File.Exists(pathFile))
            {
                System.IO.File.Create(pathFile);
            }
            try
            {
                System.IO.StreamReader file = new System.IO.StreamReader(pathFile);
                string text = file.ReadLine();

                string[] segment = text.Split(';');

                for (int i = 0; i < segment.Length - 1; i++)
                {
                    try
                    {
                        string[] innerSeg = segment[i].Split(':');
                        string name = innerSeg[0];
                        Console.WriteLine();
                        Color col1 = (Color)ColorConverter.ConvertFromString("#" + innerSeg[1]);
                        Color col2 = (Color)ColorConverter.ConvertFromString("#" + innerSeg[2]);
                        Color col3 = (Color)ColorConverter.ConvertFromString("#" + innerSeg[3]);
                        Color col4 = (Color)ColorConverter.ConvertFromString("#" + innerSeg[4]);
                        Color col5 = (Color)ColorConverter.ConvertFromString("#" + innerSeg[5]);
                        ColourTheme theme = new ColourTheme(page, owner, name, col1, col2, col3, col4, col5);
                        theme.updateTheme();
                        MainWindow a = (MainWindow)page;
                        a.CTThemes.Children.Insert(0, theme);
                    }
                    catch
                    {

                    }
                   

                   
                }
            }
            catch
            {

            }
        }
コード例 #2
0
 private void cmdSaveTheme_Click(object sender, RoutedEventArgs e)
 {
     ColourTheme theme = new ColourTheme(this, CTThemes, txtThemeName.Text,
         (Color)recCT1.Fill.GetValue(SolidColorBrush.ColorProperty),
         (Color)recCT2.Fill.GetValue(SolidColorBrush.ColorProperty),
         (Color)recCT3.Fill.GetValue(SolidColorBrush.ColorProperty),
         (Color)recCT4.Fill.GetValue(SolidColorBrush.ColorProperty),
         (Color)recCT5.Fill.GetValue(SolidColorBrush.ColorProperty));
     theme.updateTheme();
     CTThemes.Children.Insert(0, theme);
     savedTheme.save();
     loadTheme("Theme Name", "FFFFFF", "B6B6B6", "7C7C7C", "494949", "131313");
 }